Skip to content

Commit

Permalink
Create a Github Actions config for the prod branch
Browse files Browse the repository at this point in the history
  • Loading branch information
liubovpashkova authored Jul 5, 2024
1 parent 3009ae0 commit 1550c21
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy-prod-to-azurevm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy the prod branch code to an Azure Virtual Machine

on:
push:
branches: [ prod ]

jobs:
deployment:
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Copy files using SCP
uses: appleboy/scp-action@master
with:
host: ${{ secrets.PANKB_PROD_HOST }}
username: ${{ secrets.PANKB_PROD_SSH_USERNAME }}
key: ${{ secrets.PANKB_PROD_PRIVATE_SSH_KEY }}
source: "."
target: "/projects/pankb_web/pankb_llm"

- name: Create the .env file and (re-)start containers over SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PANKB_PROD_HOST }}
username: ${{ secrets.PANKB_PROD_SSH_USERNAME }}
key: ${{ secrets.PANKB_PROD_PRIVATE_SSH_KEY }}
port: 22
script: |
cd /projects/pankb_web/pankb_llm
touch .env
echo "## Do not put this file under version control!" > .env
echo "" >> .env
echo OPENAI_API_KEY="${{secrets.OPENAI_API_KEY}}" >> .env
echo COHERE_API_KEY="${{secrets.COHERE_API_KEY}}" >> .env
echo TOGETHER_API_KEY="${{secrets.TOGETHER_API_KEY}}" >> .env
echo GOOGLE_API_KEY="${{secrets.GOOGLE_API_KEY}}" >> .env
echo ANTHROPIC_API_KEY="${{secrets.ANTHROPIC_API_KEY}}" >> .env
echo REPLICATE_API_TOKEN="${{secrets.REPLICATE_API_TOKEN}}" >> .env
echo VOYAGE_API_KEY="${{secrets.VOYAGE_API_KEY}}" >> .env
echo "" >> .env
echo "## MongoDB-PROD (Azure CosmosDB for MongoDB) Connection String" >> .env
echo "# Had to multiply maxIdleTimeMS by 10 to handle" >> .env
echo "# urllib3.exceptions.ProtocolError: (\"Connection broken: ConnectionResetError(104, 'Connection reset by peer')\", ConnectionResetError(104, 'Connection reset by peer'))" >> .env
echo MONGODB_CONN_STRING="${{secrets.PANKB_PROD_MONGODB_CONN_STRING}}" >> .env
cat .env
docker compose up -d --build --force-recreate

0 comments on commit 1550c21

Please sign in to comment.