Skip to content

Commit

Permalink
feature: modify deployment files, add docker compose to gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
Veivel committed Jun 18, 2024
1 parent ff92af1 commit 48e2762
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 55 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/deploy-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
id: install-py-dependencies
run: |
python -m pip install --upgrade pip
pip install -r deploy-stg/requirements.txt
pip install -r deploy-stg/setup-requirements.txt
- name: Setup Infisical
id: setup-infisical
Expand Down Expand Up @@ -99,3 +99,15 @@ jobs:
remote_user: ${{ secrets.SSH_USER }}
remote_key: ${{ secrets.SSH_KEY_OVERRIDE }}

- name: SSH and Docker Compose Up
id: ssh-docker-compose
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_IP_ADDRESS }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY_OVERRIDE }}
port: ${{ secrets.SSH_PORT }}
script: |
cd susunjadwal/susunjadwal-backend-stg
docker compose up
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ENV APP_ENV="container"

COPY . .

COPY launch.sh /opt/app/launch.sh
COPY sso/additional-info.json /opt/app/sso/additional-info.json
COPY sso/faculty-base-additional-info.json /opt/app/sso/faculty-base-additional-info.json
COPY sso/faculty_exchange_route.json /opt/app/sso/faculty_exchange_route.json
Expand All @@ -14,6 +15,6 @@ RUN apk add -u --no-cache tzdata gcc musl-dev libxml2 libxslt-dev && \
pip install wheel && \
pip install -r requirements.txt

ENV PORT=8000
ENV PORT=8006

ENTRYPOINT ["/bin/sh","launch.sh"]
ENTRYPOINT ["/opt/app","launch.sh"]
16 changes: 9 additions & 7 deletions deploy-stg/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: "3.9"

services:
susunjadwal-backend-rmq-stg:
rmq-stg:
image: rabbitmq:management-alpine
restart: unless-stopped
ports:
- "15671-15672:15671-15672"
networks:
- public-web

susunjadwal-backend-mongo-stg:
mongo-stg:
image: mongo:7
restart: unless-stopped
environment:
Expand All @@ -23,19 +23,21 @@ services:
networks:
- public-web

susunjadwal-backend-server-stg:
server-stg:
image: ristekoss/susunjadwal-backend:staging
labels:
caddy: api-stg.susunjadwal.ristek.cs.ui.ac.id
caddy.reverse_proxy: "{{upstreams 8000}}"
caddy.reverse_proxy: "{{upstreams 8006}}"
restart: unless-stopped
depends_on:
- rmq-stg
- mongo-stg
volumes:
- ./.env:/app/.env:ro
# volumes:
# - ./.env:/app/.env:ro
env_file:
- .env
ports:
- 8005:8005
- 8006:8006
networks:
- public-web

Expand Down
4 changes: 2 additions & 2 deletions deploy-stg/infisical.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
stdout=open(Path("deploy-stg") / ".env", "w"),
stderr=sys.stderr,
)
logger.info(f"Initial .env file size: {os.stat(Path('deploy-stg') / '.env').st_size}")
logger.info(f"Initial .env file size: {os.stat(Path('deploy-stg') / '.env').st_size} bytes")

# Strip quotes if not quoted (Infisical exports for .env by default is quoted)
if not quoted:
Expand All @@ -86,4 +86,4 @@
for var in quoted_vars:
env_file.write(var + "\n")

logger.info(f"Final .env file size: {os.stat(Path('deploy-stg') / '.env').st_size}")
logger.info(f"Final .env file size: {os.stat(Path('deploy-stg') / '.env').st_size} bytes")
File renamed without changes.
42 changes: 0 additions & 42 deletions docker-compose-deploy.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion docker-compose-dev-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
env_file:
- .env
ports:
- 8005:8005
- 8005:8000

volumes:
sunjad_db:

0 comments on commit 48e2762

Please sign in to comment.