Skip to content

Commit daf537a

Browse files
authored
Deploy prod (#23)
1 parent 5e6e230 commit daf537a

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

.github/workflows/cd.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ jobs:
6464
target_path: "~/staging.mapdb.cncnet.org"
6565
compose_file: "docker-compose.prod.yml"
6666
nginx_conf: "docker/nginx.prod.conf"
67-
# disabled for now
68-
# - environment: production
69-
# branch: main
70-
# target_path: "~/prod2.mapdb.cncnet.org"
71-
# compose_file: "docker-compose.prod.yml"
72-
# nginx_conf: "docker/nginx.prod.conf"
67+
host: ${{ secrets.STAGING_SSH_HOST }}
68+
- environment: production
69+
branch: main
70+
target_path: "~/mapdb.cncnet.org"
71+
compose_file: "docker-compose.prod.yml"
72+
nginx_conf: "docker/nginx.prod.conf"
73+
host: ${{ secrets.PROD_SSH_HOST }}
7374

7475
steps:
7576
- name: "Exit if not matching branch"
@@ -82,7 +83,7 @@ jobs:
8283
- name: Copy docker-compose and nginx config over ssh
8384
uses: appleboy/[email protected]
8485
with:
85-
host: ${{ secrets.SSH_HOST }}
86+
host: ${{ matrix.host }}
8687
username: ${{ secrets.SSH_USER }}
8788
key: ${{ secrets.SSH_PRIVATE_KEY }}
8889
source: "${{ matrix.compose_file }},${{ matrix.nginx_conf }}"
@@ -91,12 +92,14 @@ jobs:
9192
- name: SSH into server and deploy
9293
uses: appleboy/[email protected]
9394
with:
94-
host: ${{ secrets.SSH_HOST }}
95+
host: ${{ matrix.host }}
9596
username: ${{ secrets.SSH_USER }}
9697
key: ${{ secrets.SSH_PRIVATE_KEY }}
9798
script: |
9899
cd ${{ matrix.target_path }}
99100
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
101+
envstr='${{ secrets.PROD_ENV_FILE }}'
102+
echo -e $envstr > .env
100103
docker compose -f ${{ matrix.compose_file }} pull
101104
docker compose -f ${{ matrix.compose_file }} down
102-
docker compose -f ${{ matrix.compose_file }} up -d
105+
docker compose -f ${{ matrix.compose_file }} up -d

docker-compose.prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ services:
4444

4545
networks:
4646
mapdb-network:
47-
driver: bridge
47+
driver: bridge

0 commit comments

Comments
 (0)