-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-setup.sh
More file actions
executable file
·75 lines (66 loc) · 2.21 KB
/
Copy pathdocker-setup.sh
File metadata and controls
executable file
·75 lines (66 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
#
# Quick setup script for embapi Docker deployment
#
# This script helps you quickly set up environment variables for Docker deployment.
#
set -e
echo "====================================="
echo "embapi Docker Quick Setup"
echo "====================================="
echo ""
# Check if .env already exists
if [ -f .env ]; then
echo "Warning: .env file already exists."
read -p "Do you want to overwrite it? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Setup cancelled. Exiting."
exit 0
fi
fi
# Copy template
cp .env.docker.template .env
echo "✓ Created .env file from template"
# Generate secure keys
echo ""
echo "Generating secure keys..."
# Check if openssl is available
if command -v openssl &> /dev/null; then
ADMIN_KEY=$(openssl rand -base64 32)
ENCRYPTION_KEY=$(openssl rand -hex 32)
# Update .env file with generated keys
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sed -i '' "s/SERVICE_ADMINKEY=.*/SERVICE_ADMINKEY=$ADMIN_KEY/" .env
sed -i '' "s/ENCRYPTION_KEY=.*/ENCRYPTION_KEY=$ENCRYPTION_KEY/" .env
sed -i '' "s/SERVICE_DBPASSWORD=.*/SERVICE_DBPASSWORD=$(openssl rand -base64 16)/" .env
else
# Linux
sed -i "s/SERVICE_ADMINKEY=.*/SERVICE_ADMINKEY=$ADMIN_KEY/" .env
sed -i "s/ENCRYPTION_KEY=.*/ENCRYPTION_KEY=$ENCRYPTION_KEY/" .env
sed -i "s/SERVICE_DBPASSWORD=.*/SERVICE_DBPASSWORD=$(openssl rand -base64 16)/" .env
fi
echo "✓ Generated and set secure keys in .env"
else
echo "⚠ openssl not found. Please manually set the following in .env:"
echo " - SERVICE_ADMINKEY"
echo " - ENCRYPTION_KEY"
echo " - SERVICE_DBPASSWORD"
fi
echo ""
echo "====================================="
echo "Setup complete!"
echo "====================================="
echo ""
echo "Next steps:"
echo "1. Review and adjust settings in .env file if needed"
echo "2. Start the services: docker-compose up -d"
echo "3. Check logs: docker-compose logs -f"
echo "4. Access API documentation: http://localhost:8880/docs"
echo ""
echo "IMPORTANT: Save your admin key securely!"
echo "Admin Key: $ADMIN_KEY"
echo ""
echo "See DOCKER.md for detailed documentation."
echo ""