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

Add rails db:setup step to readme #36

Merged
merged 3 commits into from
Jul 30, 2023
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
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ application up and running.

Things you may want to cover:

* Ruby version
- Ruby version

* System dependencies

* Configuration
- System dependencies

- Configuration

## Running in docker

Expand All @@ -20,12 +19,14 @@ locally, with preconfigured connections.

At present, these services are: postgres, redis, and the rails application.

To start the application, run `docker compose up`. Adding `-d` will free your
terminal after the service boots. After the application starts, the site can
To start the application, run `docker compose up`. Adding `-d` will free your
terminal after the service boots. After the application starts, the site can
be accessed at `http://localhost:3000`.

To set up the database the first time run, `docker compose run --rm stocks bin/rails db:setup`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Within the container, this shouldn't be necessary -- the entrypoint script handles making sure the database is up to date and migrated.

it's necessary when running outside docker, but we don't have an instruction block for that.


The docker entrypoint takes care of installing updated gems, and running any
pending database migrations before starting the rails application. Any
pending database migrations before starting the rails application. Any
gem or configuration changes can be applied by restarting the application server:
`docker compose restart stocks`

Expand All @@ -46,12 +47,13 @@ $ docker compose run --rm stocks bash
⠿ Container stocks-in-the-future-db-1 Running 0.0s
⠿ Container stocks-in-the-future-redis-1 Running 0.0s
The Gemfile's dependencies are satisfied
root@cea35fe15a85:/rails#
root@cea35fe15a85:/rails#
```

### Running tests

To run RSpec tests in the container:

```shell
docker compose run --rm stocks rspec
```
Expand Down