-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-dev.sh
More file actions
executable file
·114 lines (103 loc) · 3.19 KB
/
Copy pathsetup-dev.sh
File metadata and controls
executable file
·114 lines (103 loc) · 3.19 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# FOSSBilling + Proxmox Module Dev Environment Setup
# Run inside a Debian 13 (Trixie) LXC container on Proxmox
# LXC must have "Nesting" enabled (Options > Features in Proxmox GUI)
set -e
REPO_URL="https://github.com/fossware-dev/fossbilling-pve.git"
REPO_DIR="./fossbilling-pve"
MODULE_DIR="./modules/Serviceproxmox"
echo "=== Installing dependencies ==="
apt update
apt install -y docker.io docker-compose-v2 git curl
systemctl enable --now docker
echo "=== Cloning module repo ==="
if [ -d "$REPO_DIR" ]; then
echo "Repo exists, pulling latest..."
cd "$REPO_DIR" && git pull && cd ..
else
git clone "$REPO_URL" "$REPO_DIR"
fi
echo "=== Linking module ==="
mkdir -p "$(dirname "$MODULE_DIR")"
if [ -L "$MODULE_DIR" ]; then
echo "Symlink already exists"
elif [ -d "$MODULE_DIR" ]; then
echo "Warning: $MODULE_DIR exists as a directory. Remove it first."
echo " rm -rf $MODULE_DIR"
exit 1
else
ln -s "$(pwd)/$REPO_DIR/src" "$MODULE_DIR"
echo "Symlinked $MODULE_DIR -> $REPO_DIR/src"
fi
echo "=== Installing module composer dependencies ==="
if [ -f "$REPO_DIR/src/vendor/autoload.php" ]; then
echo "Already installed"
else
docker run --rm -v "$(pwd)/$REPO_DIR:/app" -w /app composer:latest install --no-dev
fi
echo "=== Writing docker-compose.yml ==="
if [ ! -f "docker-compose.yml" ]; then
cat > docker-compose.yml << 'COMPOSE'
services:
fossbilling:
image: fossbilling/fossbilling:latest
restart: unless-stopped
ports:
- "80:80"
volumes:
- ./fossbilling:/var/www/html
- ./modules/Serviceproxmox:/var/www/html/modules/Serviceproxmox
depends_on:
mariadb:
condition: service_healthy
mariadb:
image: mariadb:11
restart: unless-stopped
environment:
MARIADB_DATABASE: fossbilling
MARIADB_USER: fossbilling
MARIADB_PASSWORD: fossbilling
MARIADB_ROOT_PASSWORD: rootpass
volumes:
- ./mysql:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 5s
timeout: 3s
retries: 10
COMPOSE
echo "Created docker-compose.yml"
else
echo "docker-compose.yml already exists, skipping"
fi
echo "=== Starting containers ==="
docker compose up -d
echo "=== Waiting for MariaDB ==="
until docker compose exec -T mariadb healthcheck.sh --connect --innodb_initialized 2>/dev/null; do
sleep 2
done
echo "MariaDB is ready"
echo ""
echo "============================================"
echo " FOSSBilling Dev Environment Ready"
echo "============================================"
echo ""
echo " Web installer: http://$(hostname -I | awk '{print $1}')"
echo ""
echo " Database settings for installer:"
echo " Host: mariadb"
echo " Name: fossbilling"
echo " User: fossbilling"
echo " Password: fossbilling"
echo ""
echo " Module is symlinked:"
echo " $MODULE_DIR -> $REPO_DIR/src"
echo ""
echo " After install:"
echo " 1. Enable the module: Admin > Extensions > Overview"
echo " 2. Set up cron:"
echo " docker compose exec fossbilling bash -c 'echo \"*/5 * * * * php /var/www/html/cron.php\" | crontab -'"
echo ""
echo " To update the module later:"
echo " cd $REPO_DIR && git pull"
echo ""