#!/bin/bash # Complete Artifactory Setup with Authentication # This script sets up the full artifactory stack with Chart Museum authentication set -e echo "๐Ÿš€ Setting up Complete Artifactory Stack with Authentication..." echo "" # Build the Arti-API container echo "๐Ÿ“ฆ Building Arti-API container..." docker build -t arti-api:latest . # Start the complete stack echo "๐Ÿ”ง Starting the complete artifactory stack..." docker-compose -f docker-compose-full.yaml up -d # Wait for services to be ready echo "โณ Waiting for services to start..." sleep 15 # Create initial users echo "๐Ÿ‘ฅ Creating initial users..." # Check if Arti-API is ready until curl -s http://localhost:8000/health > /dev/null; do echo " Waiting for Arti-API to be ready..." sleep 5 done # Create admin user echo " Creating admin user..." curl -s -X POST "http://localhost:8000/users" \ -H "Content-Type: application/json" \ -d '{"username": "admin", "password": "admin123"}' > /dev/null # Create developer user echo " Creating developer user..." curl -s -X POST "http://localhost:8000/users" \ -H "Content-Type: application/json" \ -d '{"username": "developer", "password": "dev123"}' > /dev/null # Create readonly user echo " Creating readonly user..." curl -s -X POST "http://localhost:8000/users" \ -H "Content-Type: application/json" \ -d '{"username": "readonly", "password": "read123"}' > /dev/null echo "" echo "โœ… Artifactory stack setup complete!" echo "" echo "๐ŸŒ Services Available:" echo " ๐Ÿ“– Arti-API (Management): http://localhost:8000" echo " ๐Ÿ“š API Documentation: http://localhost:8000/docs" echo " โ›ต Chart Museum: http://localhost:8080" echo " ๐Ÿณ Docker Registry: http://localhost:5000" echo "" echo "๐Ÿ” Default Users Created:" echo " ๐Ÿ‘‘ admin:admin123 (Full access)" echo " ๐Ÿ‘จโ€๐Ÿ’ป developer:dev123 (Development access)" echo " ๐Ÿ‘€ readonly:read123 (Read-only access)" echo "" echo "๐Ÿงช Test Commands:" echo "" echo " # Test Chart Museum with authentication:" echo " curl -u admin:admin123 http://localhost:8080/api/charts" echo "" echo " # Test Docker Registry with authentication:" echo " docker login localhost:5000" echo " # Username: admin, Password: admin123" echo "" echo " # Add Helm repository with authentication:" echo " helm repo add myrepo http://admin:admin123@localhost:8080" echo "" echo " # List users via API:" echo " curl http://localhost:8000/users" echo "" echo "๐Ÿ“‹ Management:" echo " # Stop all services:" echo " docker-compose -f docker-compose-full.yaml down" echo "" echo " # View logs:" echo " docker-compose -f docker-compose-full.yaml logs -f" echo "" echo " # Manage users via API:" echo " curl -X POST http://localhost:8000/users -H 'Content-Type: application/json' -d '{\"username\": \"newuser\", \"password\": \"newpass\"}'" echo "" echo "๐ŸŽ‰ Your authenticated artifactory is ready!"