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
Pre-requisites
Pre-requisites:
- Ruby
- Rails
- 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
`bundle install`
3. Create the database:\
`rake db:create`
Create the database
`rake db:create`
4. Run the database migrations:\
`rake db:migrate`
Run the database migrations
`rake db:migrate`
5. Install the frontend depenencies:\
`yarn install`
Start the rails server
```
rails s
```
This starts the rails server on localhost:3000
6. Start the Rails server:\
`bundle exec rails s`
or using Docker
The Rails server will start on <http://localhost:3000>.
```
### Using Docker
```sh
docker-compose build
docker-compose run --rm app rails db:create
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).
- Install the cloudfoundry cli https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
2. [Install the Cloud Foundry 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>`
- Set your deployment target (sandbox/production) <br/>
4. Set your deployment target (sandbox/production):\
`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)