Skip to content
This repository has been archived by the owner on Dec 12, 2019. It is now read-only.

Commit

Permalink
Add basic support for support and support-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Thorner committed Jun 5, 2019
1 parent 85bc8c9 commit 1cd31a5
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ The following apps are supported by govuk-docker to some extent.
- ✅ plek
- ✅ publishing-api
- ✅ router-api
- router
- router
* Unable to run `make test` due to a [hardcoded DB host](https://github.com/alphagov/router/blob/master/integration_tests/route_helpers.go#L77)
- ✅ support
- ⚠ support-api
* [PostgreSQL config](https://github.com/benthorner/govuk-docker/blob/master/support-api/database.yml) is overriden to set a non-localhost URL
- ⚠ whitehall
* Who knows, really - several tests are failing, lots pass ;-)
* **TODO: Missing support for an E2E stack**
Expand Down
2 changes: 2 additions & 0 deletions nginx-proxy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ services:
- router-api.dev.gov.uk
- router.dev.gov.uk
- static.dev.gov.uk
- support.dev.gov.uk
- support-api.dev.gov.uk
- whitehall-admin.dev.gov.uk
- www-origin.dev.gov.uk
- www.dev.gov.uk
7 changes: 7 additions & 0 deletions support-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ruby:2.6.3
RUN apt-get update -qq && apt-get upgrade -y && apt-get install -y build-essential libpq-dev libxml2-dev libxslt1-dev
RUN apt-get install -y postgresql-client
RUN apt-get clean

RUN useradd -m build
USER build
5 changes: 5 additions & 0 deletions support-api/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GOVUK_DOCKER_RUN=govuk-docker run support-api-default

default:
${GOVUK_DOCKER_RUN} bundle
${GOVUK_DOCKER_RUN} sh -c 'rake db:migrate 2>/dev/null || rake db:setup'
17 changes: 17 additions & 0 deletions support-api/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
# Necessary to allow creating a db with different encodings.
# See http://www.postgresql.org/docs/9.1/static/manage-ag-templatedbs.html for details
template: template0

development:
<<: *default
url: <%= ENV["DATABASE_URL"] %>

test:
<<: *default
url: <%= ENV["TEST_DATABASE_URL"] %>
38 changes: 38 additions & 0 deletions support-api/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3.7'

x-support-api: &support-api
build:
context: .
dockerfile: support-api/Dockerfile
image: support-api
volumes:
- ..:/govuk:delegated
- bundle:/usr/local/bundle
- home:/home/build
- ./support-api/database.yml:/govuk/support-api/config/database.yml
working_dir: /govuk/support-api

services:
support-api-default:
<<: *support-api
depends_on:
- postgres
- redis
environment:
DATABASE_URL: "postgresql://postgres@postgres/support-api"
TEST_DATABASE_URL: "postgresql://postgres@postgres/support-api-test"
REDIS_URL: redis://redis

support-api-backend: &support-api-backend
<<: *support-api
depends_on:
- postgres
- redis
- nginx-proxy
environment:
DATABASE_URL: "postgresql://postgres@postgres/support-api"
REDIS_URL: redis://redis
VIRTUAL_HOST: support-api.dev.gov.uk
ports:
- "3000"
command: rails s -b 0.0.0.0 -P /tmp/rails.pid
17 changes: 17 additions & 0 deletions support/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ruby:2.6.3

RUN apt-get update -qq && apt-get upgrade -y && apt-get install -y build-essential
RUN apt-get install -y libxss1 libappindicator1 libindicator7
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && apt install -y ./google-chrome*.deb

RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
RUN tar -xf phantomjs-2.1.1-linux-x86_64.tar.bz2
RUN cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get update -qq && apt-get install -y nodejs

RUN apt-get clean

RUN useradd -m build
USER build
4 changes: 4 additions & 0 deletions support/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GOVUK_DOCKER_RUN=govuk-docker run support-default

default:
${GOVUK_DOCKER_RUN} bundle
33 changes: 33 additions & 0 deletions support/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.7'

x-support: &support
build:
context: .
dockerfile: support/Dockerfile
image: support
volumes:
- ..:/govuk:delegated
- bundle:/usr/local/bundle
- home:/home/build
working_dir: /govuk/support

services:
support-default:
<<: *support
depends_on:
- redis
environment:
REDIS_URL: redis://redis

support-backend: &support-backend
<<: *support
depends_on:
- redis
- nginx-proxy
- support-api-backend
environment:
VIRTUAL_HOST: support.dev.gov.uk
REDIS_URL: redis://redis
ports:
- "3000"
command: rails s -b 0.0.0.0 -P /tmp/rails.pid

0 comments on commit 1cd31a5

Please sign in to comment.