-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a Github Actions config for the prod branch
- Loading branch information
1 parent
3009ae0
commit 1550c21
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |