-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
Β·52 lines (39 loc) Β· 1.35 KB
/
start.sh
File metadata and controls
executable file
Β·52 lines (39 loc) Β· 1.35 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
#!/bin/bash
set -e
echo "π Starting web + n8n + Cloudflare Tunnel for aimost.pl"
# 1οΈβ£ Check if .env file exists
if [ ! -f .env ]; then
echo "β .env file not found!"
exit 1
fi
source .env
# 2οΈβ£ Generate config.yml from template
if [-z "$DOMAIN_NAME"] || [ -z "$WEB_HOST" ] || [ -z "$N8N_HOST" ]; then
echo "β DOMAIN_NAME, WEB_HOST or N8N_HOST is not set in .env"
exit 1
fi
echo "π§ Generating cloudflared config.yml for $WEB_HOST and $N8N_HOST"
DOMAIN_NAME=$DOMAIN_NAME WEB_HOST=$WEB_HOST N8N_HOST=$N8N_HOST envsubst < cloudflared/config.yml.template > cloudflared/config.yml
# 3οΈβ£ Check if credentials.json exists
if [ ! -f cloudflared/credentials.json ]; then
echo "β cloudflared/credentials.json not found!"
echo "π Copy credentials from ~/.cloudflared/ to cloudflared/credentials.json"
exit 1
fi
echo "π Checking for updates..."
docker compose pull
# 4οΈβ£ Start Docker Compose
echo "π³ Starting Docker Compose..."
docker compose up -d --build
# 5οΈβ£ Wait a few seconds
sleep 5
echo "π Checking if containers are running..."
CONTAINER_COUNT=$(docker compose ps -q | wc -l)
if [ $CONTAINER_COUNT -eq 0 ]; then
echo "β Containers are not running!"
exit 0
fi
# 6οΈβ£ Show container status
echo "π Containers status:"
docker compose ps
echo "β
Project started successfully: $WEB_HOST and $N8N_HOST"