Zuletzt aktiv 1763950566

A self hosted dashboard and organizer for Excalidraw with live collaboration.

Änderung e3f2167c290fb431e6928ce0e45f4b6e78e4bd3a

excalidash.sh Orginalformat
1# excalidash.install: $app_domain $app_port
2excalidash.install(){
3
4# Config #
5app_name="excalidash" # App Name
6app_repo_url="https://github.com/ZimengXiong/ExcaliDash" # App Codebase
7app_version="latest"
8app_domain="${1:-"$app_name.$org_domain"}" # Unique app domain
9app_port="${2:-"3003"}" # App Port
10
11# Setup env #
12container_name="$app_name-$app_port"
13app_name_domain="$(echo $app_domain | tr "." "-")"
14app_path="/data/${app_name_domain}"
15data_path="$app_path/${app_name}_data"
16code_path="$app_path/$(basename $app_repo_url)"
17app_container_config="$code_path/docker-compose.yml"
18
19mkdir -p "$app_path"
20echo cd "$app_path"
21cd "$app_path"
22if [ ! $? == "0" ];then
23 err "Failed to cd \"$app_path\""
24 return 1
25fi
26
27# Install App #
28echo git clone "$app_repo_url"
29git clone "$app_repo_url"
30cd "$code_path"
31if [ ! $? == "0" ];then
32 err "Failed to cd \"$code_path\""
33 return 1
34fi
35
36# Create folder $data_path
37echo sudo mkdir -p "$data_path"
38sudo mkdir -p "$data_path"
39
40# Set permissions $data_path
41#echo sudo chown -R 1000:1000 "$data_path"
42#sudo chown -R 1000:1000 "$data_path"
43
44# Contain App. Write docker-compose config.
45tee "$app_container_config" > /dev/null <<EOF
46services:
47 backend:
48 build:
49 context: ./backend
50 dockerfile: Dockerfile
51 container_name: excalidash-backend
52 environment:
53 - DATABASE_URL=file:/app/prisma/dev.db
54 - PORT=8000
55 - NODE_ENV=production
56 volumes:
57 - "$data_path/backend-data:/app/prisma"
58 networks:
59 - excalidash-network
60 restart: unless-stopped
61 healthcheck:
62 test:
63 [
64 "CMD",
65 "node",
66 "-e",
67 "require('http').get('http://localhost:8000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))",
68 ]
69 interval: 30s
70 timeout: 10s
71 retries: 3
72 frontend:
73 container_name: $container_name
74 #container_name: excalidash-frontend
75 #image: "$app_name-$app_version"
76 build:
77 context: .
78 dockerfile: frontend/Dockerfile
79 ports:
80 - "$app_port:80"
81 depends_on:
82 - backend
83 networks:
84 - excalidash-network
85 restart: unless-stopped
86 healthcheck:
87 test:
88 [
89 "CMD",
90 "wget",
91 "--quiet",
92 "--tries=1",
93 "--spider",
94 "http://localhost:80",
95 ]
96 interval: 30s
97 timeout: 10s
98 retries: 3
99
100networks:
101 excalidash-network:
102 driver: bridge
103#volumes:
104 #backend-data:
105EOF
106
107echo cat ./docker-compose.yml
108cat ./docker-compose.yml
109
110# Run App. LIVE!
111echo Running $app_name container in the background.
112
113echo sudo docker-compose pull
114sudo docker-compose pull
115
116echo sudo docker-compose down
117sudo docker-compose down
118
119echo sudo docker-compose up -d
120sudo docker-compose up -d
121
122echo open http://$(host.ip):$app_port
123
124}
125# ---