stuff to automate deployment.

This commit is contained in:
Dan Funk 2020-02-17 16:47:34 -05:00
parent 89eb002ffa
commit 9e590961fa
7 changed files with 113 additions and 2 deletions

25
.travis.yml Normal file
View File

@ -0,0 +1,25 @@
language: python
services:
- docker
python:
- "3.7"
install:
- pip install pipenv pytest
- pipenv install
- pytest # <== This runs in Pipenv (a/k/a virtualenv)
# command to run tests
script:
- pytest
before_deploy:
- docker build -t sartography/protocol-builder-mock .
deploy:
provider: script
script: bash docker_push.sh
on:
branch: master

View File

@ -17,6 +17,7 @@ flask-migrate = "*"
flask-marshmallow = "*"
ma = "*"
marshmallow-sqlalchemy = "*"
wtforms-alchemy = "*"
[requires]
python_version = "3.7"

46
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "afcaa47f07aa9c4b50c6b35fb701605e4155a5d34e6d1fe153e01a57af0c7cdd"
"sha256": "96c16527bfb9e0a4363b92b0fff94997f533b831fedb0c5b06c84fcad31231d8"
},
"pipfile-spec": 6,
"requires": {
@ -75,6 +75,13 @@
"index": "pypi",
"version": "==2.6.0"
},
"decorator": {
"hashes": [
"sha256:54c38050039232e1db4ad7375cfce6748d7b41c29e95a081c8a6d2c30364a2ce",
"sha256:5d19b92a3c8f7f101c8dd86afd86b0f061a8ce4540ab8cd401fa2542756bce6d"
],
"version": "==4.4.1"
},
"flask": {
"hashes": [
"sha256:13f9f196f330c7c2c5d7a5cf91af894110ca0215ac051b5844701f2bfd934d52",
@ -201,12 +208,24 @@
"markers": "python_version < '3.8'",
"version": "==1.5.0"
},
"infinity": {
"hashes": [
"sha256:dc4aa138d7e366fc00d2e741e32c78a0fecd16b74f8daeb3f7408b459668005c"
],
"version": "==1.4"
},
"inflection": {
"hashes": [
"sha256:18ea7fb7a7d152853386523def08736aa8c32636b047ade55f7578c4edeb16ca"
],
"version": "==0.3.1"
},
"intervals": {
"hashes": [
"sha256:37921da1407a5e9384e8e1350cfb8500f8d0d69fc43d03d01a4fdc6e7a7c7166"
],
"version": "==0.8.1"
},
"itsdangerous": {
"hashes": [
"sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19",
@ -373,6 +392,12 @@
"index": "pypi",
"version": "==1.3.13"
},
"sqlalchemy-utils": {
"hashes": [
"sha256:4e637c88bf3ac5f99b7d72342092a1f636bea1287b2e3e17d441b0413771f86e"
],
"version": "==0.36.1"
},
"swagger-ui-bundle": {
"hashes": [
"sha256:49d2e12d60a6499e9d37ea37953b5d700f4e114edc7520fe918bae5eb693a20e",
@ -388,6 +413,12 @@
],
"version": "==1.25.8"
},
"validators": {
"hashes": [
"sha256:b192e6bde7d617811d59f50584ed240b580375648cd032d106edeb3164099508"
],
"version": "==0.14.2"
},
"werkzeug": {
"hashes": [
"sha256:169ba8a33788476292d04186ab33b01d6add475033dfc07215e6d219cc077096",
@ -402,6 +433,19 @@
],
"version": "==2.2.1"
},
"wtforms-alchemy": {
"hashes": [
"sha256:c491755380490c5c016f04e62949b22056f915160f54d0d1103c76b944c1c321"
],
"index": "pypi",
"version": "==0.16.9"
},
"wtforms-components": {
"hashes": [
"sha256:4a7751fc12dc4e4b2ef5700973296b5368094dcdf85c2808d2faff2c8e8f4caa"
],
"version": "==0.10.4"
},
"zipp": {
"hashes": [
"sha256:12248a63bbdf7548f89cb4c7cda4681e537031eda29c02ea29674bc6854460c2",

View File

@ -21,3 +21,11 @@ http://localhost:5001/pb/ui
1. pipenv install connexion
1. place your swagger/openapi file in the root directory
1. add methods to return example data in the app.py file.
## Deploying to staging
We don't have a travis / test environment set up for this yet, no tests
but you can build and publish it with:
```bash
docker image build -t sartography/protocol-builder-mock:latest .
docker push sartography/protocol-builder-mock:latest
```

3
docker_push.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push sartography/protocol-builder-mock

6
docker_run.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# run migrations
export FLASK_APP=./app.py
pipenv run flask db upgrade
pipenv run python ./run.py

24
migrations/script.py.mako Normal file
View File

@ -0,0 +1,24 @@
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}
branch_labels = ${repr(branch_labels)}
depends_on = ${repr(depends_on)}
def upgrade():
${upgrades if upgrades else "pass"}
def downgrade():
${downgrades if downgrades else "pass"}