diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 32ac2bd88..64dd170fe 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -7,7 +7,7 @@ on: pull_request: workflow_dispatch: -concurrency: 'sandbox' +concurrency: 'staging' defaults: run: @@ -95,7 +95,7 @@ jobs: name: Deploy runs-on: ubuntu-latest - environment: 'sandbox' + environment: 'staging' if: github.ref == 'refs/heads/main' needs: [lint, test] @@ -118,7 +118,7 @@ jobs: CF_ORG: ${{ secrets.CF_ORG }} API_USER: ${{ secrets.API_USER }} API_KEY: ${{ secrets.API_KEY }} - APP_NAME: dluhc-core + APP_NAME: dluhc-core-staging GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }} APP_HOST: ${{ secrets.APP_HOST }} RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} @@ -131,4 +131,4 @@ jobs: cf7 set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY cf7 set-env $APP_NAME APP_HOST $APP_HOST cf7 set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY - cf7 push --strategy rolling + cf7 push $APP_NAME --strategy rolling diff --git a/Gemfile.lock b/Gemfile.lock index 46cfa6279..57e3382cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/activeadmin/arbre.git - revision: 305c221a2131be8dd0d96955f9b0a328dfa4beba + revision: dcea09da31322f2bc9bdfc32eb14ec0aaf34ae92 specs: arbre (1.4.0) activesupport (>= 3.0.0, < 7.1) diff --git a/README.md b/README.md index 48f077753..4fea5097e 100644 --- a/README.md +++ b/README.md @@ -53,26 +53,26 @@ Note `docker-compose` runs the production docker image (`RAILS_ENV=production`) This application is running on [GOV.UK 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). +1. Contact your organisation manager to get an account in `dluhc-core` organization and in the relevant spaces (staging/production). 2. [Install the Cloud Foundry CLI](https://docs.cloudfoundry.org/cf-cli/install-go-cli.html) 3. Login:\ `cf login -a api.london.cloud.service.gov.uk -u ` -4. Set your deployment target (sandbox/production):\ +4. Set your deployment target (staging/production):\ `cf target -o dluhc-core -s ` 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](staging_manifest.yml) Once the app is deployed: 1. Get a Rails console:\ -`cf ssh dluhc-core -t -c "/tmp/lifecycle/launcher /home/vcap/app 'rails console' ''"` +`cf ssh dluhc-core-staging -t -c "/tmp/lifecycle/launcher /home/vcap/app 'rails console' ''"` 2. Check logs:\ -`cf logs dluhc-core --recent` +`cf logs dluhc-core-staging --recent` #### Troubleshooting deployments diff --git a/config/database.yml b/config/database.yml index d7a80c837..f04b2a776 100644 --- a/config/database.yml +++ b/config/database.yml @@ -31,7 +31,7 @@ development: database: data_collector_development host: localhost -sandbox: +staging: <<: *default # The specified database role being used to connect to postgres. diff --git a/config/environments/sandbox.rb b/config/environments/staging.rb similarity index 100% rename from config/environments/sandbox.rb rename to config/environments/staging.rb diff --git a/config/webpack/sandbox.js b/config/webpack/staging.js similarity index 62% rename from config/webpack/sandbox.js rename to config/webpack/staging.js index e1b3b9625..93eb5804b 100644 --- a/config/webpack/sandbox.js +++ b/config/webpack/staging.js @@ -1,4 +1,4 @@ -process.env.NODE_ENV = process.env.NODE_ENV || 'sandbox' +process.env.NODE_ENV = process.env.NODE_ENV || 'staging' const environment = require('./environment') diff --git a/config/webpacker.yml b/config/webpacker.yml index 11e9c283c..f388bc5ec 100644 --- a/config/webpacker.yml +++ b/config/webpacker.yml @@ -95,7 +95,7 @@ test: public_output_path: packs-test -sandbox: +staging: <<: *default production: diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json index c400a0077..d5394f06a 100644 --- a/docs/api/DLUHC-CORE-Data.v1.json +++ b/docs/api/DLUHC-CORE-Data.v1.json @@ -8,7 +8,7 @@ "servers": [ { "url": "https://dluhc-core.london.cloudapps.digital", - "description": "Sandbox" + "description": "Staging" } ], "paths": { diff --git a/infrastructure_setup.md b/infrastructure_setup.md new file mode 100644 index 000000000..cd6b7f64c --- /dev/null +++ b/infrastructure_setup.md @@ -0,0 +1,21 @@ +# Staging + +1. Login:\ +`cf login -a api.london.cloud.service.gov.uk -u ` + +2. Set your deployment target (staging):\ +`cf target -o dluhc-core -s staging` + +3. Create required Postgres and S3 bucket backing services (this will take ~15 mins to finish creating):\ + `cf create-service postgres tiny-unencrypted-13 dluhc-core-staging-postgres` + + `cf create-service aws-s3-bucket default dluhc-core-staging-import-bucket` + + `cf create-service aws-s3-bucket default dluhc-core-staging-export-bucket` + + `cf bind-service dluhc-core-staging dluhc-core-staging-import-bucket -c '{"permissions": "read-only"}'` + + `cf bind-service dluhc-core-staging dluhc-core-staging-export-bucket -c '{"permissions": "read-write"}'` + +4. Deploy manifest:\ +`cf push dluhc-core-staging --strategy rolling` diff --git a/manifest.yml b/manifest.yml index c04f027a7..154e816ef 100644 --- a/manifest.yml +++ b/manifest.yml @@ -1,14 +1,25 @@ --- +defaults: &defaults + buildpacks: + - https://github.com/cloudfoundry/ruby-buildpack.git + processes: + - type: web + command: rake db:migrate && bin/rails server + instances: 2 + memory: 512M + applications: - - name: dluhc-core - buildpacks: - - https://github.com/cloudfoundry/ruby-buildpack.git + - name: dluhc-core-staging + <<: *defaults env: - RAILS_ENV: sandbox - processes: - - type: web - command: rake db:migrate && bin/rails server - instances: 2 - memory: 512M + RAILS_ENV: staging services: - - dluhc-core-sandbox-postgres + - dluhc-core-staging-postgres + + - name: dluhc-core-production + <<: *defaults + env: + RAILS_ENV: production + host: submit-social-housing-lettings-sales-data + services: + - dluhc-core-production-postgres