Skip to content

Commit

Permalink
add db to volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-za-kpe committed Jul 22, 2024
1 parent 3f46e11 commit b775f4a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 43 deletions.
86 changes: 43 additions & 43 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,46 +44,46 @@ jobs:
docker push ${{ env.WEB_IMAGE }}
docker push ${{ env.NGINX_IMAGE }}
deploy:
name: Deploy to DigitalOcean
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout master
uses: actions/checkout@v1
- name: Add environment variables to .env
run: |
echo DEBUG=0 >> .env
echo SQL_ENGINE=django.db.backends.postgresql >> .env
echo DATABASE=postgres >> .env
echo SECRET_KEY=${{ secrets.SECRET_KEY }} >> .env
echo SQL_DATABASE=${{ secrets.SQL_DATABASE }} >> .env
echo SQL_USER=${{ secrets.SQL_USER }} >> .env
echo SQL_PASSWORD=${{ secrets.SQL_PASSWORD }} >> .env
echo SQL_HOST=${{ secrets.SQL_HOST }} >> .env
echo SQL_PORT=${{ secrets.SQL_PORT }} >> .env
echo WEB_IMAGE=${{ env.WEB_IMAGE }} >> .env
echo NGINX_IMAGE=${{ env.NGINX_IMAGE }} >> .env
echo NAMESPACE=${{ secrets.NAMESPACE }} >> .env
echo PERSONAL_ACCESS_TOKEN=${{ secrets.PERSONAL_ACCESS_TOKEN }} >> .env
- name: Add the private SSH key to the ssh-agent
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh-add - <<< "${{ secrets.PRIVATE_KEY }}"
- name: Build and deploy images on DigitalOcean
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
scp -o StrictHostKeyChecking=no -r ./.env ./docker-compose.prod.yml root@${{ secrets.DIGITAL_OCEAN_IP_ADDRESS }}:/app
ssh -o StrictHostKeyChecking=no root@${{ secrets.DIGITAL_OCEAN_IP_ADDRESS }} << 'ENDSSH'
cd /app
source .env
docker login ghcr.io -u $NAMESPACE -p $PERSONAL_ACCESS_TOKEN
docker pull $WEB_IMAGE
docker pull $NGINX_IMAGE
docker-compose -f docker-compose.prod.yml up -d
ENDSSH
# deploy:
# name: Deploy to DigitalOcean
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: Checkout master
# uses: actions/checkout@v1
# - name: Add environment variables to .env
# run: |
# echo DEBUG=0 >> .env
# echo SQL_ENGINE=django.db.backends.postgresql >> .env
# echo DATABASE=postgres >> .env
# echo SECRET_KEY=${{ secrets.SECRET_KEY }} >> .env
# echo SQL_DATABASE=${{ secrets.SQL_DATABASE }} >> .env
# echo SQL_USER=${{ secrets.SQL_USER }} >> .env
# echo SQL_PASSWORD=${{ secrets.SQL_PASSWORD }} >> .env
# echo SQL_HOST=${{ secrets.SQL_HOST }} >> .env
# echo SQL_PORT=${{ secrets.SQL_PORT }} >> .env
# echo WEB_IMAGE=${{ env.WEB_IMAGE }} >> .env
# echo NGINX_IMAGE=${{ env.NGINX_IMAGE }} >> .env
# echo NAMESPACE=${{ secrets.NAMESPACE }} >> .env
# echo PERSONAL_ACCESS_TOKEN=${{ secrets.PERSONAL_ACCESS_TOKEN }} >> .env
# - name: Add the private SSH key to the ssh-agent
# env:
# SSH_AUTH_SOCK: /tmp/ssh_agent.sock
# run: |
# mkdir -p ~/.ssh
# ssh-agent -a $SSH_AUTH_SOCK > /dev/null
# ssh-keyscan github.com >> ~/.ssh/known_hosts
# ssh-add - <<< "${{ secrets.PRIVATE_KEY }}"
# - name: Build and deploy images on DigitalOcean
# env:
# SSH_AUTH_SOCK: /tmp/ssh_agent.sock
# run: |
# scp -o StrictHostKeyChecking=no -r ./.env ./docker-compose.prod.yml root@${{ secrets.DIGITAL_OCEAN_IP_ADDRESS }}:/app
# ssh -o StrictHostKeyChecking=no root@${{ secrets.DIGITAL_OCEAN_IP_ADDRESS }} << 'ENDSSH'
# cd /app
# source .env
# docker login ghcr.io -u $NAMESPACE -p $PERSONAL_ACCESS_TOKEN
# docker pull $WEB_IMAGE
# docker pull $NGINX_IMAGE
# docker-compose -f docker-compose.prod.yml up -d
# ENDSSH
1 change: 1 addition & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ services:
POSTGRES_DB: clearpath_dev

volumes:
postgres_data:
static_volume:
media_volume:

0 comments on commit b775f4a

Please sign in to comment.