alanraso / teste-probot

Repo para simular o onboard vazio para o probot
0 stars 0 forks source link

[Track 3/9] Database setup #119

Closed taki-tiler-server[bot] closed 2 years ago

taki-tiler-server[bot] commented 2 years ago

Step 1/4 - Containers everywhere

Estimated time: 2 hours

[Spoiler alert]: in the end of this onboard, you'll basically develop a CRUD of an entity called User. So, in order to store the user data in our app, let's create a real database.

The database we use on most of our projects is PostgresSQL, an open-source relational database.

Creating the database containers

There are a lot of setup so far right? In order to reduce the project setup time, we use Docker containers to create a database to work locally while developing. We'll create 2 databases: one for running server locally and another for (spoiler alert 2) the tests. Yeah, we will write tests. 🤓

First, make sure you have Docker installed on your machine. Just hit Command Space and type Docker. If not, you can download on their site.

  1. Create a docker-compose.yml file on your root project folder.
  2. Setup the two databases in the docker-compose.yml file. You can use this example if you want, just replace the values on environment fields.
  3. Run $ docker-compose up -d on terminal to mount your containers.

Note: Before run docker-compose commands, make sure that the docker is running on your mac. You can use again Command Space, type Docker and hit Enter.

Note 2: If you want to stop your containers, you can run $ docker-compose stop command in your project's root folder.