Teacher Training Entitlement - setup
Local development
- Install the prerequisites (see
.tool-versionsfor versions):- Ruby
- PostgreSQL 14
- NodeJS
- Yarn
- Graphviz
- Run
bundle installto install the gem dependencies - Run
yarnto install node dependencies - Run
bin/rails db:setupto set up the database development and test schemas, and seed with test data - Copy
.env.exampleto.envand fill in the values (ask a team member forTRA_OIDC_*values) - Run
./bin/devto launch the app on http://localhost:3000 and auto-compile assets
Codespaces
- Click the green 'Code' button on the repository home page and click 'Create a Codespace'
- Run
bundle exec rails serverin 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 Compose
You only need Docker on your machine. Start the stack (database and application) for development:
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 cdocker compose run web bundle exec rails db:migratedocker compose run web bundle exec rakedocker 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
ops service
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-konduitas 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