Skip to content

Commit

Permalink
Update Google one-click deploy configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
malexw committed May 2, 2024
1 parent 22f78be commit 8af1642
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Keep the poetry venv name and location predictable
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV APP_HOME=/workspace
ENV PG_APP_HOME=/workspace

# Install python
RUN cd /usr/src \
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ After your deployment is complete click "Go to resource" button.
2) Navigate to the "Overview" tab to see the FQDN of the container instance
3) Open the \<FQDN\>:4000 in your browser to access the Toolkit

### Deploying to Google Cloud Run

Before deploying to Google Cloud Run, you'll need a postgres database accessible to your Google Cloud Project, authenticated by a username and password. You'll be prompted for a `DATABASE_URL` before the container builds.

[![Run on Google Cloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run)

## Setup for Development

### Setting up Poetry
Expand Down
9 changes: 5 additions & 4 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "one-click-demo",
"name": "cohere-toolkit",
"env": {
"DATABASE_URI": {
"DATABASE_URL": {
"description": "URI for your Postgres database",
"default": "postgresql+psycopg2://postgre:postgre@localhost:5432/toolkit"
"value": "postgresql+psycopg2://postgres:password@localhost:5432/postgres"
}
},
"options": {
"allow-unauthenticated": true
"allow-unauthenticated": true,
"memory": "2048Mi"
}
}
3 changes: 1 addition & 2 deletions docker_scripts/cloudrun-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ source "${APP_HOME}/functions"

# default behaviour is to launch postgres
if [[ -z ${1} ]]; then
run_frontend
run_terrarium
run_frontend_cloud_run
run_backend

else
Expand Down
10 changes: 10 additions & 0 deletions docker_scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ run_frontend() {
echo "Frontend started..."
}

run_frontend_cloud_run() {
cd /workspace/src/interfaces/coral_web
echo "build Frontend"
echo "$NEXT_PUBLIC_API_HOSTNAME"
pnpm next:build
echo "Starting Frontend..."
pm2 start pnpm -- start:cloud-run
echo "Frontend started..."
}

run_terrarium() {
cd /usr/src/app
echo "Starting Terrarium..."
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/coral_web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"next:build": "next build",
"start": "next start",
"start:single-docker": "next start --port 4000",
"start:cloud-run": "next start --port 8080",
"generate:client": "openapi --input http://0.0.0.0:8000/openapi.json --output ./src/cohere-client/generated --client axios --useOptions"
},
"dependencies": {
Expand Down

0 comments on commit 8af1642

Please sign in to comment.