Skip to content

Commit

Permalink
fix(docker): move apps.json creation into launcher section
Browse files Browse the repository at this point in the history
The `/deploy/setup` directory won't necessarily exist at runtime, because
it is optional if `/deploy/server` exists.

Thus, we should only create the `apps.json` file if we are performing one
of the other build steps (all of which require the `/deploy/server` directory).
It makes most sense to put this in the `launcher` section, since the launcher
uses this.

However, we must create the `apps.json` file before activating the venv,
because we have pyyaml in the root env, but not necessarily in the venv.
Also, the launcher creation script only uses built-in libraries, so it
can be moved before the venv as well.

Signed-off-by: Patrick Avery <[email protected]>
  • Loading branch information
psavery committed Dec 12, 2022
1 parent 49799f6 commit eeb4a88
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions docker/scripts/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
LAUNCHER_OUTPUT_PATH=/deploy/server/launcher.json
WWW_PATH=/deploy/server/www

# Convert the apps.yml file to json and put it in the right place.
# This needs PyYAML, which is in the root python environment, so
# we must do this before activating the venv.
python /opt/trame/yaml_to_json.py /deploy/setup/apps.yml /opt/trame/apps.json
# launcher
# Build if it does not exist, or if "launcher" is in `TRAME_BUILD`
if [[ ! -f $LAUNCHER_OUTPUT_PATH || $TRAME_BUILD == *"launcher"* ]]; then
# Convert the apps.yml file to json and put it in the right place.
# This needs PyYAML, which is in the root python environment, so
# we must do this before activating the venv.
python /opt/trame/yaml_to_json.py /deploy/setup/apps.yml /opt/trame/apps.json

# Generate the launcher config
python /opt/trame/generate_launcher_config.py
fi

# venv
# Build if it does not exist, or if "venv" is in `TRAME_BUILD`
Expand All @@ -29,12 +36,6 @@ else
. /opt/trame/activate_venv.sh
fi

# launcher
# Build if it does not exist, or if "launcher" is in `TRAME_BUILD`
if [[ ! -f $LAUNCHER_OUTPUT_PATH || $TRAME_BUILD == *"launcher"* ]]; then
python /opt/trame/generate_launcher_config.py
fi

# www
# This must be done after activating the venv.
# This directory should already exist.
Expand Down

0 comments on commit eeb4a88

Please sign in to comment.