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

docs: update Ruby version, tutorial notes for multi-containers #1813

Merged
merged 3 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/multi-container/ruby/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.


FROM ruby:2.7.4
FROM ruby:3.2.2

# Copy local code to the container image.
ENV APP_HOME /app
Expand Down
1 change: 1 addition & 0 deletions examples/multi-container/ruby/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ gem 'json'
gem 'pg'
gem 'sequel'
gem 'sinatra'
gem 'thin'
24 changes: 18 additions & 6 deletions examples/multi-container/ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@ existing application which connects to a Cloud SQL instance.

1. If you haven't already, [create a project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project).

1. Create a 2nd Gen Cloud SQL Postgres Instance by following these
1. [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=run.googleapis.com,sqladmin.googleapis.com,run.googleapis.com) that will be used during this tutorial:

* Cloud SQL Admin
* Cloud Build
* Cloud Run

1. Create a Cloud SQL Postgres Instance by following these
[instructions](https://cloud.google.com/sql/docs/postgres/create-instance).
Note the connection string, database user, and database password that you create.
Note the connection string and default password that you create.

1. Create a database for your application by following these
[instructions](https://cloud.google.com/sql/docs/postgres/create-manage-databases).
Note the database name.

1. Optionally, create a database user for your instance following these
[instructions](https://cloud.google.com/sql/docs/postgres/create-manage-users).
Otherwise, use the username "postgres".

## Deploying the Application

The application you will be deploying should connect to the Cloud SQL Proxy using
Expand Down Expand Up @@ -98,16 +108,18 @@ spec:

```

You can optionally use Secret Manager to store the database password. See
[this documentation](https://cloud.google.com/run/docs/deploying#yaml) for more details.

Before deploying, you will need to make sure that the service account associated
with the Cloud Run deployment (defaults to compute engine service account) has the
Cloud SQL Client role.
with the Cloud Run deployment has the Cloud SQL Client role.
See [this documentation](https://cloud.google.com/sql/docs/postgres/roles-and-permissions)
for more details.
for more details. The default service account will already have these permissions.

Finally, you can deploy the service using:

```bash
gcloud run services replace multicontainers.yaml
gcloud run services replace multicontainer.yaml
```

Once the service is deployed, the console should print out a URL. You can test
Expand Down
Loading