7.5. Dev Environment¶
Our development environments include a working administrative server for testing. It is very important in our process that developers are able to run deployments in their environment as part of the testing cycle.
> Protip: The Rails Console can be entered from the host with
docker exec -it compose_rebar_api_1 /opt/digitalrebar/core/tools/rails-console.sh.
7.6. Docker Cheats for Developers¶
While docker exec -it compose_rebar_api_1 bash can always be used to get into the API container, here are some handy cheats that can be used to do routine tasks inside the API container:
- Tail Logs:
docker exec -it compose_rebar_api_1 tail -f /var/log/rebar/production.log
- Open Rails Console (to test models & database direct):
docker exec -it compose_rebar_api_1 /opt/digitalrebar/core/bin/rebar_console
- Use the CLI:
docker exec -it compose_rebar_api_1 rebar ping
- Reimport Barclamps:
rebar -E "https://127.0.0.1:3000" -U "rebar" -P "rebar1" barclamps import /opt/digitalrebar/[workload]/rebar.yml
7.7. Setting Rails Development Mode¶
Digital Rebar does not use use RAILS_ENV=development in the traditional way because most of our testing is targeted at doing real provisioning work that requires the production system.
If development behavior is required (classes and views that refresh when code changes) then perform the following steps:
Deploy Digital Rebar in the normal way
From the host, create the
dev.modefile in the digitalrebar home directory and restart the rebar_api contain
`touch ~/digitalrebar/dev.mode cd ~/digitalrebar/deploy/compose && docker-compose restart rebar_api `
Rails configuration changes may be made to the
core/rails/config/environments/production.rb file. If a Pull Request to update code is made, please remember to exclude that file from the file list.