Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Build & Publish Docker Image
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read
Expand Down
106 changes: 92 additions & 14 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,103 @@ For detailed documentation, see: docs/SETUP.md
EOF
}

# Install Docker
install_docker() {
print_info "Installing Docker and Docker Compose..."

# Detect operating system
if [ -f /etc/os-release ]; then
. /etc/os-release
if [[ "$ID" != "ubuntu" && "$ID" != "debian" ]]; then
print_error "Unsupported operating system: $ID. This script supports only Ubuntu/Debian-based systems."
exit 1
fi
else
print_error "Unable to detect operating system. This script supports only Ubuntu/Debian-based systems."
exit 1
fi

# Update package index
sudo apt-get update

# Install required packages
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release

# Add Docker's official GPG key
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Comment on lines +93 to +94
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downloading and executing content from the internet without verification poses a security risk. Consider adding checksum verification or using package manager alternatives when available.

Suggested change
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
print_info "Downloading Docker's GPG key..."
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /tmp/docker.gpg
print_info "Verifying Docker's GPG key fingerprint..."
EXPECTED_FINGERPRINT="9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88"
DOWNLOADED_FINGERPRINT=$(gpg --with-fingerprint /tmp/docker.gpg | grep -A1 "pub" | tail -n1 | awk '{print $1, $2, $3, $4, $5, $6, $7, $8, $9, $10}')
if [ "$DOWNLOADED_FINGERPRINT" != "$EXPECTED_FINGERPRINT" ]; then
print_error "Docker's GPG key fingerprint verification failed!"
exit 1
fi
print_success "Docker's GPG key fingerprint verified successfully!"
sudo mkdir -m 0755 -p /etc/apt/keyrings
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg /tmp/docker.gpg

Copilot uses AI. Check for mistakes.
# Set up the repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Update package index with Docker packages
sudo apt-get update

# Install Docker Engine and Docker Compose
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Add current user to docker group
sudo usermod -aG docker $USER

print_success "Docker and Docker Compose installed successfully!"
print_warning "Please log out and log back in for group changes to take effect."
print_info "Or run: newgrp docker"
}

# Check prerequisites
check_prerequisites() {
print_info "Checking prerequisites..."

# Check Docker
if ! command -v docker &> /dev/null; then
print_error "Docker is not installed. Please install Docker Desktop."
exit 1
print_warning "Docker is not installed."
echo -n "Would you like to install Docker and Docker Compose automatically? (y/N): "
read -r response
if [[ "$response" =~ ^[Yy]$ ]]; then
install_docker
print_info "Please restart your terminal session and run the script again."
exit 0
else
print_error "Docker is required. Please install Docker Desktop manually."
exit 1
fi
fi

# Check Docker Compose
if ! command -v docker-compose &> /dev/null; then
print_error "Docker Compose is not installed. Please install Docker Compose."
exit 1
if ! command -v docker compose &> /dev/null; then
print_warning "Docker Compose is not installed."
echo -n "Would you like to install Docker Compose automatically? (y/N): "
read -r response
if [[ "$response" =~ ^[Yy]$ ]]; then
# Install Docker Compose plugin
sudo apt-get update
sudo apt-get install -y docker-compose-plugin
print_success "Docker Compose installed successfully!"
else
print_error "Docker Compose is required. Please install Docker Compose manually."
exit 1
fi
fi

# Check Git (optional but recommended)
if ! command -v git &> /dev/null; then
print_warning "Git is not installed. Some features may not work optimally."
echo -n "Would you like to install Git? (y/N): "
read -r response
if [[ "$response" =~ ^[Yy]$ ]]; then
print_info "Installing Git..."
sudo apt-get update
sudo apt-get install -y git
print_success "Git installed successfully!"
else
print_info "Continuing without Git. Some features may be limited."
fi
fi

print_success "Prerequisites check completed"
Expand Down Expand Up @@ -108,7 +186,7 @@ EOF
print_info "Starting development services..."

# Start development services
docker-compose up -d
docker compose up -d

print_success "Development environment is running!"
echo ""
Expand Down Expand Up @@ -154,7 +232,7 @@ EOF
print_info "Starting production services..."

# Start production services with HTTPS by default
docker-compose -f docker-compose.prod.yml up -d
docker compose -f docker compose.prod.yml up -d
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid syntax: the command should be 'docker compose -f docker-compose.prod.yml up -d' with hyphens in the filename, not 'docker compose -f docker compose.prod.yml'.

Suggested change
docker compose -f docker compose.prod.yml up -d
docker compose -f docker-compose.prod.yml up -d

Copilot uses AI. Check for mistakes.

print_success "Standard production environment is running!"
show_access_info
Expand Down Expand Up @@ -189,10 +267,10 @@ GPU_WORKERS=1
EOF

print_info "Downloading AI models..."
docker-compose -f docker-compose.yml -f docker-compose.genai.yml --profile setup run --rm model-downloader
docker compose -f docker compose.yml -f docker compose.genai.yml --profile setup run --rm model-downloader

print_info "Starting GenAI services..."
docker-compose -f docker-compose.yml -f docker-compose.genai.yml up -d
docker compose -f docker compose.yml -f docker compose.genai.yml up -d
Comment on lines +270 to +273
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid syntax: the filenames should use hyphens, not spaces. Should be 'docker compose -f docker-compose.yml -f docker-compose.genai.yml --profile setup run --rm model-downloader'.

Copilot uses AI. Check for mistakes.
Comment on lines +270 to +273
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid syntax: the filenames should use hyphens, not spaces. Should be 'docker compose -f docker-compose.yml -f docker-compose.genai.yml up -d'.

Copilot uses AI. Check for mistakes.

print_success "GenAI environment is running!"
show_access_info
Expand Down Expand Up @@ -244,7 +322,7 @@ setup_standard_https() {
./scripts/enhanced-ssl-manager.sh setup-prod "$DOMAIN_NAME" "$CERTBOT_EMAIL"

print_info "Restarting services with Let's Encrypt..."
docker-compose -f docker-compose.prod.yml restart traefik
docker compose -f docker compose.prod.yml restart traefik

print_success "HTTPS environment with Let's Encrypt is running!"
}
Expand All @@ -266,8 +344,8 @@ setup_genai_https() {
./scripts/enhanced-ssl-manager.sh setup-prod "$DOMAIN_NAME" "$CERTBOT_EMAIL"

print_info "Restarting services with Let's Encrypt..."
docker-compose -f docker-compose.yml -f docker-compose.genai.yml down
docker-compose -f docker-compose.prod.yml --profile genai up -d
docker compose -f docker compose.yml -f docker compose.genai.yml down
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid syntax: the filenames should use hyphens, not spaces. Should be 'docker compose -f docker-compose.yml -f docker-compose.genai.yml down'.

Suggested change
docker compose -f docker compose.yml -f docker compose.genai.yml down
docker compose -f docker-compose.yml -f docker-compose.genai.yml down

Copilot uses AI. Check for mistakes.
docker compose -f docker compose.prod.yml --profile genai up -d

print_success "GenAI + HTTPS environment with Let's Encrypt is running!"
}
Expand All @@ -287,7 +365,7 @@ show_access_info() {
print_info "Management Commands:"
print_info "• Check status: ${CYAN}./setup.sh --status${NC}"
print_info "• Validate: ${CYAN}./setup.sh --validate${NC}"
print_info "• View logs: ${CYAN}docker-compose logs -f${NC}"
print_info "• View logs: ${CYAN}docker compose logs -f${NC}"
echo ""
}

Expand All @@ -300,7 +378,7 @@ validate_deployment() {
# Show deployment status
show_status() {
print_info "Deployment Status:"
docker-compose ps
docker compose ps

echo ""
print_info "Service Health:"
Expand Down