Spoof out second version

This commit is contained in:
Luke Murphy 2020-07-01 20:02:19 +02:00
parent cae337094f
commit 79272b55bb
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 47 additions and 8 deletions

View File

@ -2,15 +2,26 @@
A swarm of dreams.
## Proof Of Concept
## first.py
- [x] List apps from an `app.json` (points to https://git.autonomic.zone/compose-stacks)
- [x] Clone selected app template and parse configuration for inputs (env vars and secrets)
- [ ] Generate a form so those values can be filled out and allow it to be saved
- [ ] Save the form inputs to a `db.json`
- [ ] Deploy an applicaiton to a local swarm (assumes access to local docker socket)
- [ ] Create an "edit app" page where the `db.json` is re-called and can be updated
- [ ] Make sure re-deploy works (taking care of updating secret and app versions)
Ideas contained within...
- List apps from an `app.json` (points to https://git.autonomic.zone/compose-stacks)
- Clone selected app template and parse configuration for inputs (env vars and secrets)
- Generate a form so those values can be filled out and allow it to be saved
- Save the form inputs to a `db.json` (as a start)
- Deploy an applicaiton to a local swarm (assumes access to local docker socket)
- Create an "edit app" page where the `db.json` is re-called and can be updated
- Make sure re-deploy works (taking care of updating secret and app versions)
## second.py
More ideas...
- Don't try to be smart with the auto-generation, hard-code everything. We
maintain the app template (`compose.yml`) and this code anyway, so we just
need to be aware of each other and keep in sync. This would optimise for
trust and collaboration and not "smart" code.
### Development

28
second.py Normal file
View File

@ -0,0 +1,28 @@
"""Less flashy version. Mord hard-coding."""
from pathlib import Path
from flask import Flask, render_template
from ruamel.yaml import YAML
app = Flask(__name__)
# Note(decentral1se): load from env vars at some point
app.secret_key = b'_5#y2L"F4Q8z\n\xec]/'
yaml = YAML()
# Note(decentral1se): paths needs to change dependening
# on deployment mode ./data in dev, /data in production
DATA_DIR = Path("./data")
STATIC_DIR = Path(app.root_path).absolute() / "static"
@app.route("/")
def home():
pass
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0")