Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit bd240c7

Browse files
committed
feat: [#28] Phase 1 foundation - rename 'local' environment to 'development'
- Rename local.defaults → development.defaults for consistency - Update all script references from 'local' to 'development' environment - Update Makefile default ENVIRONMENT from 'local' to 'development' - Update function names: setup_local_environment → setup_development_environment - Update help text and documentation references - E2e tests pass: Complete twelve-factor deployment workflow validated This establishes the foundation for multi-provider architecture by eliminating confusion between environment names and provider concepts. Environment 'development' clearly indicates configuration type, while providers (libvirt, hetzner, etc.) indicate deployment target. Phase 1 foundation completed successfully - ready for provider interface implementation.
1 parent c1f5b73 commit bd240c7

File tree

7 files changed

+41
-41
lines changed

7 files changed

+41
-41
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# Default variables
1212
VM_NAME ?= torrust-tracker-demo
13-
ENVIRONMENT ?= local
13+
ENVIRONMENT ?= development
1414
TERRAFORM_DIR = infrastructure/terraform
1515
INFRA_TESTS_DIR = infrastructure/tests
1616
TESTS_DIR = tests
@@ -44,9 +44,9 @@ help: ## Show this help message
4444
@awk 'BEGIN {FS = ":.*?## "} /^(install-deps|clean).*:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
4545
@echo ""
4646
@echo "Examples:"
47-
@echo " make dev-deploy ENVIRONMENT=local"
48-
@echo " make infra-apply ENVIRONMENT=local"
49-
@echo " make app-deploy ENVIRONMENT=local"
47+
@echo " make dev-deploy ENVIRONMENT=development"
48+
@echo " make infra-apply ENVIRONMENT=development"
49+
@echo " make app-deploy ENVIRONMENT=development"
5050

5151
install-deps: ## Install required dependencies (Ubuntu/Debian)
5252
@echo "Installing dependencies..."

infrastructure/config/environments/local.defaults renamed to infrastructure/config/environments/development.defaults

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Local Development Environment Default Values
2-
# These values are used to generate local.env from the base template
1+
# Development Environment Default Values
2+
# These values are used to generate development.env from the base template
33
# Safe default values for local development and testing
44

5-
ENVIRONMENT_DESCRIPTION="Local Development Environment Configuration"
6-
ENVIRONMENT_INSTRUCTIONS="Generated from base template for local development and testing"
7-
ENVIRONMENT="local"
5+
ENVIRONMENT_DESCRIPTION="Development Environment Configuration"
6+
ENVIRONMENT_INSTRUCTIONS="Generated from base template for development and testing"
7+
ENVIRONMENT="development"
88
TEMPLATE_PROCESSING_VARS="
99
# Template processing variables
1010
DOLLAR=\$"

infrastructure/scripts/configure-env.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ CONFIG_DIR="${PROJECT_ROOT}/infrastructure/config"
1414
source "${PROJECT_ROOT}/scripts/shell-utils.sh"
1515

1616
# Default values
17-
ENVIRONMENT="${1:-local}"
17+
ENVIRONMENT="${1:-development}"
1818
VERBOSE="${VERBOSE:-false}"
1919

2020
# Source shared shell utilities
@@ -36,8 +36,8 @@ generate_environment_config() {
3636

3737
# Generate environment-specific variables
3838
case "${environment}" in
39-
"local")
40-
generate_local_config "${base_template}" "${env_file}"
39+
"development")
40+
generate_development_config "${base_template}" "${env_file}"
4141
;;
4242
"production")
4343
generate_production_config "${base_template}" "${env_file}"
@@ -51,18 +51,18 @@ generate_environment_config() {
5151
log_success "${environment^} environment file generated: ${env_file}"
5252
}
5353

54-
# Generate local development configuration
55-
generate_local_config() {
54+
# Generate development configuration
55+
generate_development_config() {
5656
local template_file="$1"
5757
local output_file="$2"
58-
local defaults_file="${CONFIG_DIR}/environments/local.defaults"
58+
local defaults_file="${CONFIG_DIR}/environments/development.defaults"
5959

6060
if [[ ! -f "${defaults_file}" ]]; then
61-
log_error "Local defaults file not found: ${defaults_file}"
61+
log_error "Development defaults file not found: ${defaults_file}"
6262
exit 1
6363
fi
6464

65-
log_info "Loading local environment defaults from: ${defaults_file}"
65+
log_info "Loading development environment defaults from: ${defaults_file}"
6666

6767
# Export all variables from defaults file for envsubst
6868
set -a # automatically export all variables
@@ -108,13 +108,13 @@ generate_production_config() {
108108
log_warning "File location: ${output_file}"
109109
}
110110

111-
# Setup local environment from base template
112-
setup_local_environment() {
113-
local env_file="${CONFIG_DIR}/environments/local.env"
111+
# Setup development environment from base template
112+
setup_development_environment() {
113+
local env_file="${CONFIG_DIR}/environments/development.env"
114114

115-
# Always regenerate local.env from base template for consistency
116-
generate_environment_config "local"
117-
log_success "Local environment file created from base template: ${env_file}"
115+
# Always regenerate development.env from base template for consistency
116+
generate_environment_config "development"
117+
log_success "Development environment file created from base template: ${env_file}"
118118
}
119119

120120
# Setup production environment from base template
@@ -140,8 +140,8 @@ load_environment() {
140140
# Special handling for template-based environments
141141
if [[ "${ENVIRONMENT}" == "production" ]]; then
142142
setup_production_environment
143-
elif [[ "${ENVIRONMENT}" == "local" ]]; then
144-
setup_local_environment
143+
elif [[ "${ENVIRONMENT}" == "development" ]]; then
144+
setup_development_environment
145145
fi
146146

147147
if [[ ! -f "${env_file}" ]]; then
@@ -360,14 +360,14 @@ Configuration Processing Script
360360
Usage: $0 [ENVIRONMENT|COMMAND]
361361
362362
Arguments:
363-
ENVIRONMENT Environment name (local, production)
363+
ENVIRONMENT Environment name (development, production)
364364
generate-secrets Generate secure secrets for production
365365
366366
Commands:
367367
generate-secrets Generate secure random secrets and show configuration guidance
368368
369369
Examples:
370-
$0 local # Process local environment configuration
370+
$0 development # Process development environment configuration
371371
$0 production # Process production environment configuration (requires configured secrets)
372372
$0 generate-secrets # Generate secure secrets for production setup
373373

infrastructure/scripts/deploy-app.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
1111
TERRAFORM_DIR="${PROJECT_ROOT}/infrastructure/terraform"
1212

1313
# Default values
14-
ENVIRONMENT="${1:-local}"
14+
ENVIRONMENT="${1:-development}"
1515
VM_IP="${2:-}"
1616
SKIP_HEALTH_CHECK="${SKIP_HEALTH_CHECK:-false}"
1717
SKIP_WAIT="${SKIP_WAIT:-false}" # New parameter for skipping waiting
@@ -62,7 +62,7 @@ check_git_status() {
6262

6363
# Determine deployment approach based on environment
6464
local deployment_approach
65-
if [[ "${ENVIRONMENT}" == "local" ]]; then
65+
if [[ "${ENVIRONMENT}" == "development" ]]; then
6666
deployment_approach="working tree (includes uncommitted changes)"
6767
else
6868
deployment_approach="git archive (committed changes only)"
@@ -82,8 +82,8 @@ check_git_status() {
8282
done
8383
log_warning ""
8484

85-
if [[ "${ENVIRONMENT}" == "local" ]]; then
86-
log_info "ℹ️ LOCAL TESTING: Uncommitted changes WILL be deployed (using working tree)"
85+
if [[ "${ENVIRONMENT}" == "development" ]]; then
86+
log_info "ℹ️ DEVELOPMENT TESTING: Uncommitted changes WILL be deployed (using working tree)"
8787
log_info "This includes your configuration changes and any other uncommitted modifications."
8888
else
8989
log_warning "IMPORTANT: Production deployment uses 'git archive' which only includes committed files."
@@ -544,7 +544,7 @@ release_stage() {
544544
log_info "Deploying application with environment: ${ENVIRONMENT}"
545545

546546
# Choose deployment method based on environment
547-
if [[ "${ENVIRONMENT}" == "local" ]]; then
547+
if [[ "${ENVIRONMENT}" == "development" ]]; then
548548
deploy_local_working_tree "${vm_ip}"
549549
else
550550
deploy_git_archive "${vm_ip}"
@@ -1062,7 +1062,7 @@ Application Deployment Script (Twelve-Factor Release + Run Stages)
10621062
Usage: $0 [ENVIRONMENT] [VM_IP]
10631063
10641064
Arguments:
1065-
ENVIRONMENT Environment name (local, production)
1065+
ENVIRONMENT Environment name (development, production)
10661066
VM_IP VM IP address (optional, will get from Terraform if not provided)
10671067
10681068
Environment Variables:

infrastructure/scripts/health-check.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
1111
TERRAFORM_DIR="${PROJECT_ROOT}/infrastructure/terraform"
1212

1313
# Default values
14-
ENVIRONMENT="${1:-local}"
14+
ENVIRONMENT="${1:-development}"
1515
VM_IP="${2:-}"
1616
VERBOSE="${VERBOSE:-false}"
1717

@@ -216,7 +216,7 @@ test_storage() {
216216
fi
217217

218218
# Test database connectivity (MySQL)
219-
if [[ "${ENVIRONMENT}" == "local" ]]; then
219+
if [[ "${ENVIRONMENT}" == "development" ]]; then
220220
((TOTAL_TESTS++))
221221
if vm_exec "${vm_ip}" "cd /home/torrust/github/torrust/torrust-tracker-demo/application && docker compose exec mysql mysqladmin ping -h localhost --silent"; then
222222
log_test_pass "MySQL database connectivity"
@@ -324,7 +324,7 @@ Health Check Script for Torrust Tracker Demo
324324
Usage: $0 [ENVIRONMENT] [VM_IP]
325325
326326
Arguments:
327-
ENVIRONMENT Environment name (local, production)
327+
ENVIRONMENT Environment name (development, production)
328328
VM_IP VM IP address (optional, will get from Terraform if not provided)
329329
330330
Environment Variables:

infrastructure/scripts/provision-infrastructure.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
1111
TERRAFORM_DIR="${PROJECT_ROOT}/infrastructure/terraform"
1212

1313
# Default values
14-
ENVIRONMENT="${1:-local}"
14+
ENVIRONMENT="${1:-development}"
1515
ACTION="${2:-apply}"
1616
SKIP_WAIT="${SKIP_WAIT:-false}" # New parameter for skipping waiting
1717
SKIP_WAIT="${SKIP_WAIT:-false}" # New parameter for skipping waiting
@@ -49,7 +49,7 @@ validate_prerequisites() {
4949
fi
5050

5151
# Check if libvirt is available (for local environment)
52-
if [[ "${ENVIRONMENT}" == "local" ]]; then
52+
if [[ "${ENVIRONMENT}" == "development" ]]; then
5353
if ! command -v virsh >/dev/null 2>&1; then
5454
log_error "virsh not found. Please install libvirt-clients."
5555
exit 1
@@ -190,7 +190,7 @@ Infrastructure Provisioning Script (Twelve-Factor Build Stage)
190190
Usage: $0 [ENVIRONMENT] [ACTION]
191191
192192
Arguments:
193-
ENVIRONMENT Environment name (local, production)
193+
ENVIRONMENT Environment name (development, production)
194194
ACTION Action to perform (init, plan, apply, destroy)
195195
196196
Examples:

infrastructure/scripts/validate-config.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1313
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
1414

1515
# Default values
16-
ENVIRONMENT="${1:-local}"
16+
ENVIRONMENT="${1:-development}"
1717
VERBOSE="${VERBOSE:-false}"
1818

1919
# Source shared shell utilities
@@ -301,7 +301,7 @@ Configuration Validation Script
301301
Usage: $0 [ENVIRONMENT]
302302
303303
Arguments:
304-
ENVIRONMENT Environment name (local, production)
304+
ENVIRONMENT Environment name (development, production)
305305
306306
Examples:
307307
$0 local # Validate local environment configuration

0 commit comments

Comments
 (0)