From 3a0d99cae00dcfa5f4c992b16f080f345e4f102c Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Mon, 19 Feb 2024 22:23:35 +0900 Subject: [PATCH 01/11] =?UTF-8?q?test=20:=20=EB=B0=B0=ED=8F=AC=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/fastapi/dev/predict_content.py | 1 + 1 file changed, 1 insertion(+) diff --git a/config/fastapi/dev/predict_content.py b/config/fastapi/dev/predict_content.py index 12c4fd5..9a13a0b 100644 --- a/config/fastapi/dev/predict_content.py +++ b/config/fastapi/dev/predict_content.py @@ -77,6 +77,7 @@ def predict(text: str = Query(...)): # Return the result as JSON return {"result": result} + except Exception as e: raise HTTPException(status_code=500, detail=str(e)) # From cced883facb46ac24156a67a595fac53f191b21f Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Mon, 19 Feb 2024 22:27:11 +0900 Subject: [PATCH 02/11] =?UTF-8?q?test=20:=20=EB=B0=B0=ED=8F=AC=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-deploy.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dev-deploy.yml b/.github/workflows/dev-deploy.yml index ea8866c..2720aa5 100644 --- a/.github/workflows/dev-deploy.yml +++ b/.github/workflows/dev-deploy.yml @@ -108,12 +108,12 @@ jobs: key: ${{ secrets.KEY_PROD }} script: | sh ~/srv/ubuntu/gifty-dev/config/scripts/deploy.sh - sudo docker stop backend-dev - sudo docker stop gifty-nginx-dev - sudo docker stop gifty-redis-dev - sudo docker rm backend-dev - sudo docker rm gifty-nginx-dev - sudo docker rm gifty-redis-dev - sudo docker rmi -f $(sudo docker images -q) - sudo docker-compose -f ~/srv/ubuntu/gifty-dev/docker-compose.yml pull - sudo docker-compose -f ~/srv/ubuntu/gifty-dev/docker-compose.yml up --build -d \ No newline at end of file +# sudo docker stop backend-dev +# sudo docker stop gifty-nginx-dev +# sudo docker stop gifty-redis-dev +# sudo docker rm backend-dev +# sudo docker rm gifty-nginx-dev +# sudo docker rm gifty-redis-dev +# sudo docker rmi -f $(sudo docker images -q) +# sudo docker-compose -f ~/srv/ubuntu/gifty-dev/docker-compose.yml pull +# sudo docker-compose -f ~/srv/ubuntu/gifty-dev/docker-compose.yml up --build -d \ No newline at end of file From 9fa4d406734a20692ea56499662ec2ec94a1db95 Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Mon, 19 Feb 2024 23:06:36 +0900 Subject: [PATCH 03/11] =?UTF-8?q?test=20:=20=EB=B0=B0=ED=8F=AC=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-deploy.yml | 18 +++++++++--------- config/fastapi/dev/predict_content.py | 2 +- docker-compose.yml | 5 +++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dev-deploy.yml b/.github/workflows/dev-deploy.yml index 2720aa5..ea8866c 100644 --- a/.github/workflows/dev-deploy.yml +++ b/.github/workflows/dev-deploy.yml @@ -108,12 +108,12 @@ jobs: key: ${{ secrets.KEY_PROD }} script: | sh ~/srv/ubuntu/gifty-dev/config/scripts/deploy.sh -# sudo docker stop backend-dev -# sudo docker stop gifty-nginx-dev -# sudo docker stop gifty-redis-dev -# sudo docker rm backend-dev -# sudo docker rm gifty-nginx-dev -# sudo docker rm gifty-redis-dev -# sudo docker rmi -f $(sudo docker images -q) -# sudo docker-compose -f ~/srv/ubuntu/gifty-dev/docker-compose.yml pull -# sudo docker-compose -f ~/srv/ubuntu/gifty-dev/docker-compose.yml up --build -d \ No newline at end of file + sudo docker stop backend-dev + sudo docker stop gifty-nginx-dev + sudo docker stop gifty-redis-dev + sudo docker rm backend-dev + sudo docker rm gifty-nginx-dev + sudo docker rm gifty-redis-dev + sudo docker rmi -f $(sudo docker images -q) + sudo docker-compose -f ~/srv/ubuntu/gifty-dev/docker-compose.yml pull + sudo docker-compose -f ~/srv/ubuntu/gifty-dev/docker-compose.yml up --build -d \ No newline at end of file diff --git a/config/fastapi/dev/predict_content.py b/config/fastapi/dev/predict_content.py index 9a13a0b..647d29b 100644 --- a/config/fastapi/dev/predict_content.py +++ b/config/fastapi/dev/predict_content.py @@ -2,7 +2,7 @@ from urllib.parse import unquote import torch from transformers import BertTokenizer -from custom_model import CustomModel +# from custom_model import CustomModel import argparse import re import os diff --git a/docker-compose.yml b/docker-compose.yml index e9585d5..a93be34 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,10 +11,10 @@ services: - "6379:6379" backend-dev: - image: limhwasup/gifty-server-dev + container_name: backend-dev +# image: limhwasup/gifty-server-dev build: dockerfile: Dockerfile - container_name: backend-dev hostname: backend-dev ports: - "8080:8080" @@ -44,3 +44,4 @@ services: context: ./config/fastapi/dev ports: - "8000:8000" + From cf86700f72289c14a1dbf120159551726788b144 Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Mon, 19 Feb 2024 23:13:17 +0900 Subject: [PATCH 04/11] =?UTF-8?q?test=20:=20=EB=B0=B0=ED=8F=AC=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index a93be34..d0381cf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,7 @@ services: # image: limhwasup/gifty-server-dev build: dockerfile: Dockerfile + context: . hostname: backend-dev ports: - "8080:8080" From 7f3e66a34871f451d34e9294082cb95f81112e00 Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Mon, 19 Feb 2024 23:22:55 +0900 Subject: [PATCH 05/11] =?UTF-8?q?test=20:=20=EB=B0=B0=ED=8F=AC=20test?= 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 d0381cf..bb491bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: backend-dev: container_name: backend-dev -# image: limhwasup/gifty-server-dev + image: limhwasup/gifty-server-dev build: dockerfile: Dockerfile context: . @@ -38,11 +38,11 @@ services: - /etc/letsencrypt:/etc/letsencrypt:ro # Share SSL certification restart: always - fastapi: - container_name: fastapi-dev - build: - dockerfile: Dockerfile - context: ./config/fastapi/dev - ports: - - "8000:8000" +# fastapi: +# container_name: fastapi-dev +# build: +# dockerfile: Dockerfile +# context: ./config/fastapi/dev +# ports: +# - "8000:8000" From fc602381ffa8af7aa665d3c68cee6045f649f58a Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Mon, 19 Feb 2024 23:28:23 +0900 Subject: [PATCH 06/11] =?UTF-8?q?test=20:=20nginx.conf=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=ED=9B=84=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/nginx/dev/nginx.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/nginx/dev/nginx.conf b/config/nginx/dev/nginx.conf index 1bfd4fb..69d3bea 100644 --- a/config/nginx/dev/nginx.conf +++ b/config/nginx/dev/nginx.conf @@ -23,11 +23,11 @@ server { } # fastapi - location /api/ { - proxy_pass http://fastapi-dev:8000; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } +; location /api/ { +; proxy_pass http://fastapi-dev:8000; +; proxy_set_header Host $host; +; proxy_set_header X-Real-IP $remote_addr; +; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +; proxy_set_header X-Forwarded-Proto $scheme; +; } } From c298e56646cc7a0ac48f3be56fe94ae29a224158 Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Tue, 20 Feb 2024 00:12:43 +0900 Subject: [PATCH 07/11] =?UTF-8?q?test=20:=20Dockerfile,=20docker-compose.y?= =?UTF-8?q?ml=20=EC=88=98=EC=A0=95=20=ED=9B=84=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/nginx/dev/Dockerfile | 2 +- docker-compose.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/nginx/dev/Dockerfile b/config/nginx/dev/Dockerfile index b91d55b..485508b 100644 --- a/config/nginx/dev/Dockerfile +++ b/config/nginx/dev/Dockerfile @@ -1,3 +1,3 @@ FROM nginx:1.21.4 -COPY ./nginx.conf /etc/nginx/conf.d/nginx.conf +#COPY ./nginx.conf /etc/nginx/conf.d/nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml index bb491bb..e005788 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,7 @@ services: - "80:80" - "443:443" # Add port for HTTPS volumes: + - ./config/nginx/dev/nginx.conf:/etc/nginx/nginx.conf - /etc/letsencrypt:/etc/letsencrypt:ro # Share SSL certification restart: always From d9a121f54510364307ed637be2e2c538081f4863 Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Tue, 20 Feb 2024 00:22:50 +0900 Subject: [PATCH 08/11] =?UTF-8?q?test=20:=20Dockerfile,=20docker-compose.y?= =?UTF-8?q?ml=20=EC=88=98=EC=A0=95=20=ED=9B=84=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/nginx/dev/Dockerfile | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/nginx/dev/Dockerfile b/config/nginx/dev/Dockerfile index 485508b..5a1b74b 100644 --- a/config/nginx/dev/Dockerfile +++ b/config/nginx/dev/Dockerfile @@ -1,3 +1,3 @@ FROM nginx:1.21.4 -#COPY ./nginx.conf /etc/nginx/conf.d/nginx.conf +COPY ./nginx.conf /etc/nginx/nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml index e005788..c747906 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: - "443:443" # Add port for HTTPS volumes: - ./config/nginx/dev/nginx.conf:/etc/nginx/nginx.conf - - /etc/letsencrypt:/etc/letsencrypt:ro # Share SSL certification +# - /etc/letsencrypt:/etc/letsencrypt:ro # Share SSL certification restart: always # fastapi: From 42754adc432b1a896600d598feab80fde67388ec Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Tue, 20 Feb 2024 00:36:10 +0900 Subject: [PATCH 09/11] =?UTF-8?q?test=20:=20nginx.conf=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=ED=9B=84=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/nginx/dev/nginx.conf | 78 ++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/config/nginx/dev/nginx.conf b/config/nginx/dev/nginx.conf index 69d3bea..cf0c0ef 100644 --- a/config/nginx/dev/nginx.conf +++ b/config/nginx/dev/nginx.conf @@ -1,33 +1,55 @@ -server { - listen 80; - server_name giftyyy.shop www.giftyyy.shop; - return 301 https://$host$request_uri; # http로 들어오면 https로 redirect 해주는 부분 +# 사용자 정의 nginx.conf 파일 +events { + worker_connections 1024; } -server { - listen 443 ssl; - server_name giftyyy.shop www.giftyyy.shop; - # Certificate - ssl_certificate /etc/letsencrypt/live/giftyyy.shop/fullchain.pem; - # Private Key - ssl_certificate_key /etc/letsencrypt/live/giftyyy.shop/privkey.pem; - - # springboot - location / { - proxy_pass http://backend-dev:8080; # 자신의 springboot app이 사용하는 포트 - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; +http { + # MIME 타입 설정 + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # 로그 설정 + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + error_log /var/log/nginx/error.log warn; + + # SSL 설정을 여기에 추가할 수 있음 (예: ssl_protocols, ssl_ciphers 등) + + # HTTP 요청을 HTTPS로 리다이렉트 + server { + listen 80; + server_name giftyyy.shop www.giftyyy.shop; + return 301 https://$host$request_uri; } - # fastapi -; location /api/ { -; proxy_pass http://fastapi-dev:8000; -; proxy_set_header Host $host; -; proxy_set_header X-Real-IP $remote_addr; -; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -; proxy_set_header X-Forwarded-Proto $scheme; -; } + # HTTPS 서버 구성 + server { + listen 443 ssl; + server_name giftyyy.shop www.giftyyy.shop; + + # SSL 인증서 설정 + ssl_certificate /etc/letsencrypt/live/giftyyy.shop/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/giftyyy.shop/privkey.pem; + + # Spring Boot 애플리케이션으로의 프록시 + location / { + proxy_pass http://backend-dev:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # FastAPI 서비스로의 프록시 +; location /api/ { +; proxy_pass http://fastapi-dev:8000; +; proxy_set_header Host $host; +; proxy_set_header X-Real-IP $remote_addr; +; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +; proxy_set_header X-Forwarded-Proto $scheme; +; } + } } From 99994a603b151788cbe0493e5a25c2446d7d76f9 Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Tue, 20 Feb 2024 00:51:06 +0900 Subject: [PATCH 10/11] =?UTF-8?q?test=20:=20nginx.conf=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=ED=9B=84=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/nginx/dev/Dockerfile | 2 +- config/nginx/dev/nginx.conf | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/config/nginx/dev/Dockerfile b/config/nginx/dev/Dockerfile index 5a1b74b..eaf5388 100644 --- a/config/nginx/dev/Dockerfile +++ b/config/nginx/dev/Dockerfile @@ -1,3 +1,3 @@ FROM nginx:1.21.4 -COPY ./nginx.conf /etc/nginx/nginx.conf +#COPY ./nginx.conf /etc/nginx/nginx.conf diff --git a/config/nginx/dev/nginx.conf b/config/nginx/dev/nginx.conf index cf0c0ef..0d95569 100644 --- a/config/nginx/dev/nginx.conf +++ b/config/nginx/dev/nginx.conf @@ -42,14 +42,5 @@ http { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } - - # FastAPI 서비스로의 프록시 -; location /api/ { -; proxy_pass http://fastapi-dev:8000; -; proxy_set_header Host $host; -; proxy_set_header X-Real-IP $remote_addr; -; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -; proxy_set_header X-Forwarded-Proto $scheme; -; } } } From 8094bd117aadba13b479008929d2e4672731ee8d Mon Sep 17 00:00:00 2001 From: LHS-11 Date: Tue, 20 Feb 2024 00:57:34 +0900 Subject: [PATCH 11/11] =?UTF-8?q?test=20:=20docker-compose=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=ED=9B=84=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index c747906..e005788 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: - "443:443" # Add port for HTTPS volumes: - ./config/nginx/dev/nginx.conf:/etc/nginx/nginx.conf -# - /etc/letsencrypt:/etc/letsencrypt:ro # Share SSL certification + - /etc/letsencrypt:/etc/letsencrypt:ro # Share SSL certification restart: always # fastapi: