Skip to content

Commit

Permalink
Merge pull request #150 from CEOS-Developers/dev
Browse files Browse the repository at this point in the history
[refact] 개발, 운영 서버 분리
  • Loading branch information
hyunihs authored Sep 28, 2023
2 parents 0b1da56 + c6bb379 commit 8291745
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @wjdtkdgns @yourzinc @hyunihs @chaeshee0908 @suhhyun524
* @hyunihs @suhhyun524 @mushroom1324 @haen-su @mirageoasis
14 changes: 7 additions & 7 deletions .github/workflows/deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
- name: Make application-secret.yml
run: |
touch ./src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET }}" > ./src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_DEV }}" > ./src/main/resources/application-secret.yml
env:
PROPERTIES_DEV: ${{ secrets.APPLICATION_SECRET }}
PROPERTIES_DEV: ${{ secrets.APPLICATION_SECRET_DEV }}

# Gradle build
- name: Build with Gradle
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
with:
host: ${{ secrets.EC2_HOST_DEV }}
username: ubuntu
key: ${{ secrets.EC2_KEY }}
key: ${{ secrets.EC2_KEY_DEV }}
script: mkdir -p ~/srv/ubuntu/ceos_web_dev

- name: copy source via ssh key
Expand All @@ -84,19 +84,19 @@ jobs:
remote_path: ~/srv/ubuntu/
remote_host: ${{ secrets.EC2_HOST_DEV }}
remote_user: ubuntu
remote_key: ${{ secrets.EC2_KEY }}
remote_key: ${{ secrets.EC2_KEY_DEV }}

- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST_DEV }}
username: ubuntu
key: ${{ secrets.EC2_KEY }}
key: ${{ secrets.EC2_KEY_DEV }}
script: |
sh ~/srv/ubuntu/config/scripts/deploy.sh
sudo docker stop $(sudo docker ps -a -q)
sudo docker rm $(sudo docker ps -a -q)
sudo docker rmi $(sudo docker images -q)
sudo docker-compose -f ~/srv/ubuntu/docker-compose.yml pull
sudo docker-compose -f ~/srv/ubuntu/docker-compose.yml up --build -d
sudo docker-compose -f ~/srv/ubuntu/docker-compose.dev.yml pull
sudo docker-compose -f ~/srv/ubuntu/docker-compose.dev.yml up --build -d
8 changes: 4 additions & 4 deletions .github/workflows/deploy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ jobs:
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/ceos-backend-dev
tags: ${{ secrets.DOCKER_USERNAME }}/ceos-backend

- name: create remote directory
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST_PROD }}
username: ubuntu
key: ${{ secrets.EC2_KEY }}
key: ${{ secrets.EC2_KEY_PROD }}
script: mkdir -p ~/srv/ubuntu/ceos_web_dev

- name: copy source via ssh key
Expand All @@ -84,14 +84,14 @@ jobs:
remote_path: ~/srv/ubuntu/
remote_host: ${{ secrets.EC2_HOST_PROD }}
remote_user: ubuntu
remote_key: ${{ secrets.EC2_KEY }}
remote_key: ${{ secrets.EC2_KEY_PROD }}

- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST_PROD }}
username: ubuntu
key: ${{ secrets.EC2_KEY }}
key: ${{ secrets.EC2_KEY_PROD }}
script: |
sh ~/srv/ubuntu/config/scripts/deploy.sh
sudo docker stop $(sudo docker ps -a -q)
Expand Down
2 changes: 1 addition & 1 deletion config/nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ server {

location / {
proxy_set_header Host $host;
proxy_pass http://backend-dev:8080/;
proxy_pass http://backend:8080/;
proxy_read_timeout 90;

## try_files $uri $uri/ =404;
Expand Down
26 changes: 26 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "3"

services:
backend:
image: ceos17/ceos-backend-dev
container_name: backend
hostname: backend
expose:
- "8080"

nginx:
depends_on:
- backend
restart: always
build:
dockerfile: Dockerfile
context: ./config/nginx
ports:
- "80:80"

redis:
image: redis:latest
container_name: redis
hostname: redis
ports:
- "6379:6379"
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
version: "3"

services:
backend-dev:
image: ceos17/ceos-backend-dev
container_name: backend-dev
hostname: backend-dev
backend:
image: ceos17/ceos-backend
container_name: backend
hostname: backend
expose:
- "8080"

nginx:
depends_on:
- backend-dev
- backend
restart: always
build:
dockerfile: Dockerfile
Expand Down

0 comments on commit 8291745

Please sign in to comment.