Skip to content

Commit

Permalink
12 factor charm: Add rockcraft.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmartinspt committed Nov 8, 2023
1 parent 42e2384 commit 12f2178
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
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

0 comments on commit 12f2178

Please sign in to comment.