This is an application, written in Ruby on Rails (Version 7), based on the DFE-Digital template. It uses a Contentful workspace for the content, managed by the content editors in the Help For Early Years Providers service.
Optionally create .env to override or set default variables.
Ruby version 3.4.x
Node version 20.18.x
PostgreSQL version 15.4
Yarn version 4.0.x
Suggest using asdf for local development.
- Clone the repository
- Obtain master key
- Run
bundle installto install the gem dependencies - Run
yarnto install node dependencies - Copy the .env.development.example settings into the .env file
- Run
bin/devto launch the app on http://localhost:3000
- The Project Documentation is located within the EYFS Steady State team intranet 'site'
- Production Environment
- Staging Environment
- Prototype Repo
- Deploy to Development
- Deploy to Staging
- Deploy to Production
$ asdf plugin add ruby
$ asdf install ruby
$ asdf plugin add postgres
$ asdf install postgres
$ asdf plugin add nodejs
$ asdf install nodejsDevelopment
Gemfile group :development
Use bin/dev to start the process workers (watching for changes to asset files).
Testing
Gemfile group :test
Use bin/rspec to run the test suite under /spec.
Rails system specs use RackTest only for efficiency.
There are a number of convenience scripts to make working with Docker easier.
All containers for the project are named with the prefix reform_.
bin/docker-buildcreates tagged images for all the servicesbin/docker-downstops any active servicesbin/docker-rails consoledrops into a running development environment or starts one, containerised equivalent ofbin/rails consolebin/docker-devstartsProcfile.dev, containerised equivalent ofbin/devbin/docker-rspec -f docruns the test suite with optional arguments, containerised equivalent ofbin/rspec
We use rails credentials to manage secrets; obtain the master key from the Dev team.
To edit:
$ EDITOR=vi bin/rails credentials:editCurrently encrypts the following secrets:
secret_key_base:
contentful:
environment:
space:
delivery_access_token:
preview_access_token:
user_password:The contentful credentials can be overridden with environment variables:
CONTENTFUL_SPACE=
CONTENTFUL_ENVIRONMENT=
CONTENTFUL_DELIVERY_TOKEN=
CONTENTFUL_PREVIEW_TOKEN=
CONTENTFUL_MANAGEMENT_TOKEN=
The management token is not used in the application and each developer should have their own. It is used to run the contentful migration and upload tasks.
Visit the Github Container Registry.
Development is deployed automatically with the latest commit from main.
Individual branches may also be used as the source for the deployment, so you can set up the application to review a specific feature not yet merged with main branch.
Staging is deployed from this [workflow][azure-deploy-stage]. Production is deployed from this [workflow][azure-deploy-prod].
Console access:
- https://hfeyp-dev.scm.azurewebsites.net/webssh/host
- https://hfeyp-stage.scm.azurewebsites.net/webssh/host
- https://hfeyp-prod.scm.azurewebsites.net/webssh/host
Sentry is used to monitor production environments
$ brew install getsentry/tools/sentry-cli
$ sentry-cli projects list --org early-years-foundation-reform
+---------+--------------+-------------------------------+--------------+
| ID | Slug | Team | Name |
+---------+--------------+-------------------------------+--------------+
| 6274627 | eyf-reform | early-years-foundation-reform | Rails |
| 6274651 | eyf-recovery | early-years-foundation-reform | eyf-recovery |
+---------+--------------+-------------------------------+--------------+