/home/suroeste/public_html/payments.transportessuroeste.com
Edit: /home/suroeste/public_html/payments.transportessuroeste.com/Makefile (6207B)
# ============================================================================
# TRANSPORTES SUROESTE - Makefile
# ============================================================================
# Quick commands for development and deployment
# Usage: make
# ============================================================================
.PHONY: help up down restart build logs shell mysql backup restore clean status
.DEFAULT_GOAL := help
# Colors
GREEN := \033[0;32m
YELLOW := \033[0;33m
CYAN := \033[0;36m
RESET := \033[0m
# ============================================================================
# HELP
# ============================================================================
help: ## Show this help
@echo ""
@echo "$(CYAN)Transportes Suroeste - Payment Gateway$(RESET)"
@echo "$(YELLOW)=======================================$(RESET)"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-18s$(RESET) %s\n", $$1, $$2}'
@echo ""
# ============================================================================
# DEVELOPMENT
# ============================================================================
up: ## Start all containers (development)
docker compose up -d
@echo "$(GREEN)Services started$(RESET)"
@echo " App: http://localhost:$${NGINX_PORT:-8080}"
@echo " phpMyAdmin: http://localhost:$${PMA_PORT:-8081}"
@echo " Health: http://localhost:$${NGINX_PORT:-8080}/api/v1/health"
up-tools: ## Start with dev tools (phpMyAdmin)
docker compose --profile dev-tools up -d
down: ## Stop all containers
docker compose down
restart: ## Restart all containers
docker compose restart
build: ## Build/rebuild containers
docker compose build --no-cache
rebuild: ## Full rebuild (down + build + up)
docker compose down
docker compose build --no-cache
docker compose up -d
# ============================================================================
# PRODUCTION
# ============================================================================
prod-up: ## Start production environment
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
prod-down: ## Stop production environment
docker compose -f docker-compose.yml -f docker-compose.prod.yml down
prod-build: ## Build for production
docker compose -f docker-compose.yml -f docker-compose.prod.yml build --no-cache
# ============================================================================
# LOGS & MONITORING
# ============================================================================
logs: ## Show logs (all services)
docker compose logs -f --tail=100
logs-php: ## Show PHP-FPM logs
docker compose logs -f --tail=100 php
logs-nginx: ## Show Nginx logs
docker compose logs -f --tail=100 nginx
logs-mysql: ## Show MySQL logs
docker compose logs -f --tail=100 mysql
logs-app: ## Show application logs
docker compose exec php tail -f /var/www/html/logs/app.log
status: ## Show container status
docker compose ps
# ============================================================================
# SHELL ACCESS
# ============================================================================
shell: ## Open shell in PHP container
docker compose exec php sh
shell-mysql: ## Open MySQL CLI
docker compose exec mysql mysql -u root -p$(MYSQL_ROOT_PASSWORD) $(DB_NAME)
shell-nginx: ## Open shell in Nginx container
docker compose exec nginx sh
# ============================================================================
# DATABASE
# ============================================================================
mysql: ## Connect to MySQL CLI
docker compose exec mysql mysql -u $${DB_USER:-ts_app} -p$${DB_PASS} $${DB_NAME:-transportes_suroeste_payments}
db-init: ## Initialize database schema
docker compose exec -T mysql mysql -u root -p$${MYSQL_ROOT_PASSWORD} < sql/database.sql
backup: ## Create database backup
@bash scripts/backup.sh
restore: ## Restore database from latest backup
@echo "$(YELLOW)Available backups:$(RESET)"
@ls -la backups/*.sql.gz 2>/dev/null || echo " No backups found"
@echo ""
@echo "Usage: make restore-file FILE=backups/your_backup.sql.gz"
restore-file: ## Restore specific backup (FILE=path/to/backup.sql.gz)
@test -n "$(FILE)" || (echo "$(YELLOW)Usage: make restore-file FILE=backups/backup.sql.gz$(RESET)" && exit 1)
gunzip -c $(FILE) | docker compose exec -T mysql mysql -u root -p$${MYSQL_ROOT_PASSWORD} $${DB_NAME:-transportes_suroeste_payments}
@echo "$(GREEN)Database restored from $(FILE)$(RESET)"
# ============================================================================
# MAINTENANCE
# ============================================================================
clean: ## Remove all containers, volumes, and images
docker compose down -v --rmi local --remove-orphans
@echo "$(GREEN)Cleaned up$(RESET)"
clean-logs: ## Clean application logs
docker compose exec php sh -c 'truncate -s 0 /var/www/html/logs/*.log'
@echo "$(GREEN)Logs cleaned$(RESET)"
composer-install: ## Run composer install
docker compose exec php composer install
composer-update: ## Run composer update
docker compose exec php composer update
# ============================================================================
# TESTING
# ============================================================================
test: ## Run PHPUnit tests
docker compose exec php vendor/bin/phpunit
health: ## Check service health
@curl -sf http://localhost:$${NGINX_PORT:-8080}/api/v1/health | python3 -m json.tool 2>/dev/null || echo "$(YELLOW)Service not available$(RESET)"
# ============================================================================
# SETUP
# ============================================================================
setup: ## Initial project setup
@test -f .env || (cp .env.example .env && echo "$(YELLOW)Created .env from .env.example - please edit with real values$(RESET)")
@mkdir -p logs backups
@echo "$(GREEN)Setup complete. Run 'make up' to start.$(RESET)"