Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do Not Merge] Spike dual run content store on postgresql #656

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ services:
- content-data-api.dev.gov.uk
- content-data-admin.dev.gov.uk
- content-store.dev.gov.uk
- content-store-on-mongodb.dev.gov.uk
- content-store-on-postgresql.dev.gov.uk
- content-store-proxy.dev.gov.uk
- content-tagger.dev.gov.uk
- draft-origin.dev.gov.uk
- draft-router.dev.gov.uk
Expand Down
2 changes: 2 additions & 0 deletions projects/content-store-on-postgresql/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
content-store-on-postgresql: bundle-content-store-on-postgresql router-api publishing-api
$(GOVUK_DOCKER) run $@-lite bin/rake db:prepare
42 changes: 42 additions & 0 deletions projects/content-store-on-postgresql/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3.7'

volumes:
content-store-on-postgresql-tmp:

x-content-store-on-postgresql: &content-store-on-postgresql
build:
context: .
dockerfile: Dockerfile.govuk-base
image: content-store-on-postgresql
stdin_open: true
tty: true
volumes:
- ${GOVUK_ROOT_DIR:-~/govuk}:/govuk:delegated
- root-home:/root
- content-store-on-postgresql-tmp:/govuk/content-store-on-postgresql/tmp
working_dir: /govuk/content-store-on-postgresql

services:
content-store-on-postgresql-lite:
<<: *content-store-on-postgresql
depends_on:
- postgres-13
environment:
TEST_DATABASE_URL: "postgresql://postgres@postgres-13/content-store-test"
DATABASE_URL: "postgresql://postgres@postgres-13/content-store"

content-store-on-postgresql-app: &content-store-on-postgresql-app
<<: *content-store-on-postgresql
depends_on:
- router-api-app
- nginx-proxy
- postgres-13
environment:
VIRTUAL_HOST: content-store-on-postgresql.dev.gov.uk
BINDING: 0.0.0.0
DATABASE_URL: "postgresql://postgres@postgres-13/content-store"
TEST_DATABASE_URL: "postgresql://postgres@postgres-13/content-store-test"

expose:
- "3000"
command: bin/rails s --restart
14 changes: 14 additions & 0 deletions projects/content-store-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# content-store-proxy is a very lightweight Sinatra app
# with no database, and no cucumber/other end-to-end tests.
# So it doesn't need many of the standard packages.

# Install packages for building ruby
FROM buildpack-deps


# Install rbenv to manage ruby versions
RUN git clone https://github.com/rbenv/rbenv.git /rbenv
RUN git clone https://github.com/rbenv/ruby-build.git /rbenv/plugins/ruby-build
RUN /rbenv/plugins/ruby-build/install.sh
ENV PATH /root/.rbenv/shims:/rbenv/bin:$PATH
ENV BUNDLE_SILENCE_ROOT_WARNING 1
1 change: 1 addition & 0 deletions projects/content-store-proxy/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
content-store-proxy: bundle-content-store-proxy content-store content-store-on-postgresql
46 changes: 46 additions & 0 deletions projects/content-store-proxy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3.7'

volumes:
content-store-proxy-tmp:

x-content-store-proxy: &content-store-proxy
build:
context: .
dockerfile: projects/content-store-proxy/Dockerfile
image: content-store-proxy
stdin_open: true
tty: true
volumes:
- ${GOVUK_ROOT_DIR:-~/govuk}:/govuk:delegated
- root-home:/root
- content-store-proxy-tmp:/govuk/content-store-proxy/tmp
working_dir: /govuk/content-store-proxy

services:
content-store-proxy-lite:
<<: *content-store-proxy
depends_on:
- nginx-proxy
environment:
PRIMARY_UPSTREAM: http://content-store-on-mongodb.dev.gov.uk
SECONDARY_UPSTREAM: http://content-store-on-postgresql.dev.gov.uk

content-store-proxy-app: &content-store-proxy-app
<<: *content-store-proxy
command: bundle exec rackup config.ru -p 3000 -o 0.0.0.0 > /var/log/rackup.log
depends_on:
- content-store-app
- content-store-on-postgresql-app
- nginx-proxy
environment:
# the proxy pretends to be the real thing, so that we don't
# have to make either a) global changes to plek, or b) lots
# of changes to lots of things
VIRTUAL_HOST: content-store.dev.gov.uk
BINDING: 0.0.0.0
PRIMARY_UPSTREAM: http://content-store-on-mongodb.dev.gov.uk
SECONDARY_UPSTREAM: http://content-store-on-postgresql.dev.gov.uk
expose:
- "3000"


2 changes: 1 addition & 1 deletion projects/content-store/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
- nginx-proxy
environment:
MONGODB_URI: "mongodb://mongo-3.6/content-store"
VIRTUAL_HOST: content-store.dev.gov.uk
VIRTUAL_HOST: content-store-on-mongodb.dev.gov.uk
BINDING: 0.0.0.0
expose:
- "3000"
Expand Down