diff --git a/.env b/.env index 5fb07ce5..0d5bfb0f 100644 --- a/.env +++ b/.env @@ -1,4 +1,5 @@ PORT=8037 FLASK_DEBUG=true SECRET_KEY=local_development_fake_key +FLASK_SECRET_KEY=local_development_fake_key DEVEL=True \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5b58c591..f86c9fe7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,20 +2,10 @@ name: PR checks on: pull_request env: + FLASK_SECRET_KEY: insecure_test_key SECRET_KEY: insecure_test_key jobs: - run-image: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Build image - run: DOCKER_BUILDKIT=1 docker build --tag dqlite-io . - - name: Run image - run: | - docker run -d -p 80:80 --env SECRET_KEY=insecure_secret_key dqlite-io - sleep 1 && curl --head --fail --retry-delay 5 --retry 10 --retry-connrefused http://localhost - run-dotrun: runs-on: ubuntu-latest diff --git a/app.py b/app.py new file mode 100644 index 00000000..e8bed291 --- /dev/null +++ b/app.py @@ -0,0 +1 @@ +from webapp.app import app \ No newline at end of file diff --git a/rockcraft.yaml b/rockcraft.yaml new file mode 100644 index 00000000..b59eb927 --- /dev/null +++ b/rockcraft.yaml @@ -0,0 +1,18 @@ +# Copyright 2023 Canonical Ltd. +# See LICENSE file for licensing details. +name: dqlite-io +summary: OCI image for the dqlite.io site. +description: OCI image for the dqlite.io site. +version: "0.1" +base: bare +license: Apache-2.0 + +parts: + flask/install-app: + prime: + - flask/app/static + - flask/app/webapp + - flask/app/templates + +extensions: + - flask-framework \ No newline at end of file diff --git a/webapp/app.py b/webapp/app.py index 4676442a..40084d68 100644 --- a/webapp/app.py +++ b/webapp/app.py @@ -1,3 +1,4 @@ +import os import talisker.requests # Packages @@ -10,7 +11,9 @@ from canonicalwebteam.search import build_search_view from flask import render_template, make_response -# Rename your project below +# TODO: make this a configuration parameter on flask-base +os.environ["SECRET_KEY"] = os.environ["FLASK_SECRET_KEY"] + app = FlaskBase( __name__, "dqlite.io",