Add complete frontend implementation and Docker deployment setup
- Implement React frontend with TypeScript and Tailwind CSS - Add scrappbook.de-inspired UI design with photo galleries - Implement authentication, photo viewing, and download features - Add Docker Swarm configuration with Traefik reverse proxy - Set up Drone CI/CD pipeline for automated deployments - Add monitoring stack with Prometheus and Grafana - Create comprehensive deployment documentation - Add simple local development setup with docker-compose.local.yml Features: - Password-protected galleries with expiration warnings - Responsive photo grid with lightbox viewer - Bulk download functionality - Hot reload development environment - Email testing with Mailhog - Production-ready deployment scripts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
This commit is contained in:
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${GREEN}Docker Swarm Initialization Script${NC}"
|
||||
echo "======================================"
|
||||
|
||||
# Check if running as root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo -e "${RED}This script must be run as root${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Docker is installed
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo -e "${RED}Docker is not installed. Please install Docker first.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if already in swarm mode
|
||||
if docker info | grep -q "Swarm: active"; then
|
||||
echo -e "${YELLOW}This node is already part of a swarm.${NC}"
|
||||
docker node ls
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Initialize swarm
|
||||
echo -e "${GREEN}Initializing Docker Swarm...${NC}"
|
||||
ADVERTISE_ADDR=${1:-$(hostname -I | awk '{print $1}')}
|
||||
docker swarm init --advertise-addr $ADVERTISE_ADDR
|
||||
|
||||
# Create overlay networks
|
||||
echo -e "${GREEN}Creating overlay networks...${NC}"
|
||||
docker network create --driver overlay --attachable traefik-public || true
|
||||
docker network create --driver overlay --attachable monitoring || true
|
||||
|
||||
# Label the node
|
||||
echo -e "${GREEN}Labeling manager node...${NC}"
|
||||
NODE_ID=$(docker info -f '{{.Swarm.NodeID}}')
|
||||
docker node update --label-add db=true $NODE_ID
|
||||
docker node update --label-add monitoring=true $NODE_ID
|
||||
|
||||
# Create required directories
|
||||
echo -e "${GREEN}Creating required directories...${NC}"
|
||||
mkdir -p /opt/photo-sharing/{storage,data,logs,backup}
|
||||
mkdir -p /opt/traefik/letsencrypt
|
||||
mkdir -p /opt/monitoring/{prometheus,grafana,loki}
|
||||
|
||||
# Set permissions
|
||||
chown -R 1000:1000 /opt/photo-sharing
|
||||
chmod -R 755 /opt/photo-sharing
|
||||
|
||||
echo -e "${GREEN}Swarm initialization complete!${NC}"
|
||||
echo ""
|
||||
echo "Manager join token:"
|
||||
docker swarm join-token manager
|
||||
echo ""
|
||||
echo "Worker join token:"
|
||||
docker swarm join-token worker
|
||||
echo ""
|
||||
echo -e "${GREEN}Next steps:${NC}"
|
||||
echo "1. Join worker nodes using the token above"
|
||||
echo "2. Create secrets using create-secrets.sh"
|
||||
echo "3. Deploy Traefik using deploy-traefik.sh"
|
||||
echo "4. Deploy the application stack using deploy.sh"
|
||||
Reference in New Issue
Block a user