-
Notifications
You must be signed in to change notification settings - Fork 425
GCP one click deployment #153
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
Merged
EugeneLightsOn
merged 24 commits into
cohere-ai:main
from
EugeneLightsOn:EXT2-55-GCP_one_click_deployment
May 31, 2024
Merged
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
fe1f9f1
GCP one click deployment changes - DRAFT
EugeneLightsOn ae92ed1
GCP one click deployment changes
EugeneLightsOn b7efa5a
GCP one click deployment changes
EugeneLightsOn 284d376
Merge branch 'main' into EXT2-55-GCP_one_click_deployment
EugeneLightsOn adfcc01
GCP one click deployment changes
EugeneLightsOn 01c675f
GCP one click deployment changes
EugeneLightsOn c116bb5
GCP one click deployment changes
EugeneLightsOn 57bfaaa
GCP one click deployment changes
EugeneLightsOn d97b862
GCP one click deployment changes
EugeneLightsOn f95c27c
GCP one click deployment changes
EugeneLightsOn b1361fa
GCP one click deployment changes
EugeneLightsOn f227632
GCP one click deployment changes
EugeneLightsOn 1b014a0
GCP one click deployment postcreate hook
EugeneLightsOn e8802d1
GCP one click deployment postcreate hook
EugeneLightsOn 4df41fd
GCP one click deployment postcreate hook
EugeneLightsOn 8055edd
GCP one click deployment postcreate hook
EugeneLightsOn 6a1778b
GCP one click deployment postcreate hook
EugeneLightsOn 60ab1a1
GCP one click deployment postcreate hook
EugeneLightsOn 614a404
GCP one click deployment postcreate hook - final
EugeneLightsOn d774fa4
GCP one click deployment postcreate hook - final
EugeneLightsOn eb042e4
GCP one click deployment postcreate hook - final
EugeneLightsOn 501cefa
Merge branch 'refs/heads/main' into EXT2-55-GCP_one_click_deployment
EugeneLightsOn ffbd560
GCP one click deployment postcreate hook - review fixes
EugeneLightsOn 25d12c2
Merge branch 'refs/heads/main' into EXT2-55-GCP_one_click_deployment
EugeneLightsOn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,12 +1,25 @@ | ||
| { | ||
| "name": "one-click-demo", | ||
| "name": "toolkit-deploy", | ||
| "env": { | ||
| "DATABASE_URI": { | ||
| "description": "URI for your Postgres database", | ||
| "default": "postgresql+psycopg2://postgre:postgre@localhost:5432/toolkit" | ||
| "DATABASE_URL": { | ||
| "description": "URL for your Postgres database" | ||
| }, | ||
| "COHERE_API_KEY": { | ||
| "description": "Your Cohere API key" | ||
| } | ||
| }, | ||
| "hooks": { | ||
| "prebuild": { | ||
| "commands": [ | ||
| "gcloud auth configure-docker" | ||
| ] | ||
| } | ||
| }, | ||
| "options": { | ||
| "allow-unauthenticated": true | ||
| "allow-unauthenticated": true, | ||
| "memory": "12288Mi", | ||
| "cpu": "4", | ||
| "port": 8090, | ||
| "max-instances": 2 | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,17 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| # shellcheck source=runtime/functions | ||
| source "${PG_APP_HOME}/functions" | ||
|
|
||
| [[ ${DEBUG} == true ]] && set -x | ||
|
|
||
| # default behaviour is to launch apps | ||
| if [[ -z ${1} ]]; then | ||
| run_nginx | ||
| run_frontend_proxy | ||
| run_terrarium | ||
| run_backend | ||
| else | ||
| exec "$@" | ||
| fi |
This file contains hidden or 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,85 @@ | ||
| user www-data; | ||
| worker_processes auto; | ||
| pid /run/nginx.pid; | ||
| include /etc/nginx/modules-enabled/*.conf; | ||
|
|
||
| events { | ||
| worker_connections 768; | ||
| # multi_accept on; | ||
| } | ||
|
|
||
| http { | ||
|
|
||
| ## | ||
| # Basic Settings | ||
| ## | ||
|
|
||
| sendfile on; | ||
| tcp_nopush on; | ||
| tcp_nodelay on; | ||
| keepalive_timeout 65; | ||
| types_hash_max_size 2048; | ||
| client_max_body_size 50M; | ||
| # server_tokens off; | ||
|
|
||
| # server_names_hash_bucket_size 64; | ||
| # server_name_in_redirect off; | ||
|
|
||
| include /etc/nginx/mime.types; | ||
| default_type application/octet-stream; | ||
|
|
||
| upstream backend { | ||
| server 127.0.0.1:8000; | ||
| } | ||
|
|
||
| upstream frontend { | ||
| server 127.0.0.1:4000; | ||
| } | ||
|
|
||
| server { | ||
| listen 8090 default_server; | ||
| listen [::]:8090 default_server; | ||
|
|
||
| location /api { | ||
| rewrite /api/(.*) /$1 break; | ||
| proxy_pass http://backend; | ||
| proxy_redirect off; | ||
| proxy_set_header Host $host; | ||
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Host $server_name; | ||
| } | ||
|
|
||
| location / { | ||
| proxy_pass http://frontend; | ||
| proxy_redirect off; | ||
| proxy_set_header Host $host; | ||
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Host $server_name; | ||
| } | ||
| } | ||
|
|
||
| ## | ||
| # SSL Settings | ||
| ## | ||
|
|
||
| ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE | ||
| ssl_prefer_server_ciphers on; | ||
|
|
||
| ## | ||
| # Logging Settings | ||
| ## | ||
|
|
||
| access_log /var/log/nginx/access.log; | ||
| error_log /var/log/nginx/error.log; | ||
|
|
||
| ## | ||
| # Gzip Settings | ||
| ## | ||
|
|
||
| gzip on; | ||
|
|
||
| include /etc/nginx/conf.d/*.conf; | ||
| include /etc/nginx/sites-enabled/*; | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,44 @@ | ||
| # Google Cloud Platform One Click Deployment Guide | ||
|
|
||
| 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. | ||
|
|
||
| [](https://deploy.cloud.run) | ||
|
|
||
| ## Deployment Steps | ||
| After clicking the button above, you'll be taken to the Google Cloud Console. Follow these steps to deploy the Toolkit: | ||
| - **Select a Project**: Choose the Google Cloud Project you want to deploy the Toolkit to. | ||
| - **Set the Region**: Choose the region you want to deploy the Toolkit to. | ||
| - **Set the DATABASE_URL environment variable**: Enter the connection string of the format `postgresql://USERNAME:PASSWORD@HOST:PORT/DB_NAME`. The `HOST` value here is the Public IP address of your provisioned PostgreSQL database, and the default `PORT` is 5432. Make sure to use the username and password pair you set when creating your SQL instance. For example, `postgresql://myuser:mypassword@<your-db-public-ip-address>:5432/toolkit`. | ||
| - **Set the Cohere API Key**: Enter your Cohere API key, you can create one on the [Cohere Dashboard](https://dashboard.cohere.com). | ||
| - **Allow access to the git registries**: Click 'yes' to allow access to the git registries. | ||
|
|
||
| ## Post-Deployment Steps | ||
| After the deployment process is complete, you'll be able to access the Toolkit by navigating to the URL provided in the Google Cloud Console. | ||
| To get this URL, follow these steps: | ||
| - Click on the "Cloud Run" button on the left side of the screen | ||
| - Click on the toolkit-deploy service | ||
| - Click on the "URL" link to open the Toolkit in a new tab | ||
|
|
||
| ## Possible Deployment Errors | ||
| If the deployment is stuck on pushing the image to the Container Registry close the shell and try to redeploy the service. | ||
| If the deployment is stuck in a pending state or the connection to your Google Cloud Shell was lost like it shown on the image below: | ||
EugeneLightsOn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
EugeneLightsOn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|  | ||
| It means that the deployment process was not completed successfully, and we need to create a new revision for our deployment with correct settings. | ||
| Cloud Run does not set the startupProbe settings to the correct value, so we need to set it in the new revision. | ||
| To do it follow next steps: | ||
| - Navigate to the Google Cloud Console | ||
| - Click on the "Cloud Run" button on the left side of the screen | ||
| - Click on the toolkit-deploy service | ||
| - Click on the "Edit & Deploy New Revision" button | ||
| - Scroll down to the "Health checks" section | ||
| - Click Edit button(pencil icon) and set next values: | ||
| - Select probe type: HTTP | ||
| - Path (e.g./ready): /api/health | ||
| - Port: 8090 | ||
| - Initial delay: 0 | ||
| - Period: 1 | ||
| - Failure threshold: 50 | ||
| - Timeout: 1 | ||
| - Click "Update" button | ||
| - Click "Deploy" button | ||
|
|
||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.