- Install the prerequisites:
- Ruby 3.3.4
- PostgreSQL
- NodeJS 20.15.1
- Yarn 1.22.x
- Run
bundle install
to install the gem dependencies - Run
yarn
to install node dependencies - Run
bin/rails db:setup
to set up the database development and test schemas, and seed with test data - Copy
.env.example
to.env
and fill in the values (Get an identity secret can be acquired from members of the TRA team) - Run
./bin/dev
to launch the app on http://localhost:3000 and auto-compile assets
- Click the green 'Code' button on the repository home page and click 'Create a Codespace'
- Run
bundle exec rails server
in the terminal window at the bottom of VS Code
If you're unfamiliar with what Codespaces are or how they work read the official guiude. If you
don't have access to them you can request it in #digital-tools-support
on DfE Slack.
- Docker >= 19.03.12
make build-local-image
The docker image doesn't contain a default command. Any command can be appended:
% docker run -p 3001:3000 dfedigital/govuk-rails-boilerplate:latest rails -vT
rails about # List versions of all Rails frameworks and the environment
rails action_mailbox:ingress:exim # Relay an inbound email from Exim to Action Mailbox (URL and INGRESS_PASSWORD required)
...
Starts the stack (database and application) for development. You only need Docker on your machine.
docker-compose up -d
Open http://localhost:3000 to browse the app. Edit code as normal (the project directory is mounted as a volume.)
Prefix other commands with docker compose run web
, e.g.:
docker compose run web bundle exec rails c
docker compose run web bundle exec rails db:migrate
docker compose run web bundle exec rake
docker compose run web bundle add foobar
n.b. to run parallel tests, you need to explicitly set RAILS_ENV e.g.: docker compose run -e RAILS_ENV=test web bundle exec rake parallel:spec
If you need to rebuild the image (e.g. Gemfile.lock
changed), add --build
: docker compose up -d --build
The ops
service (docker compose run ops
) starts a bash shell with make
, az
and kubectl
ready to use.
You can also use this service to run konduit:
-
After installing with
make install-konduit
as normal, edit konduit.sh:- In
open_tunnels()
changekubectl port-forward [...]
tokubectl port-forward --address 0.0.0.0 [...]
- In
set_db_psql()
, editDB_URL=
replacing127.0.0.1:${LOCAL_PORT}
withkonduit:${LOCAL_PORT}
- In
-
To create the tunnel,
docker compose run --rm --name konduit ops make <target environment> konduit