diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 776fc64..e22f5f3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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": { diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 017c5f8..c807956 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -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 diff --git a/README.md b/README.md index 7fc5a3a..28e5f54 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/docker-compose.override.init.yml b/docker-compose.override.init.yml index d4929c2..7f2b9e3 100644 --- a/docker-compose.override.init.yml +++ b/docker-compose.override.init.yml @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 68672ac..f9b9d18 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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