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
69 lines
1.9 KiB
Makefile
69 lines
1.9 KiB
Makefile
# Base path for docker-compose files
|
|
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 --env-file $(ENV_FILE) -f $(COMPOSE_PATH)/$$service/compose.yml up -d; \
|
|
done
|
|
|
|
# Bring down all services
|
|
all_down:
|
|
@for service in $(SERVICES); do \
|
|
docker compose -f $(COMPOSE_PATH)/$$service/compose.yml down; \
|
|
done
|
|
|
|
# Generic target to deploy a specific service
|
|
%_up:
|
|
@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 --env-file $(ENV_FILE) -c $(COMPOSE_PATH)/$$service/compose.yml $$service; \
|
|
done
|
|
|
|
all_stack_down:
|
|
@for service in $(SERVICES); do \
|
|
docker stack rm $$service; \
|
|
done
|
|
|
|
%_stack_up:
|
|
@docker stack deploy --env-file $(ENV_FILE) -c $(COMPOSE_PATH)/$*/compose.yml $*
|
|
|
|
%_stack_down:
|
|
@docker stack rm $*
|
|
|
|
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!"
|