Files
quality_app/setup-volumes.sh

108 lines
3.6 KiB
Bash
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# ============================================================================
# Volume Setup Script for Quality Application
# Creates all necessary directories for Docker volume mapping
# ============================================================================
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Logging functions
log_info() {
echo -e "${BLUE} INFO:${NC} $*"
}
log_success() {
echo -e "${GREEN}✅ SUCCESS:${NC} $*"
}
log_warning() {
echo -e "${YELLOW}⚠️ WARNING:${NC} $*"
}
log_error() {
echo -e "${RED}❌ ERROR:${NC} $*" >&2
}
# ============================================================================
# Main Setup Function
# ============================================================================
main() {
echo "============================================================================"
echo "🚀 Quality Application - Volume Setup"
echo "============================================================================"
echo ""
# Check if we're in the right directory
if [ ! -f "docker-compose.yml" ]; then
log_error "docker-compose.yml not found. Please run this script from the application root directory."
exit 1
fi
log_info "Creating directory structure for Docker volumes..."
echo ""
# Create directories
log_info "Creating data/mariadb directory (database files)..."
mkdir -p data/mariadb
log_info "Creating config/instance directory (app configuration)..."
mkdir -p config/instance
log_info "Creating logs directory (application logs)..."
mkdir -p logs
log_info "Creating backups directory (database backups)..."
mkdir -p backups
echo ""
log_success "All directories created successfully!"
echo ""
# Display directory structure
echo "============================================================================"
echo "📁 Volume Directory Structure:"
echo "============================================================================"
echo " ./data/mariadb/ - MariaDB database files (persistent data)"
echo " ./config/instance/ - Application configuration files"
echo " ./logs/ - Application and Gunicorn logs"
echo " ./backups/ - Database backup files"
echo "============================================================================"
echo ""
# Check for .env file
if [ ! -f ".env" ]; then
log_warning ".env file not found!"
echo ""
echo "Next steps:"
echo " 1. Copy .env.example to .env: cp .env.example .env"
echo " 2. Edit .env with your settings: nano .env"
echo " 3. Change passwords and SECRET_KEY (CRITICAL for production!)"
echo " 4. Set INIT_DB=true for first deployment"
echo " 5. Build and start: docker-compose up -d --build"
else
log_success ".env file found!"
echo ""
echo "Next steps:"
echo " 1. Review .env settings: nano .env"
echo " 2. Change passwords if needed (especially for production)"
echo " 3. Set INIT_DB=true for first deployment"
echo " 4. Build and start: docker-compose up -d --build"
fi
echo ""
echo "============================================================================"
log_success "Setup complete! You can now deploy the application."
echo "============================================================================"
}
# Run main function
main "$@"