@@ -63,34 +63,19 @@ _select-version:
6363 # Persist the chosen tag for the calling recipe
6464 echo "${chosen}" > /tmp/.ftm_deploy_tag
6565
66- # Production deploy
66+ # Production deploy (auto-detects AUTH_PROVIDER from .env)
6767[no-cd]
6868prod:
69- #!/usr/bin/env sh
69+ #!/usr/bin/env bash
7070 set -e
7171
72- just start _select-version
73- export GIT_BRANCH=$(cat /tmp/.ftm_deploy_tag)
74-
75- # From deploy dir
76- cd {{justfile_directory()}}/deploy
77-
78- # Config
79- just config generate-dotenv "${GIT_BRANCH}"
80- just config custom-favicon
81-
82- # Deploy core FieldTM
83- ../envsubst -no-unset -i compose.sub.yaml | \
84- {{docker}} compose -f - up --detach \
85- --remove-orphans --force-recreate
86-
87- just _echo-blue "FieldTM ${GIT_BRANCH} started successfully"
72+ # Ensure PATH includes common binary locations (rootless docker, snap, etc.)
73+ export PATH="$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH"
8874
89- # Production deploy with self-hosted Hanko auth (contrib/login)
90- [no-cd]
91- prod-login:
92- #!/usr/bin/env sh
93- set -e
75+ if ! command -v {{docker}} >/dev/null 2>&1; then
76+ just _echo-red "'{{docker}}' not found. If using nerdctl, set DOCKER_ALIAS=nerdctl in .env"
77+ exit 1
78+ fi
9479
9580 just start _select-version
9681 export GIT_BRANCH=$(cat /tmp/.ftm_deploy_tag)
@@ -100,26 +85,44 @@ prod-login:
10085
10186 # Config
10287 just config generate-dotenv "${GIT_BRANCH}"
103- just config custom-favicon
104-
105- # Both compose files use ${FTM_DOMAIN} in bunkerweb env var KEY names, which
106- # requires envsubst preprocessing. Process to temp files then compose together.
107- tmp_main=$(mktemp)
108- tmp_login=$(mktemp)
109- ../envsubst -no-unset -i compose.sub.yaml > "$tmp_main"
110- ../envsubst -no-unset -i compose.login.yaml > "$tmp_login"
111- {{docker}} compose -f "$tmp_main" -f "$tmp_login" up --detach \
112- --remove-orphans --force-recreate
113- rm -f "$tmp_main" "$tmp_login"
11488
115- just _echo-blue "FieldTM ${GIT_BRANCH} + self-hosted Hanko started successfully"
89+ # Read AUTH_PROVIDER from .env
90+ auth_provider=$(grep -E '^AUTH_PROVIDER=' ../.env | cut -d= -f2 | tr -d '"' || echo "")
91+
92+ if [ "$auth_provider" = "bundled" ]; then
93+ just _echo-blue "AUTH_PROVIDER=bundled detected, deploying with self-hosted Hanko..."
94+ # Both compose files use ${FTM_DOMAIN} in bunkerweb env var KEY names, which
95+ # requires envsubst preprocessing. Process to temp files then compose together.
96+ tmp_main=$(mktemp)
97+ tmp_login=$(mktemp)
98+ ../envsubst -no-unset -i compose.sub.yaml > "$tmp_main"
99+ ../envsubst -no-unset -i compose.login.yaml > "$tmp_login"
100+ {{docker}} compose -f "$tmp_main" -f "$tmp_login" up --detach \
101+ --remove-orphans --force-recreate
102+ rm -f "$tmp_main" "$tmp_login"
103+ just _echo-blue "FieldTM ${GIT_BRANCH} + self-hosted Hanko started successfully"
104+ else
105+ just _echo-blue "AUTH_PROVIDER=${auth_provider} detected, deploying without bundled login..."
106+ ../envsubst -no-unset -i compose.sub.yaml | \
107+ {{docker}} compose -f - up --detach \
108+ --remove-orphans --force-recreate
109+ just _echo-blue "FieldTM ${GIT_BRANCH} started successfully"
110+ fi
116111
117112# Production deploy with self-hosted ODK Central
118113[no-cd]
119114prod-with-odk:
120- #!/usr/bin/env sh
115+ #!/usr/bin/env bash
121116 set -e
122117
118+ # Ensure PATH includes common binary locations (rootless docker, snap, etc.)
119+ export PATH="$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH"
120+
121+ if ! command -v {{docker}} >/dev/null 2>&1; then
122+ just _echo-red "'{{docker}}' not found. If using nerdctl, set DOCKER_ALIAS=nerdctl in .env"
123+ exit 1
124+ fi
125+
123126 just start _select-version
124127 export GIT_BRANCH=$(cat /tmp/.ftm_deploy_tag)
125128
@@ -128,7 +131,6 @@ prod-with-odk:
128131
129132 # Config
130133 just config generate-dotenv "${GIT_BRANCH}"
131- just config custom-favicon
132134
133135 # Deploy core FieldTM + ODK Central addon
134136 ../envsubst -no-unset -i compose.sub.yaml | \
0 commit comments