From e40af3912a0e52a4e746aa99fc6f5b163e3bda8a Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Wed, 11 Sep 2019 12:44:51 +0200 Subject: [PATCH] configure production environment --- .circleci/config.yml | 14 ++++++++++---- .elasticbeanstalk/config.yml | 4 +++- .gitignore | 1 + ...errun.aws.json => Dockerrun.aws.json.production | 6 +++--- Makefile | 6 ++++-- README.md | 2 +- build/proxy/Dockerfile | 3 +++ homepage/publishconf.py | 2 +- 8 files changed, 26 insertions(+), 12 deletions(-) rename Dockerrun.aws.json => Dockerrun.aws.json.production (83%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d617bc..486a573 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,9 +23,10 @@ jobs: docker: - image: circleci/golang:1.12 environment: - - POSTGRES_CONNECTION_STRING=postgres://circle:test@localhost:5432/circle_test?sslmode=disable - - PORT=8080 - - EVENT_RETENTION_PERIOD=4464h + POSTGRES_CONNECTION_STRING: postgres://circle:test@localhost:5432/circle_test?sslmode=disable + PORT: 8080 + EVENT_RETENTION_PERIOD: 4464h + COOKIE_EXCHANGE_SECRET: VswgMshC4mPDfey8o+yScg== - image: circleci/postgres:11.2-alpine environment: - POSTGRES_USER=circle @@ -151,6 +152,9 @@ jobs: build: docker: - image: docker:18-git + environment: + SITEURL: https://www.offen.dev + DOCKER_TAGE: stable working_directory: ~/offen steps: - checkout @@ -200,7 +204,9 @@ jobs: sudo pip install awsebcli --upgrade - run: name: Deploying - command: eb deploy + command: | + cp Dockerrun.aws.json.production Dockerrun.aws.json + eb deploy workflows: version: 2 diff --git a/.elasticbeanstalk/config.yml b/.elasticbeanstalk/config.yml index 438573c..38d4188 100644 --- a/.elasticbeanstalk/config.yml +++ b/.elasticbeanstalk/config.yml @@ -1,6 +1,8 @@ branch-defaults: + local-proxy: + environment: production master: - environment: staging + environment: production group_suffix: null global: application_name: offen diff --git a/.gitignore b/.gitignore index 440863e..f66fb9c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ package-lock.json venv/ bootstrap-alpha.yml +Dockerrun.aws.json diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json.production similarity index 83% rename from Dockerrun.aws.json rename to Dockerrun.aws.json.production index fce0391..0d984f7 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json.production @@ -4,7 +4,7 @@ "containerDefinitions": [ { "name": "proxy", - "image": "offen/proxy:latest", + "image": "offen/proxy:stable", "essential": true, "memory": 128, "portMappings": [ @@ -23,9 +23,9 @@ }, { "name": "server", - "image": "offen/server:latest", + "image": "offen/server:stable", "essential": true, - "memory": 128 + "memory": 256 } ] } diff --git a/Makefile b/Makefile index 2ae75e7..7e1cdca 100644 --- a/Makefile +++ b/Makefile @@ -22,9 +22,11 @@ bootstrap: @echo "Bootstrapping Server service ..." @docker-compose run server make bootstrap +DOCKER_IMAGE_TAG ?= latest + build: - @docker build -t offen/server:latest -f build/server/Dockerfile . - @docker build -t offen/proxy:latest -f build/proxy/Dockerfile . + @docker build -t offen/server:${DOCKER_IMAGE_TAG} -f build/server/Dockerfile . + @docker build --build-arg siteurl=${SITEURL} -t offen/proxy:${DOCKER_IMAGE_TAG} -f build/proxy/Dockerfile . secret: @docker-compose run server make secret diff --git a/README.md b/README.md index c3f77e2..dcd07c4 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repository contains all source code needed to build and run __offen__, both --- -Development of __offen__ has just started, so instructions are rare and things will stay highly volatile for quite some while. Also __do not use the software in its current state__ as it is still missing crucial pieces in protecting the data end to end. +Development of __offen__ has just started, so instructions are rare and things will stay highly volatile for quite some while. Guidelines for running and developing the Software will be added when it makes sense to do so. diff --git a/build/proxy/Dockerfile b/build/proxy/Dockerfile index a1f820d..c08e576 100644 --- a/build/proxy/Dockerfile +++ b/build/proxy/Dockerfile @@ -43,6 +43,9 @@ RUN npm run build FROM nikolaik/python-nodejs:python3.6-nodejs10 as homepage +ARG siteurl +ENV SITEURL=$siteurl + COPY ./homepage /code/homepage COPY ./styles /code/styles diff --git a/homepage/publishconf.py b/homepage/publishconf.py index b28fdae..16e9042 100644 --- a/homepage/publishconf.py +++ b/homepage/publishconf.py @@ -11,7 +11,7 @@ sys.path.append(os.curdir) from pelicanconf import * # If your site is available via HTTPS, make sure SITEURL begins with https:// -SITEURL = os.environ.get('PELICAN_SITEURL', 'https://www.offen.dev') +SITEURL = os.environ.get('SITEURL', 'https://www.offen.dev') # RELATIVE_URLS = True FEED_ALL_ATOM = 'feeds/all.atom.xml'