-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.sh
More file actions
55 lines (47 loc) · 1.87 KB
/
Copy pathsetup.sh
File metadata and controls
55 lines (47 loc) · 1.87 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
#!/usr/bin/env bash
set -euo pipefail
# NetworkOptimizer-Proxy first-time setup
# Creates config files from examples and sets correct permissions
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "NetworkOptimizer-Proxy Setup"
echo "============================"
echo ""
# Create .env from example if it doesn't exist
if [ ! -f "$PROJECT_DIR/.env" ]; then
cp "$PROJECT_DIR/.env.example" "$PROJECT_DIR/.env"
echo "Created .env from template - edit it with your values:"
echo " nano $PROJECT_DIR/.env"
else
echo ".env already exists, skipping"
fi
# Create dynamic config from example if it doesn't exist
if [ ! -f "$PROJECT_DIR/dynamic/config.yml" ]; then
cp "$PROJECT_DIR/config.example.yml" "$PROJECT_DIR/dynamic/config.yml"
echo "Created dynamic/config.yml from template - edit hostnames:"
echo " nano $PROJECT_DIR/dynamic/config.yml"
else
echo "dynamic/config.yml already exists, skipping"
fi
# Create secrets config from example if it doesn't exist
if [ ! -f "$PROJECT_DIR/dynamic/secrets.yml" ]; then
cp "$PROJECT_DIR/secrets.example.yml" "$PROJECT_DIR/dynamic/secrets.yml"
echo "Created dynamic/secrets.yml from template (optional)"
else
echo "dynamic/secrets.yml already exists, skipping"
fi
# Create acme directory and acme.json with correct permissions
mkdir -p "$PROJECT_DIR/acme"
if [ ! -f "$PROJECT_DIR/acme/acme.json" ]; then
touch "$PROJECT_DIR/acme/acme.json"
chmod 600 "$PROJECT_DIR/acme/acme.json"
echo "Created acme/acme.json with 600 permissions"
else
# Ensure correct permissions even if file exists
chmod 600 "$PROJECT_DIR/acme/acme.json"
echo "acme/acme.json already exists, verified permissions"
fi
echo ""
echo "Setup complete. Next steps:"
echo " 1. Edit .env with your Cloudflare token and email"
echo " 2. Edit dynamic/config.yml with your hostnames"
echo " 3. Run: docker compose up -d"