Skip to content

Commit

Permalink
Add env variable to deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Nov 9, 2023
1 parent d5ffb64 commit 7a4ff9f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
ADS_SERVER_URL: ${{ secrets.ADS_SERVER_URL }}
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
Expand Down
8 changes: 7 additions & 1 deletion scripts/deploy_backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ then
exit -1
fi

if test -z "$ADS_SERVER_URL"
then
echo "ERROR: ADS_SERVER_URL variable must be defined, exiting"
exit -1
fi

echo "INFO: stopping already running docker container"
ssh -o StrictHostKeyChecking=no -i key.pem azureuser@"$BACKEND_DOMAIN" "docker stop wasp-backend || echo 'No containers available to stop'"
ssh -o StrictHostKeyChecking=no -i key.pem azureuser@"$BACKEND_DOMAIN" "docker container prune -f || echo 'No stopped containers to delete'"
Expand All @@ -69,4 +75,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 --name wasp-backend -p $PORT:$PORT -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' -e AZURE_OPENAI_API_KEY='$AZURE_OPENAI_API_KEY' -d ghcr.io/$GITHUB_REPOSITORY:$TAG"
ssh -o StrictHostKeyChecking=no -i key.pem azureuser@"$BACKEND_DOMAIN" "docker run --name wasp-backend -p $PORT:$PORT -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' -e AZURE_OPENAI_API_KEY='$AZURE_OPENAI_API_KEY' -e ADS_SERVER_URL='$ADS_SERVER_URL' -d ghcr.io/$GITHUB_REPOSITORY:$TAG"
2 changes: 1 addition & 1 deletion src/server/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export const getAgentResponse: GetAgentResponse<AgentPayload> = async (
};

try {
const response = await fetch(`${ADS_SERVER_URL}/conversation`, {
const response = await fetch(`${ADS_SERVER_URL}/chat`, {
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
Expand Down

0 comments on commit 7a4ff9f

Please sign in to comment.