Skip to content

Commit

Permalink
add cnpy deployment stuff for k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
nhumrich committed Sep 22, 2017
1 parent b0bd187 commit f288577
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 13 deletions.
28 changes: 16 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,11 @@ build:
after_script:
- docker push $REPO_NAME:$CI_COMMIT_SHA

lint:
image: $REPO_NAME:$CI_COMMIT_SHA
stage: test
script:
- invoke lint

test:
image: $REPO_NAME:$CI_COMMIT_SHA
stage: test
script:
- invoke test -x
- pytest

push-to-dockerhub:
stage: push-to-dockerhub
Expand All @@ -50,15 +44,25 @@ push-to-dockerhub:
only:
- master

.deploy: &deploy
image: canopytax/deployment
script:
- /scripts/canopy-deploy.py --docker-tag "$CI_COMMIT_SHA"
only:
- master
allow_failure: false


deploy-stage:
image: canopytax/deployment
<<: *deploy
stage: deploy-stage
environment:
name: stage
url: https://tm.canopy.ninja
script:
- /scripts/canopy-deploy.py --docker-tag "$CI_COMMIT_SHA"
only:
- master

deploy-prod:
<<: *deploy
stage: deploy-prod
environment:
name: production
url: https://tm.canopytax.com
44 changes: 44 additions & 0 deletions cnpy-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: tmeister
labels:
stack: python
squad: black

expose: True
healthcheck_url: /heartbeat
port: 8445

environment:
default:
GITHUB_ORG: CanopyTax
DATABASE_MAX_POOL_SIZE: 8
DATABASE_DB_NAME: tmeisterdb
DATABASE_USER: tmeister_app
SKIP_MIGRATIONS: true
stage:
ENV_LOCATION: stage
COOKIE_NAME: canopytogglemeister
production:
COOKIE_NAME: canopytoggles
ENV_LOCATION: Prod

secrets:
global:
DATABASE_URL: database_hostname
tmeister:
DATABASE_PASS: database_password
GITHUB_ID: github_id
GITHUB_SECRET: github_secret
COOKIE_KEY: cookie_key
SENTRY_URL: sentry_dsn


migration:
command: ["alembic", "upgrade", "head"]
environment:
default:
DATABASE_MIGRATION_USER: tmeister_sa
secrets:
global:
DATABASE_URL: database_hostname
tmeister:
DATABASE_MIGRATION_PASS: database_migration_password
2 changes: 1 addition & 1 deletion startup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

if [ "$SKIP_MIGRATIONS" != "true" ];
if [ "$SKIP_MIGRATIONS" != "True" ];
then
./migrate-db.sh
fi
Expand Down

0 comments on commit f288577

Please sign in to comment.