This is the codebase for the Ruby/Rails app that will handle the submission of Lettings and Sales of Social Housing in England data.
This is the codebase for the Ruby on Rails app that will handle the submission of Lettings and Sales of Social Housing in England data.
## Required Setup
## Required Setup
Pre-requisites
Pre-requisites:
- Ruby
- Ruby
- Rails
- Rails
- Postgres
- Postgres
### Quick start
### Setup Quickstart
1. Copy the `.env.example` to `.env` and replace the database credentials with your local postgres user credentials.
Copy the `.env.example` to `.env` and replace the database credentials with your local postgres user credentials.
2. Install the dependencies:\
`bundle install`
Install the dependencies
3. Create the database:\
`bundle install`
`rake db:create`
Create the database
4. Run the database migrations:\
`rake db:create`
`rake db:migrate`
Run the database migrations
5. Install the frontend depenencies:\
`rake db:migrate`
`yarn install`
Start the rails server
6. Start the Rails server:\
```
`bundle exec rails s`
rails s
```
This starts the rails server on localhost:3000
or using Docker
The Rails server will start on <http://localhost:3000>.
```
### Using Docker
```sh
docker-compose build
docker-compose build
docker-compose run --rm app rails db:create
docker-compose run --rm app rails db:create
docker-compose up
docker-compose up
```
```
This exposes the rails server on localhost:8080.
The Rails server will start on <http://localhost:8080>.
Note docker-compose runs the production docker image (RAILS_ENV=production) as the Dockerfile doesn't include development gems to keep the image size down.
Note `docker-compose` runs the production docker image (`RAILS_ENV=production`) as the Dockerfile doesn’t include development gems to keep the image size down.
## Infrastructure
### Infrastructure
This application is running on [GOV.UK PaaS](https://www.cloud.service.gov.uk/). To deploy you need to:
This application is running on [Gov PaaS](https://www.cloud.service.gov.uk/). To deploy you need to:
1. Contact your organisation manager to get an account in `dluhc-core` organization and in the relevant spaces (sandbox/production).
- Contact your organisation manager to get an account in `dluhc-core` organization and in the relevant spaces (sandbox/production).
2. [Install the Cloud Foundry CLI](https://docs.cloudfoundry.org/cf-cli/install-go-cli.html)
- Install the cloudfoundry cli https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
- Login <br/>
3. Login:\
`cf login -a api.london.cloud.service.gov.uk -u <your_username>`
`cf login -a api.london.cloud.service.gov.uk -u <your_username>`
- Set your deployment target (sandbox/production) <br/>
4. Set your deployment target (sandbox/production):\
`cf target -o dluhc-core -s <deploy_environment>`
`cf target -o dluhc-core -s <deploy_environment>`
- Deploy <br/>
5. Deploy:\
`cf push dluhc-core --strategy rolling`. This will use the [manifest file](manifest.yml)
`cf push dluhc-core --strategy rolling`. This will use the [manifest file](manifest.yml)
"header":"Has the tenant ever served in the UK armed forces?",
"header":"Has the tenant ever served in the UK armed forces?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
"check_answer_label":"Armed Forces",
"answer_options":{
"answer_options":{
"0":"Yes - a regular",
"0":"Yes - a regular",
"1":"Yes - a reserve",
"1":"Yes - a reserve",
@ -302,6 +303,7 @@
"header":"Are they still serving?",
"header":"Are they still serving?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
"check_answer_label":"When did they leave the Armed Forces?",
"answer_options":{
"answer_options":{
"0":"Yes",
"0":"Yes",
"1":"No - they left up to 5 years ago",
"1":"No - they left up to 5 years ago",
@ -313,6 +315,7 @@
"header":"Were they seriously injured or ill as a result of their service?",
"header":"Were they seriously injured or ill as a result of their service?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
"check_answer_label":"Has anyone in the household been seriously injured or ill as a result of their service in the armed forces?",
"answer_options":{
"answer_options":{
"0":"Yes",
"0":"Yes",
"1":"No",
"1":"No",
@ -323,6 +326,7 @@
"header":"Was the tenant the spouse or civil partner of someone who served in the UK armed forces?",
"header":"Was the tenant the spouse or civil partner of someone who served in the UK armed forces?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
"check_answer_label":"Was the tenant the spouse or civil partner of someone who served in the UK armed forces?",
"answer_options":{
"answer_options":{
"0":"Yes - was the spouse or civil partner of a UK Armed Forces member and have separated within the last 2 years",
"0":"Yes - was the spouse or civil partner of a UK Armed Forces member and have separated within the last 2 years",
"1":"Yes - was the spouse or civil partner of a UK Armed Forces member who died within the last 2 years",
"1":"Yes - was the spouse or civil partner of a UK Armed Forces member who died within the last 2 years",
@ -340,6 +344,7 @@
"header":"Does anyone in the household have any of the following that they expect to last for 12 months or more:<ul><li>Physical Condition</li><li>Mental Health Condition</li><li>Other Illness</li></ul>",
"header":"Does anyone in the household have any of the following that they expect to last for 12 months or more:<ul><li>Physical Condition</li><li>Mental Health Condition</li><li>Other Illness</li></ul>",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
"check_answer_label":"Physical, mental health or illness in the household",
"answer_options":{
"answer_options":{
"0":"Yes",
"0":"Yes",
"1":"No",
"1":"No",
@ -357,6 +362,7 @@
"header":"Is anyone in the household pregnant?",
"header":"Is anyone in the household pregnant?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
"check_answer_label":"Pregnancy in the household",
"answer_options":{
"answer_options":{
"0":"Yes",
"0":"Yes",
"1":"No",
"1":"No",
@ -373,6 +379,7 @@
"header":"Are any of these affected by their condition or illness?",
"header":"Are any of these affected by their condition or illness?",
"hint_text":"Select all that apply",
"hint_text":"Select all that apply",
"type":"checkbox",
"type":"checkbox",
"check_answer_label":"Disability requirements",
"answer_options":{
"answer_options":{
"0":"Fully wheelchair accessible housing",
"0":"Fully wheelchair accessible housing",
"1":"Wheelchair access to essential rooms",
"1":"Wheelchair access to essential rooms",
@ -395,6 +402,7 @@
"header":"Are any of these affected by their condition or illness?",
"header":"Are any of these affected by their condition or illness?",
"hint_text":"Select all that apply",
"hint_text":"Select all that apply",
"type":"checkbox",
"type":"checkbox",
"check_answer_label":"Conditions or illnesses",
"answer_options":{
"answer_options":{
"0":"Vision - such as blindness or partial sight",
"0":"Vision - such as blindness or partial sight",
"1":"Hearing - such as deafness or partial hearing",
"1":"Hearing - such as deafness or partial hearing",
@ -1136,7 +1144,9 @@
"hint_text":"Eligible for housing benefit or Universal Credit",
"hint_text":"Eligible for housing benefit or Universal Credit",
"hint_text":"This is the total of rent and all charges",
"hint_text":"This is the total of rent and all charges",
"type":"numeric",
"type":"numeric",
"min":0,
"min":0,
"step":1
"step":1,
"readonly":true
},
},
"outstanding_amount":{
"outstanding_amount":{
"check_answer_label":"After housing benefit and/or housing element of UC payment is received, will there be an outstanding amount for basic rent and/or benefit eligible charges?",
"check_answer_label":"After housing benefit and/or housing element of UC payment is received, will there be an outstanding amount for basic rent and/or benefit eligible charges?",