updated docker compose files
This commit is contained in:
93
Makefile
Normal file
93
Makefile
Normal file
@@ -0,0 +1,93 @@
|
||||
.PHONY: help build up down restart logs logs-web logs-db clean reset shell shell-db status health
|
||||
|
||||
help: ## Show this help message
|
||||
@echo "Recticel Quality Application - Docker Commands"
|
||||
@echo ""
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
build: ## Build the Docker images
|
||||
docker-compose build
|
||||
|
||||
up: ## Start all services
|
||||
docker-compose up -d
|
||||
@echo "✅ Services started. Access the app at http://localhost:8781"
|
||||
@echo "Default login: superadmin / superadmin123"
|
||||
|
||||
down: ## Stop all services
|
||||
docker-compose down
|
||||
|
||||
restart: ## Restart all services
|
||||
docker-compose restart
|
||||
|
||||
logs: ## View logs from all services
|
||||
docker-compose logs -f
|
||||
|
||||
logs-web: ## View logs from web application
|
||||
docker-compose logs -f web
|
||||
|
||||
logs-db: ## View logs from database
|
||||
docker-compose logs -f db
|
||||
|
||||
status: ## Show status of all services
|
||||
docker-compose ps
|
||||
|
||||
health: ## Check health of services
|
||||
@echo "=== Service Health Status ==="
|
||||
@docker inspect recticel-app | grep -A 5 '"Health"' || echo "Web app: Running"
|
||||
@docker inspect recticel-db | grep -A 5 '"Health"' || echo "Database: Running"
|
||||
|
||||
shell: ## Open shell in web application container
|
||||
docker-compose exec web bash
|
||||
|
||||
shell-db: ## Open MariaDB console
|
||||
docker-compose exec db mariadb -u trasabilitate -p trasabilitate
|
||||
|
||||
clean: ## Stop services and remove containers (keeps data)
|
||||
docker-compose down
|
||||
|
||||
reset: ## Complete reset - removes all data including database
|
||||
@echo "⚠️ WARNING: This will delete all data!"
|
||||
@read -p "Are you sure? [y/N] " -n 1 -r; \
|
||||
echo; \
|
||||
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
|
||||
docker-compose down -v; \
|
||||
rm -rf logs/*; \
|
||||
rm -f instance/external_server.conf; \
|
||||
echo "✅ Reset complete"; \
|
||||
fi
|
||||
|
||||
deploy: build up ## Build and deploy (fresh start)
|
||||
@echo "✅ Deployment complete!"
|
||||
@sleep 5
|
||||
@make status
|
||||
|
||||
rebuild: ## Rebuild and restart web application
|
||||
docker-compose up -d --build web
|
||||
|
||||
backup-db: ## Backup database to backup.sql
|
||||
docker-compose exec -T db mariadb-dump -u trasabilitate -pInitial01! trasabilitate > backup_$(shell date +%Y%m%d_%H%M%S).sql
|
||||
@echo "✅ Database backed up"
|
||||
|
||||
restore-db: ## Restore database from backup.sql (provide BACKUP=filename)
|
||||
@if [ -z "$(BACKUP)" ]; then \
|
||||
echo "❌ Usage: make restore-db BACKUP=backup_20231215_120000.sql"; \
|
||||
exit 1; \
|
||||
fi
|
||||
docker-compose exec -T db mariadb -u trasabilitate -pInitial01! trasabilitate < $(BACKUP)
|
||||
@echo "✅ Database restored from $(BACKUP)"
|
||||
|
||||
install: ## Initial installation and setup
|
||||
@echo "=== Installing Recticel Quality Application ==="
|
||||
@if [ ! -f .env ]; then \
|
||||
cp .env.example .env; \
|
||||
echo "✅ Created .env file"; \
|
||||
fi
|
||||
@mkdir -p logs instance
|
||||
@echo "✅ Created directories"
|
||||
@make deploy
|
||||
@echo ""
|
||||
@echo "=== Installation Complete ==="
|
||||
@echo "Access the application at: http://localhost:8781"
|
||||
@echo "Default login: superadmin / superadmin123"
|
||||
@echo ""
|
||||
@echo "⚠️ Remember to change the default passwords!"
|
||||
Reference in New Issue
Block a user