Skip to content

Commit 76e1fda

Browse files
committed
feat(deploy): add APP_HOSTNAME and deploy target
Introduce `APP_HOSTNAME` variable in `.env.example` for clarity and ease of configuration. Update `justfile` to load environment variables via `dotenv-load` and add `ansible_extra_args` placeholder for future flexibility. Also include a new `deploy` target that runs the Ansible playbook using the provided hostname, failing politely if `APP_HOSTNAME` is missing.
1 parent 944a9a2 commit 76e1fda

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
APP_HOSTNAME=app.example.com
12
TOKEN="your_token_here"
23
DEBUG=true
34
VALIDATE_LK_URL="https://example.com/validate"

justfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# App - Deployment Justfile
22

3+
set dotenv-load
4+
35
# Variables
46
compose_file := "compose.yaml"
57
compose_prod_file := "compose.prod.yaml"
@@ -8,6 +10,7 @@ image_name := "ctiapp-authproxy"
810
image_tag := "latest"
911
dockerfile := "Dockerfile"
1012
registry := "ghcr.io/nethesis"
13+
ansible_extra_args := ""
1114

1215
# Colors for output
1316
blue := '\033[0;34m'
@@ -231,3 +234,13 @@ nc := '\033[0m'
231234
# Run all pre-deployment checks
232235
@deploy-check: check quadlet-generate ansible-check
233236
printf "{{green}}All checks passed! Ready for deployment.{{nc}}\n"
237+
# Deploy application using Ansible
238+
@deploy:
239+
#!/usr/bin/env bash
240+
printf "{{blue}}Starting deployment...{{nc}}\n"
241+
# Check for APP_HOSTNAME environment variable
242+
if [ -z "$APP_HOSTNAME" ]; then
243+
printf "{{yellow}}APP_HOSTNAME environment variable not set!{{nc}}\n"
244+
exit 1
245+
fi
246+
ansible-playbook -i root@"$APP_HOSTNAME", deploy/deploy.yml -e "traefik_hostname=$APP_HOSTNAME" {{ansible_extra_args}}

0 commit comments

Comments
 (0)