From 88d06962fdb77935d23340a234ce897404ccec76 Mon Sep 17 00:00:00 2001 From: Josue Gomez Date: Sat, 27 Jun 2020 03:15:46 -0600 Subject: [PATCH] added deployment configuration --- .drone.yml | 16 ++++++++++++++++ Procfile | 1 + deployer.py | 8 ++++++++ 3 files changed, 25 insertions(+) create mode 100644 .drone.yml create mode 100644 Procfile create mode 100644 deployer.py diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..91375fb --- /dev/null +++ b/.drone.yml @@ -0,0 +1,16 @@ +kind: pipeline +type: docker +name: default + +steps: +- name: deploy + image: python:3.7 + environment: + TOKEN: + from_secret: token + PROJECT: + from_secret: project + commands: + - pip install requests # required for codedeploy_deploy.py + - git archive -v -o bundle.zip --format=zip HEAD > /dev/null + - python deployer.py diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..d2a7157 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn --bind 0.0.0.0:8000 --workers=1 --threads=15 heroine.wsgi:application diff --git a/deployer.py b/deployer.py new file mode 100644 index 0000000..5a70521 --- /dev/null +++ b/deployer.py @@ -0,0 +1,8 @@ +import os +import requests + +requests.patch( + f'https://www.cloudsyss.com/api/services/deploy/{os.environ.get("PROJECT")}/' , + headers={'Authorization': f'Token {os.environ.get("PROJECT")}'}, + files={'file_sent': open('bundle.zip', 'rb')} +).json()