Skip to content

Commit

Permalink
chore: 포트 지정 (#12)
Browse files Browse the repository at this point in the history
* chore: 포트 지정

* fix; 포트 수정

* fix: ports를 expose로 변경

* chore: nginx도 docker-compose가 관리하도록 수정

* fix: docker-compose 수정

* chore: expose 8080

* fix: 명령에 dash 추가

* chore: nginx 관련 docker setting

* chore: nginx 관련 docker setting

* chore: nginx 관련 docker setting

* chore: nginx 관련 docker setting 제거

* Revert "chore: nginx 관련 docker setting 제거"

This reverts commit 186eab3.

* chore: nginx dockerfile 제거

* fix: 경로 변경

* chore: docker-compose 수정

* chore: 파일 이동

* chore: nginx.conf도 scp로 복사

* fix: 콤마로 구분

* fix: nginx.conf의 location 경로 변경

* fix: nginx.conf

* fix: nginx.conf를 http로 wrap

* fix: upstream 수정

* fix: 포트 설정

* chore: 서버 포트 명시

* chore: 도커 컴포즈 수정

* chore: nginx의 connection 수를 지정

* fix: 경로 어노테이션 수정

* fix: proxy_pass 수정

* chore: test 트리거 제거

* test: dash 필요한지 test

* chore: test 트리거 제거

* test: 'build: .'가 없어도 되는지 테스트

* chore: build: . 제거

* test: ports 관련 정보를 모두 제거해도 되는지 테스트

* test: events 없이 테스트

* Revert "test: events 없이 테스트"

This reverts commit 44520b2.

* test: upstream을 지정하지 않는 경우 test

* chore: test 원상복구

* chore: test 트리거 제거

* chore: 주석 제거
  • Loading branch information
Sangwook02 authored Jan 17, 2024
1 parent c561965 commit c95a782
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
host: ${{ secrets.INFRA_PRACTICE_SERVER_IP }}
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
source: docker-compose.yml
source: docker-compose.yml, nginx.conf
target: /home/ubuntu/

deploy:
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
version: "3.8"

services:
nginx:
image: nginx
container_name: nginxserver
restart: always
ports:
- "80:80"
volumes:
- "./nginx.conf:/etc/nginx/nginx.conf"
depends_on:
- backend
network_mode: host
environment:
- TZ=Asia/Seoul
backend:
image: ${DOCKERHUB_USERNAME}/infra_practice_server:latest
container_name: deploy_container
restart: always
ports:
- "8080:8080"
network_mode: host
env_file:
- .env
Expand Down
20 changes: 20 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
events {
worker_connections 10;
}

http {
upstream deploy_container {
server localhost:8080;
}

server{
listen 80;

location / {
proxy_pass http://deploy_container/test;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/example/demo/TestController.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.example.demo;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {
@GetMapping
public String testApi() {
Expand Down

0 comments on commit c95a782

Please sign in to comment.