refactor: use $DOMAIN env var instead of hardcoded lazyworkhorse.net
Replace all hardcoded lazyworkhorse.net references in compose files
with ${DOMAIN} variable substitution. Create .env.production and
.env.staging environment files. Update Makefile with ENV selection
(--env-file support) and staging/production targets.
Changes:
- All 13 compose YAML files: lazyworkhorse.net -> ${DOMAIN}
- New .env.production (DOMAIN=lazyworkhorse.net)
- New .env.staging (DOMAIN=staging.lazyworkhorse.net)
- Makefile: ENV var, --env-file flag, staging/production targets
- Gitea redirect regex updated for variable substitution
- CI workflow checkout URLs left hardcoded (infrastructure refs)
- Dockerfile SSH host refs left hardcoded (infrastructure refs)
Deploy: make ENV=staging all_up or make staging
make ENV=production all_up or make production
This commit is contained in:
33
Makefile
33
Makefile
@@ -1,13 +1,18 @@
|
||||
# Base path for docker-compose files
|
||||
COMPOSE_PATH=~/Projects/AltNet/docker-compose
|
||||
COMPOSE_PATH?=~/Projects/AltNet/docker-compose
|
||||
|
||||
# Environment selection: staging or production (default)
|
||||
ENV?=production
|
||||
ENV_FILE=.env.$(ENV)
|
||||
|
||||
# List of services (folder names)
|
||||
SERVICES=monitoring ai cloudstorage crm_tp crm_cf mediacenter homeautomation network backup homepage passwordmanager
|
||||
|
||||
# Bring up all services
|
||||
all_up:
|
||||
@echo "Deploying with $(ENV) environment ($(ENV_FILE))..."
|
||||
@for service in $(SERVICES); do \
|
||||
docker compose -f $(COMPOSE_PATH)/$$service/compose.yml up -d; \
|
||||
docker compose --env-file $(ENV_FILE) -f $(COMPOSE_PATH)/$$service/compose.yml up -d; \
|
||||
done
|
||||
|
||||
# Bring down all services
|
||||
@@ -18,15 +23,27 @@ all_down:
|
||||
|
||||
# Generic target to deploy a specific service
|
||||
%_up:
|
||||
@docker compose -f $(COMPOSE_PATH)/$*/compose.yml up -d
|
||||
@echo "Deploying $* with $(ENV) environment ($(ENV_FILE))..."
|
||||
@docker compose --env-file $(ENV_FILE) -f $(COMPOSE_PATH)/$*/compose.yml up -d
|
||||
|
||||
# Generic target to bring down a specific service
|
||||
%_down:
|
||||
@docker compose -f $(COMPOSE_PATH)/$*/compose.yml down
|
||||
|
||||
# Deploy staging (all services)
|
||||
staging:
|
||||
@$(MAKE) all_up ENV=staging
|
||||
|
||||
# Deploy production (all services)
|
||||
production:
|
||||
@$(MAKE) all_up ENV=production
|
||||
|
||||
# Staging per-service: make openwebui_up ENV=staging
|
||||
# Production per-service: make openwebui_up ENV=production
|
||||
|
||||
all_stack_up:
|
||||
@for service in $(SERVICES); do \
|
||||
docker stack deploy -c $(COMPOSE_PATH)/$$service/compose.yml $$service; \
|
||||
docker stack deploy --env-file $(ENV_FILE) -c $(COMPOSE_PATH)/$$service/compose.yml $$service; \
|
||||
done
|
||||
|
||||
all_stack_down:
|
||||
@@ -35,7 +52,7 @@ all_stack_down:
|
||||
done
|
||||
|
||||
%_stack_up:
|
||||
@docker stack deploy -c $(COMPOSE_PATH)/$*/compose.yml $*
|
||||
@docker stack deploy --env-file $(ENV_FILE) -c $(COMPOSE_PATH)/$*/compose.yml $*
|
||||
|
||||
%_stack_down:
|
||||
@docker stack rm $*
|
||||
@@ -43,3 +60,9 @@ all_stack_down:
|
||||
stack_ls:
|
||||
@docker node ps workGoat;
|
||||
docker node ps workHorse
|
||||
|
||||
# Show current environment settings
|
||||
env:
|
||||
@echo "Active environment: $(ENV)"
|
||||
@echo "Env file: $(ENV_FILE)"
|
||||
@test -f $(ENV_FILE) && cat $(ENV_FILE) || echo "WARNING: $(ENV_FILE) not found!"
|
||||
|
||||
Reference in New Issue
Block a user