Skip to content
Merged
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
20 changes: 8 additions & 12 deletions rails/cookbooks/databases.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Rails with Databases
description: "Add databases to a Rails Dockerfile on Fly.io: Upstash Redis for Action Cable, SQLite on a volume, then Postgres via fly postgres attach, or MySQL."
description: "Add databases to a Rails Dockerfile on Fly.io: Upstash Redis for Action Cable, SQLite on a volume, then Managed Postgres via fly mpg attach, or MySQL."
source_url: https://fly.io/docs/rails/cookbooks/databases/
---

Expand Down Expand Up @@ -74,7 +74,7 @@

## Example application

In order to demonstrate Action Cable and Active Record functionality, we need

Check warning on line 77 in rails/cookbooks/databases.mdx

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 Consider using 'capability' or 'feature' instead of 'functionality'. Raw Output: {"message":"Consider using 'capability' or 'feature' instead of 'functionality'.","location":{"path":"rails/cookbooks/databases.mdx","range":{"start":{"line":77,"column":56},"end":{"line":77,"column":69}}},"severity":"INFO","code":{"value":"Fly.WordList"}}
a Rails application. Following is a simple visitors counter.

Replace the three lines starting with
Expand Down Expand Up @@ -261,25 +261,21 @@
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
```

Now you are ready to create a postgres cluster:
Now you are ready to create a [Managed Postgres](/postgres) cluster:

```
flyctl postgres create
fly mpg create
```

When done, you will find a link to
[Fly Postgres](/unmanaged-postgres). That information may be useful in the future so
bookmark the link (or return back to this page), but Fly Postgres is
fine for this demo.
Follow the prompts to choose the cluster name, region, and plan.

Your postgres app will be assigned a name if you didn't provide one.
Find that name and then run:
Find the cluster ID with `fly mpg list` and then run:

```
flyctl postgres attach happy-store-1234
fly mpg attach <CLUSTER_ID>
```

... replacing the name with the one assigned or selected by you.
... replacing `<CLUSTER_ID>` with your cluster's ID. This sets the `DATABASE_URL` secret on your app.

Before proceeding, there is one more change that might be worth making.
If you ever plan to scale up to multiple application machines it would
Expand Down Expand Up @@ -314,7 +310,7 @@
* Add the deploy release command to `fly.toml` from the postgresql instructions above.
* You need to run `fly secrets set DATABASE_URL=` in your
application. For postgresql this is taken care of for you
by the `flyctl postgres attach` command. This will look
by the `fly mpg attach` command. This will look
something like the following:

```
Expand Down
Loading