Add some notes

This commit is contained in:
Luke Murphy 2020-07-02 15:00:27 +02:00
parent eadb17d8c1
commit 61a1ae62ab
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 21 additions and 5 deletions

View File

@ -99,6 +99,14 @@ def stack_deploy(app_name, stack_name, env):
"""Depoy an application to the swarm."""
compose_yml = DATA_DIR / app_name / "compose.yml"
command = f"docker stack deploy -c {compose_yml} {stack_name}"
# Note(decentral1se): we're not sure if this ever succeeds actually stuff
# like https://github.com/issuu/sure-deploy could be used and once we
# graduate this to a dockerise app, we could install that all in the
# container and run it from here. Of course, if we're using JS or not might
# affect this, say, we have a page that is real-time reporting or we're
# using a static page? Unsure what the UX could be like, thinking of
# cloudron loading bar but never like those...
run(split(command), env=env)
@ -107,8 +115,12 @@ def get_loaded_env(app_name, request_form):
env = environ.copy()
for key in request_form.keys():
# Note(decentral1se): {"app_ini": "foo"} -> {"APP_INI": "foo"}
env[key.upper()] = request.form[key]
# Note(decentral1se): maybe we don't need this in the end since we will be
# quite sure that our configs are working and we are not getting rate
# limited
env["LETS_ENCRYPT_ENV"] = "staging"
return env
@ -169,19 +181,23 @@ def deploy(app_name):
try:
mkdir(DATA_DIR)
except FileExistsError:
# Note(decentral1se): we already cloned it, so keep going
pass
clone_app_template(app_name)
# Note(decentral1se): there are badly named and the functions have too many
# concerns but they basically load every value required into the
# environment so that it can be injected when docker stack deploy is run,
# oh and secrets are also created as part of this step ;)
env = get_loaded_env(app_name, form.data)
env = arrange_configs_and_secrets(app_name, form.data, env)
dump_db({form.data["stack_name"]: form.data})
stack_deploy(app_name, form.data["stack_name"], env)
stack_name = form.data["stack_name"]
dump_db({stack_name: form.data})
stack_deploy(app_name, stack_name, env)
return render_template(
"second/deploy.html", app_name=app_name, stack_name=form.data["stack_name"]
"second/deploy.html", app_name=app_name, stack_name=stack_name
)