From bd4f1af15aa7c2d6f822db58d418c51cf997bcc0 Mon Sep 17 00:00:00 2001 From: 2swo Date: Tue, 19 Mar 2024 20:07:43 +0900 Subject: [PATCH 1/4] setting(#368)compose nginx-certbot --- docker-compose.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 99402c1f..b39ab972 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,7 +20,7 @@ services: - '6379:6379' restart: always - nginx-certbot: + api-nginx-certbot: image: 2swo/back-nginx-certbot ports: - '80:80' @@ -28,6 +28,14 @@ services: env_file: - .env.nginx-certbot + # dev-nginx-certbot: + # image: 2swo/dev-back-nginx-certbot + # ports: + # - '80:80' + # - '443:443' + # env_file: + # - .env.nginx-certbot + # mysql 이미지는 따로 dockerfile로 빌드되진 않습니다. # version과 port,env파일명,command 참고하시면 될 것 같습니다. # development_db: From 5bb6f0cc52b11d5ad0354cbf19ea2f7503b71c64 Mon Sep 17 00:00:00 2001 From: 2swo Date: Tue, 19 Mar 2024 20:10:56 +0900 Subject: [PATCH 2/4] setting(#368) nginx-conf --- dockerfile | 54 +++++++++++++++++++++++++++--------------------------- nginx.conf | 9 ++++++--- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/dockerfile b/dockerfile index 87e635ea..b08d996d 100644 --- a/dockerfile +++ b/dockerfile @@ -1,22 +1,22 @@ -# Node.js 버전을 기반으로 하는 도커 이미지 사용 -FROM node:18.16.0-alpine AS build +# # Node.js 버전을 기반으로 하는 도커 이미지 사용 +# FROM node:18.16.0-alpine AS build -# 작업 디렉토리 설정 -WORKDIR /home/app +# # 작업 디렉토리 설정 +# WORKDIR /home/app -# 작업 디렉토리에 내용 복사 -COPY package*.json ./ +# # 작업 디렉토리에 내용 복사 +# COPY package*.json ./ -RUN npm ci --only=production && npm cache clean --force +# RUN npm ci --only=production && npm cache clean --force -# /dist 폴더를 이미지에 복사 -COPY ./dist ./dist +# # /dist 폴더를 이미지에 복사 +# COPY ./dist ./dist -# 애플리케이션 실행 -CMD ["npm", "run", "start:prod"] +# # 애플리케이션 실행 +# CMD ["npm", "run", "start:prod"] -# 애플리케이션을 실행할 포트 -EXPOSE 3000 +# # 애플리케이션을 실행할 포트 +# EXPOSE 3000 ######################### Redis ############################## @@ -40,22 +40,22 @@ EXPOSE 3000 ######################### nginx-certbot ############################## -# #nginx 이미지 사용 -# FROM nginx:latest +#nginx 이미지 사용 +FROM nginx:latest -# #nignx와 certbot 설치 -# RUN apt-get update && apt-get install -y certbot python3-certbot-nginx +#nignx와 certbot 설치 +RUN apt-get update && apt-get install -y certbot python3-certbot-nginx -# #nginx.conf(설정파일 복사) -# COPY nginx.conf /etc/nginx/nginx.conf +#nginx.conf(설정파일 복사) +COPY nginx.conf /etc/nginx/nginx.conf -# #port -# EXPOSE 80 -# EXPOSE 443 +#port +EXPOSE 80 +EXPOSE 443 -# #entrypoint.sh 복사, 권한부여 -# COPY entrypoint.sh /entrypoint.sh -# RUN chmod +x /entrypoint.sh +#entrypoint.sh 복사, 권한부여 +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh -# #컨테이너가 실행될 때 entrypoint.sh 실행 -# CMD ["/entrypoint.sh"] +#컨테이너가 실행될 때 entrypoint.sh 실행 +CMD ["/entrypoint.sh"] diff --git a/nginx.conf b/nginx.conf index cc965c9b..23fdef50 100644 --- a/nginx.conf +++ b/nginx.conf @@ -5,14 +5,17 @@ events { http { server { listen 80; - server_name api.menbosha.kr; # back은 api만 사용 + # server_name api.menbosha.kr; # 베포백서버 + server_name dev.menbosha.kr; # 개발백서버 location / { - proxy_pass http://13.124.22.25:3000; + # proxy_pass http://13.124.22.25:3000; # 베포백서버 ipv4 + proxy_pass http://15.164.222.126:3000; # 개발백서버 ipv4 } location /socket.io/ { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; - proxy_pass http://13.124.22.25:3000; + # proxy_pass http://13.124.22.25:3000; # 베포백서버 ipv4 + proxy_pass http://15.164.222.126:3000; # 개발백서버 ipv4 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; From 946865050d0be3880d062784c52e68bbeab01f5f Mon Sep 17 00:00:00 2001 From: 2swo Date: Tue, 19 Mar 2024 20:21:15 +0900 Subject: [PATCH 3/4] =?UTF-8?q?setting(#368)=20docker-compose=20=ED=99=95?= =?UTF-8?q?=EB=A6=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b39ab972..bfc5c46f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,20 +21,20 @@ services: restart: always api-nginx-certbot: - image: 2swo/back-nginx-certbot + image: 2swo/api-back-nginx-certbot ports: - '80:80' - '443:443' env_file: - .env.nginx-certbot - # dev-nginx-certbot: - # image: 2swo/dev-back-nginx-certbot - # ports: - # - '80:80' - # - '443:443' - # env_file: - # - .env.nginx-certbot + # dev-nginx-certbot: #dev서버 nginx파일 + # image: 2swo/dev-back-nginx-certbot + # ports: + # - '80:80' + # - '443:443' + # env_file: + # - .env.nginx-certbot # mysql 이미지는 따로 dockerfile로 빌드되진 않습니다. # version과 port,env파일명,command 참고하시면 될 것 같습니다. From 3a0a552c15ad37cb13a309288dbdbbf9bc12f9cf Mon Sep 17 00:00:00 2001 From: 2swo Date: Tue, 19 Mar 2024 20:33:23 +0900 Subject: [PATCH 4/4] =?UTF-8?q?setting(#368)=20=EC=A3=BC=EC=84=9D=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dockerfile | 54 +++++++++++++++++++++++++++--------------------------- nginx.conf | 12 ++++++------ 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/dockerfile b/dockerfile index b08d996d..87e635ea 100644 --- a/dockerfile +++ b/dockerfile @@ -1,22 +1,22 @@ -# # Node.js 버전을 기반으로 하는 도커 이미지 사용 -# FROM node:18.16.0-alpine AS build +# Node.js 버전을 기반으로 하는 도커 이미지 사용 +FROM node:18.16.0-alpine AS build -# # 작업 디렉토리 설정 -# WORKDIR /home/app +# 작업 디렉토리 설정 +WORKDIR /home/app -# # 작업 디렉토리에 내용 복사 -# COPY package*.json ./ +# 작업 디렉토리에 내용 복사 +COPY package*.json ./ -# RUN npm ci --only=production && npm cache clean --force +RUN npm ci --only=production && npm cache clean --force -# # /dist 폴더를 이미지에 복사 -# COPY ./dist ./dist +# /dist 폴더를 이미지에 복사 +COPY ./dist ./dist -# # 애플리케이션 실행 -# CMD ["npm", "run", "start:prod"] +# 애플리케이션 실행 +CMD ["npm", "run", "start:prod"] -# # 애플리케이션을 실행할 포트 -# EXPOSE 3000 +# 애플리케이션을 실행할 포트 +EXPOSE 3000 ######################### Redis ############################## @@ -40,22 +40,22 @@ ######################### nginx-certbot ############################## -#nginx 이미지 사용 -FROM nginx:latest +# #nginx 이미지 사용 +# FROM nginx:latest -#nignx와 certbot 설치 -RUN apt-get update && apt-get install -y certbot python3-certbot-nginx +# #nignx와 certbot 설치 +# RUN apt-get update && apt-get install -y certbot python3-certbot-nginx -#nginx.conf(설정파일 복사) -COPY nginx.conf /etc/nginx/nginx.conf +# #nginx.conf(설정파일 복사) +# COPY nginx.conf /etc/nginx/nginx.conf -#port -EXPOSE 80 -EXPOSE 443 +# #port +# EXPOSE 80 +# EXPOSE 443 -#entrypoint.sh 복사, 권한부여 -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh +# #entrypoint.sh 복사, 권한부여 +# COPY entrypoint.sh /entrypoint.sh +# RUN chmod +x /entrypoint.sh -#컨테이너가 실행될 때 entrypoint.sh 실행 -CMD ["/entrypoint.sh"] +# #컨테이너가 실행될 때 entrypoint.sh 실행 +# CMD ["/entrypoint.sh"] diff --git a/nginx.conf b/nginx.conf index 23fdef50..29e82a63 100644 --- a/nginx.conf +++ b/nginx.conf @@ -5,17 +5,17 @@ events { http { server { listen 80; - # server_name api.menbosha.kr; # 베포백서버 - server_name dev.menbosha.kr; # 개발백서버 + server_name api.menbosha.kr; # 베포백서버 + # server_name dev.menbosha.kr; # 개발백서버 location / { - # proxy_pass http://13.124.22.25:3000; # 베포백서버 ipv4 - proxy_pass http://15.164.222.126:3000; # 개발백서버 ipv4 + proxy_pass http://13.124.22.25:3000; # 베포백서버 ipv4 + # proxy_pass http://15.164.222.126:3000; # 개발백서버 ipv4 } location /socket.io/ { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; - # proxy_pass http://13.124.22.25:3000; # 베포백서버 ipv4 - proxy_pass http://15.164.222.126:3000; # 개발백서버 ipv4 + proxy_pass http://13.124.22.25:3000; # 베포백서버 ipv4 + # proxy_pass http://15.164.222.126:3000; # 개발백서버 ipv4 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";