diff --git a/.circleci/config.yml b/.circleci/config.yml index 1f531a3..29053eb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,11 +68,19 @@ jobs: docker push offen/proxy:$DOCKER_IMAGE_TAG deploy: - working_directory: ~/offen docker: - - image: circleci/golang:1.12 + - image: docker:18-git + working_directory: ~/offen steps: - checkout + - setup_remote_docker + - run: + name: Install deployment dependencies + command: | + sudo apt-get update && sudo apt-get install -qq -y python-pip libpython-dev + curl -O https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py + sudo pip install -q awscli --upgrade + sudo pip install awsebcli --upgrade - run: name: Define target environment command: | @@ -81,17 +89,9 @@ jobs: else echo 'export TARGET_ENVIRONMENT="staging"' >> $BASH_ENV fi - - run: - name: Install deployment dependencies - command: | - sudo apt-get update && sudo apt-get install -qq -y python-pip libpython-dev - curl -O https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py - sudo pip install -q awscli --upgrade - sudo pip install awsebcli --upgrade - run: name: Run database migrations - command: | - echo "TBD" + command: docker run -it offen/offen:latest migrate -conn $(aws secretsmanager get-secret-value --secret-id $TARGET_ENVIRONMENT/postgresConnectionString | jq -r '.SecretString') - run: name: Deploy command: | diff --git a/Dockerrun.aws.json.production b/Dockerrun.aws.json.production index 2ec4c40..2beb5c9 100644 --- a/Dockerrun.aws.json.production +++ b/Dockerrun.aws.json.production @@ -30,7 +30,7 @@ }, { "name": "server", - "image": "offen/server:stable", + "image": "offen/offen:stable", "essential": true, "memory": 256 }, diff --git a/Dockerrun.aws.json.staging b/Dockerrun.aws.json.staging index 725c3de..0e18afa 100644 --- a/Dockerrun.aws.json.staging +++ b/Dockerrun.aws.json.staging @@ -23,7 +23,7 @@ }, { "name": "server", - "image": "offen/server:latest", + "image": "offen/offen:latest", "essential": true, "memory": 256 } diff --git a/Makefile b/Makefile index ff1303e..4204be0 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ dev-build: howto: @echo "Successfully built containers and installed dependencies." @echo "If this is your initial setup, you can run 'make bootstrap' next" - @echo "to create seed the database." + @echo "to create and seed the database." bootstrap: @echo "Bootstrapping Server service ..." @@ -32,6 +32,8 @@ bootstrap: update: @echo "Installing / updating dependencies ..." @docker-compose run homepage pip install --user -r requirements.txt + @echo "Applying pending database migrations ..." + @docker-compose run server migrate DOCKER_IMAGE_TAG ?= latest ROBOTS_FILE ?= robots.txt.staging diff --git a/docker-compose.yml b/docker-compose.yml index 8f2c248..f04a91a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: - server server: - image: offen/server:latest + image: offen/offen:latest command: serve volumes: - ./bootstrap.yml:/bootstrap.yml