diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 07f661d..ad4dcce 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -56,20 +56,21 @@ jobs: env: GITHUB_USERNAME: ${{ github.actor }} GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - PROD_SSH_KEY: ${{ secrets.PROD_SSH_KEY }} + GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} + SSH_KEY: ${{ secrets.SSH_KEY }} + GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} steps: - uses: actions/checkout@v3 # This is to fix GIT not liking owner of the checkout dir - https://github.com/actions/runner/issues/2033#issuecomment-1204205989 - run: chown -R $(id -u):$(id -g) $PWD - run: echo "TAG=latest" >> $GITHUB_ENV # - run: if [[ $GITHUB_REF_NAME == "main" ]]; then printenv PROD_CONFIG > "$(pwd)/.env" ; else printenv STAGING_CONFIG > "$(pwd)/.env" ; fi; - - run: sed 's/\"//g' .env >> $GITHUB_ENV - run: echo "PATH=$PATH:/github/home/.local/bin" >> $GITHUB_ENV - run: 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )' - run: eval $(ssh-agent -s) - run: mkdir -p ~/.ssh - run: chmod 700 ~/.ssh - - run: ssh-keyscan "$DOMAIN" >> ~/.ssh/known_hosts + - run: ssh-keyscan "$BACKEND_DOMAIN" >> ~/.ssh/known_hosts - run: chmod 644 ~/.ssh/known_hosts - run: echo "$SSH_KEY" | base64 --decode > key.pem - run: chmod 600 key.pem diff --git a/scripts/deploy_backend.sh b/scripts/deploy_backend.sh index cbd9bb7..caef000 100755 --- a/scripts/deploy_backend.sh +++ b/scripts/deploy_backend.sh @@ -69,4 +69,4 @@ echo "Deleting old image" ssh -o StrictHostKeyChecking=no -i key.pem azureuser@"$BACKEND_DOMAIN" "docker system prune -f || echo 'No images to delete'" echo "INFO: starting docker container" -ssh -o StrictHostKeyChecking=no -i key.pem azureuser@"$BACKEND_DOMAIN" "docker run --rm --name wasp-backend -e PORT -e DATABASE_URL -e WASP_WEB_CLIENT_URL -e JWT_SECRET ghcr.io/$GITHUB_REPOSITORY:$TAG -d" +ssh -o StrictHostKeyChecking=no -i key.pem azureuser@"$BACKEND_DOMAIN" "docker run --name wasp-backend -p 80:80 -e PORT='$PORT' -e DATABASE_URL='$DATABASE_URL' -e WASP_WEB_CLIENT_URL='$WASP_WEB_CLIENT_URL' -e JWT_SECRET='$JWT_SECRET' -e GOOGLE_CLIENT_ID='$GOOGLE_CLIENT_ID' -e GOOGLE_CLIENT_SECRET='$GOOGLE_CLIENT_SECRET' -d ghcr.io/$GITHUB_REPOSITORY:$TAG"