Skip to content

Commit

Permalink
Remove env var and replace with secret
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottminns committed Nov 12, 2024
1 parent d8ef610 commit 14bc77c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ jobs:
curl -L "https://github.com/docker/compose/releases/download/v2.19.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
- name: Set up password
run: |
echo ${{ secrets.DB_PASSWORD }} > db-password.txt
- name: Run Docker Compose
run: |
export DB_PASSWORD=${{ secrets.DB_PASSWORD }}
pwd
ls .
export DOCKER_HOST=ssh://deploytest@zenful.cloud
docker-compose -f ./compose.prod.yaml up -d
# - name: Copy over the docker compose file
# run: |
# scp -o StrictHostKeyChecking=no compose.prod.yaml deploytest@zenful.cloud:guestbook/compose.yaml
# - name: Deploy code via SSH
# run: |
# ssh -o StrictHostKeyChecking=no deploytest@zenful.cloud "cd guestbook && docker compose up -d"
12 changes: 8 additions & 4 deletions compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ services:
- "traefik.http.routers.proxy.tls.certresolver=myresolver"
# Enable watchtower
- "com.centurylinklabs.watchtower.enable=true"
secrets:
- db-password
environment:
- POSTGRES_HOST=db
- POSTGRES_PASSWORD=$DB_PASSWORD
- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
- POSTGRES_USER=postgres
- POSTGRES_DB=guestbook
- POSTGRES_PORT=5432
Expand All @@ -68,10 +70,12 @@ services:
user: postgres
volumes:
- db-data:/var/lib/postgresql/data
secrets:
- db-password
environment:
- POSTGRES_DB=guestbook
#- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
#- POSTGRES_PASSWORD=${DB_PASSWORD}
expose:
- 5432
healthcheck:
Expand All @@ -84,4 +88,4 @@ volumes:
letsencrypt:
secrets:
db-password:
environment: DB_PASSWORD
file: ./db-password.txt

0 comments on commit 14bc77c

Please sign in to comment.