Skip to content

updated import statement #12

updated import statement

updated import statement #12

name: Deploy logger API to production
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy in EC2
env:
PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
HOSTNAME: ec2-44-202-107-5.compute-1.amazonaws.com
USER_NAME: ubuntu
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} '
# comment
# Now we have got the access of EC2 and we will start the deploy
docker system prune -a &&
sudo journalctl --vacuum-time=3d &&
cd ~/hans-wehr-cloud-logger &&
git checkout main &&
git fetch --all &&
git reset --hard origin/main &&
git pull origin main &&
echo "DB_USERNAME=${{ secrets.API_DB_USERNAME }}" > .env &&
echo "DB_PASSWORD=${{ secrets.API_DB_PASSWORD }}" >> .env &&
echo "EMAIL_USERNAME=${{ secrets.EMAIL_USERNAME }}" >> .env &&
echo "EMAIL_PASSWORD=${{ secrets.EMAIL_PASSWORD }}" >> .env &&
echo "${{ secrets.HTTPS_KEY }}" > privkey.pem &&
echo "${{ secrets.HTTPS_CERT }}" > fullchain.pem &&
docker-compose build && docker-compose up -d
'