Quick Recap
Let's revise what we have covered so far.
We'll cover the following
Highlights
In this chapter, we learned how to set up and configure a database for our Rails app, something the vast majority of Rails apps typically need.
Let’s review what we covered:
-
We started up a Postgres server in a container using Compose.
-
We verified that the Postgres server was running by connecting with the Postgres client from a separate container.
-
We configured our Rails app to talk to Postgres by installing the Postgres gem, modifying our database.yml file, and running the Rake task to create the databases.
-
We put our new database through its paces by generating a scaffold, running migrations, and inserting, deleting, and updating records.
-
We discussed why it is a good idea to decouple our database container from data we want to persist.
-
Finally, we used a named volume to store our data separately, allowing us to manage its life cycle independently of the container.
What to expect in the next chapter?
You have now seen how to add two services: Redis and Postgres. You should be able to apply the same knowledge to add any other services you can think of. In fact, we will add yet another service in the next chapter as we turn our attention away from back-end technologies to explore how to incorporate a modern, JavaScript front-end for your Rails app.
Get hands-on with 1400+ tech skills courses.