-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-localhost.sh
More file actions
executable file
Β·42 lines (33 loc) Β· 1.63 KB
/
setup-localhost.sh
File metadata and controls
executable file
Β·42 lines (33 loc) Β· 1.63 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
#!/bin/bash
# Localhost setup script for Dictionary App with Traefik + Self-signed SSL
echo "π Setting up localhost environment..."
# Create traefik-localhost directory and files
mkdir -p traefik-localhost/certs
# Create external network for Traefik
echo "π‘ Creating Docker network..."
docker network create web 2>/dev/null || echo "Network 'web' already exists"
# Generate self-signed certificate for localhost
echo "π Generating self-signed certificate for localhost..."
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout traefik-localhost/certs/localhost.key \
-out traefik-localhost/certs/localhost.crt \
-subj "/C=US/ST=State/L=City/O=Localhost/CN=localhost"
# Set proper permissions
chmod 600 traefik-localhost/certs/localhost.key
chmod 644 traefik-localhost/certs/localhost.crt
# Generate password for Traefik dashboard
echo "π Generating Traefik dashboard password..."
PASSWORD=$(openssl passwd -apr1)
echo "Generated password hash: $PASSWORD"
# Update docker-compose.localhost.yml with the password
sed -i.bak "s/admin:\$\$2y\$\$10\$\$yourhashedpassword/admin:$PASSWORD/" docker-compose.localhost.yml
echo "β
Localhost setup complete!"
echo ""
echo "π Next steps:"
echo "1. Run: docker-compose -f docker-compose.localhost.yml up -d"
echo ""
echo "π Your app will be available at: https://localhost"
echo "π Traefik dashboard: https://localhost (same domain, different path)"
echo ""
echo "β οΈ Note: You'll see a security warning in your browser because this uses a self-signed certificate."
echo " This is normal for localhost development. Click 'Advanced' and 'Proceed to localhost' to continue."