Skip to content

Commit

Permalink
feat: update Ruby version, tutorial notes
Browse files Browse the repository at this point in the history
  • Loading branch information
glasnt committed May 25, 2023
1 parent 37a1c8b commit a9ec05a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
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

3. 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

0 comments on commit a9ec05a

Please sign in to comment.