Skip to content

Use bin/setup in devcontainer and move to port 3100 for dev. #398

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

Merged
merged 2 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or the host.
"forwardPorts": [3000, 5432],
"forwardPorts": [3100, 5432],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bundle install && bundle exec rake db:setup",
"postCreateCommand": "./bin/setup",
// Configure tool-specific properties.
"customizations": {
"vscode": {
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
# (Adding the "ports" property to this file will not forward from a Codespace.)

environment:
PORT: 3100
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ export DOCKER_DEFAULT_PLATFORM=linux/arm64/v8

```sh
echo "RAILS_ENV=development" > .env
echo "PORT=3100" >> .env
cp config/database.example.yml config/database.yml
docker network create null_signal
docker compose build
docker compose -f docker-compose.yml -f docker-compose.override.init.yml up -d
```

Wait until `docker compose logs nrdb_api_server | tail` shows `Listening on http://0.0.0.0:3000`.
Wait until `docker compose logs nrdb_api_server | tail` shows `Listening on http://0.0.0.0:3100`.

Test that `http://localhost:3000/api/docs/` loads in your browser. Afterwords,
Test that `http://localhost:3100/api/docs/` loads in your browser. Afterwords,

```sh
docker compose up -d
Expand All @@ -65,12 +66,12 @@ docker compose exec -e RAILS_ENV=test bundle exec rails db:seed
## Getting Started

Once your server is running you can hit the api!
ex. `http://localhost:3000/api/v3/public/cards/sure_gamble`
ex. `http://localhost:3100/api/v3/public/cards/sure_gamble`

You can find the full list of routes here:
`http://localhost:3000/rails/info/routes`
`http://localhost:3100/rails/info/routes`

API Documentation will be available at `http://localhost:3000/api/docs/`.
API Documentation will be available at `http://localhost:3100/api/docs/`.

Run `RAILS_ENV=test bundle exec rails db:reset` with `docker compose run` or in a
shell in the container to load the fixture data for the tests.
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.override.init.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
services:

nrdb_api_server:
ports:
- "3100:3100"

command:
- /bin/sh
- -c
- |
bundle exec rake db:reset
bundle exec rails cards:import
bundle exec rails server -b 0.0.0.0
bundle exec rails server -b 0.0.0.0 -p 3100
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ services:
# build the Dockerfile next to this file, tag the built image with above image name
build: .

ports:
- "3000:3000"

networks:
- backend
- null_signal
Expand Down