From d75cc119c24c70bb5cadbb23e1822e6b6d5eae48 Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Mon, 7 Nov 2022 15:26:43 +0100 Subject: [PATCH] Starts adding auto deploy --- .dockerignore | 17 +++++++++++++++++ .github/workflows/fly.yml | 15 +++++++++++++++ Dockerfile | 11 +++++++++++ fly.toml | 38 ++++++++++++++++++++++++++++++++++++++ requirements.txt | 3 ++- 5 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/fly.yml create mode 100644 Dockerfile create mode 100644 fly.toml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2eb8df5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +# flyctl launch added from .gitignore +**/.idea +**/.DS_Store + +**/config.ini + +**/venv + +**/.git +**/*.pyc +**/__pycache__ +**/*.egg-info +**/dist +**/build +**/.vscode + +**/.env diff --git a/.github/workflows/fly.yml b/.github/workflows/fly.yml new file mode 100644 index 0000000..d2e8b2e --- /dev/null +++ b/.github/workflows/fly.yml @@ -0,0 +1,15 @@ +name: Fly Deploy +on: + push: + branches: + - main +env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} +jobs: + deploy: + name: Deploy app + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --remote-only \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9e3a15a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.9-slim + +COPY app/ /app +COPY requirements.txt /app/requirements.txt + +EXPOSE 5000 + +WORKDIR /app +RUN pip install -r requirements.txt + +CMD [ "python", "./app.py" ] \ No newline at end of file diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..a27360e --- /dev/null +++ b/fly.toml @@ -0,0 +1,38 @@ +# fly.toml file generated for checkout-create on 2022-11-07T15:12:40+01:00 + +app = "checkout-create" +kill_signal = "SIGINT" +kill_timeout = 5 +processes = [] + +[env] + +[experimental] + allowed_public_ports = [] + auto_rollback = true + +[[services]] + http_checks = [] + internal_port = 8080 + processes = ["app"] + protocol = "tcp" + script_checks = [] + [services.concurrency] + hard_limit = 25 + soft_limit = 20 + type = "connections" + + [[services.ports]] + force_https = true + handlers = ["http"] + port = 80 + + [[services.ports]] + handlers = ["tls", "http"] + port = 443 + + [[services.tcp_checks]] + grace_period = "1s" + interval = "15s" + restart_limit = 0 + timeout = "2s" diff --git a/requirements.txt b/requirements.txt index a44b9fe..9fec26f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -flask +Flask==2.2.2 Adyen == 6.0.0 python-dotenv===0.19.2 requests == 2.27.1 +gunicorn==20.1.0