Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: Update Google One-Click Deploy configuration #29

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ Go to [localhost:4000](http://localhost:4000/) in your browser and start chattin

Contributions are what drive an open source community, any contributions made are greatly appreciated. To get started, check out our [documentation.](CONTRIBUTING.md)

### 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)
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