Skip to content

Commit

Permalink
Merge pull request #59 from JSJ-Organization/feature/fe-add-domain
Browse files Browse the repository at this point in the history
#51 - prod-env localhost를 VITE_DOMAIN로 대체
  • Loading branch information
Min-SungJo authored Jul 15, 2024
2 parents fe7a8b6 + 11a5e00 commit f77dadc
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ jobs:
echo "REPO_NAME=${{ secrets.REPO_NAME }}" >> .env
echo "VERSION=$VERSION" >> .env
echo "DOMAIN=${{ secrets.DOMAIN }}" >> .env
echo "VITE_DOMAIN=${{ secrets.DOMAIN }}" >> .env
- name: Copy files via SSH
run: |
scp -P ${{ secrets.SSH_PORT }} -o StrictHostKeyChecking=no docker-compose.yml .env ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/home/${{ secrets.SSH_USERNAME }}/
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
PGDATA: /var/lib/postgresql/data
TZ: Asia/Seoul
volumes:
- postgres_data:/var/lib/postgresql/data
- ./sql:/docker-entrypoint-initdb.d
Expand All @@ -25,6 +26,7 @@ services:
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
TZ: Asia/Seoul
volumes:
- pgadmin:/var/lib/pgadmin
networks:
Expand Down Expand Up @@ -72,6 +74,8 @@ services:
VITE_BACKEND_URL: ${VITE_BACKEND_URL}
VITE_GEOSERVER_URL: ${VITE_GEOSERVER_URL}
VITE_PGADMIN_URL: ${VITE_PGADMIN_URL}
VITE_DOMAIN: ${VITE_DOMAIN}
TZ: Asia/Seoul
volumes:
- ssl:/etc/letsencrypt/live/${DOMAIN}
networks:
Expand Down
7 changes: 7 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ FROM node:20-alpine AS build
# 작업 디렉토리 설정
WORKDIR /app

# .env 파일 생성
ARG DOMAIN
RUN echo "VITE_DOMAIN=${DOMAIN}" > .env

# package.json과 package-lock.json 복사
COPY package*.json ./

Expand All @@ -22,6 +26,9 @@ FROM nginx:alpine
# 환경 변수 설정
ARG DOMAIN

# Certbot 설치
RUN apk add --no-cache certbot certbot-nginx openssl

COPY ./ssl/ /etc/letsencrypt/live/${DOMAIN}/
# SSL 인증서 파일 확인
RUN ls -l /etc/letsencrypt/live/${DOMAIN}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/map/AgriMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const AgriMap = () => {
const getAgriData = async (distance) => {
try {
showLoading();
const url = `http://localhost:8080/api/v1/search/office?query=s&x=${x}&y=${y}&distance=${distance}`;
const url = `https://${import.meta.env.VITE_DOMAIN}/api/v1/search/office?query=s&x=${x}&y=${y}&distance=${distance}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
Expand Down Expand Up @@ -68,7 +68,7 @@ const AgriMap = () => {

const vworldLayer = new TileLayer({
source: new XYZ({
url: `http://localhost:8080/api/v1/search/wmts/Base/{z}/{y}/{x}.png`,
url: `https://${import.meta.env.VITE_DOMAIN}/api/v1/search/wmts/Base/{z}/{y}/{x}.png`,
}),
});

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/map/CoordMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const CoordMap = () => {
type: 'base',
visible: false,
source: new XYZ({
url : `http://localhost:8080/api/v1/search/wmts/Base/{z}/{y}/{x}.png`,
url : `https://${import.meta.env.VITE_DOMAIN}/api/v1/search/wmts/Base/{z}/{y}/{x}.png`,
})
})

Expand All @@ -50,7 +50,7 @@ const CoordMap = () => {
type: 'base',
visible: false,
source: new XYZ({
url : `http://localhost:8080/api/v1/search/wmts/Satellite/{z}/{y}/{x}.jpeg`,
url : `https://${import.meta.env.VITE_DOMAIN}/api/v1/search/wmts/Satellite/{z}/{y}/{x}.jpeg`,
})
})

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pathData.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export const pathData = {
description: '좌표 변환기',
searchException: '검색 결과가 없습니다.',
api: {
input: 'http://localhost:8080/api/v1/search/api-point-with-page',
input: `https://${import.meta.env.VITE_DOMAIN}/api/v1/search/api-point-with-page`,
}
},
'agricultural' : {
title : '농기계 임대 검색',
description: '농기계 임대 검색',
searchException: '해당 주소에 농기계가 없습니다.',
api: {
input: 'http://localhost:8080/api/v1/search/office-address',
input: `https://${import.meta.env.VITE_DOMAIN}/api/v1/search/office-address`,
}
},
}
}

0 comments on commit f77dadc

Please sign in to comment.