Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to 12 factor charm #264

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,10 @@ name: PR checks
on: pull_request

env:
FLAKS_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

Expand Down
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from webapp.app import app
18 changes: 18 additions & 0 deletions rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion webapp/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import talisker.requests

# Packages
Expand All @@ -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",
Expand Down