-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (60 loc) · 2.22 KB
/
Makefile
File metadata and controls
73 lines (60 loc) · 2.22 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
.DEFAULT_GOAL := help
.PHONY: help install start stop restart status logs update backup restore
help:
@echo "Open WebUI systemd Stack"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo " install Copy systemd service and desktop launchers (run once)"
@echo " start Start Open WebUI"
@echo " stop Stop Open WebUI"
@echo " restart Restart Open WebUI"
@echo " status Show service and container status"
@echo " logs Follow container logs (Ctrl+C to exit)"
@echo " update Pull latest image and restart"
@echo " backup Save chat history to backups/"
@echo " restore Restore from backup: make restore FILE=backups/file.tar.gz"
install:
@echo "📦 Installing systemd service..."
mkdir -p ~/.config/systemd/user/
sed "s|%%INSTALL_PATH%%|$(PWD)|g" systemd/openwebui.service.template \
> ~/.config/systemd/user/openwebui.service
systemctl --user daemon-reload
@echo "🖥️ Installing desktop launchers..."
mkdir -p ~/.local/share/applications/
for f in desktop/*.desktop.template; do \
sed "s|%%INSTALL_PATH%%|$(PWD)|g" "$$f" \
> ~/.local/share/applications/$$(basename $$f .template); \
done
update-desktop-database ~/.local/share/applications/ 2>/dev/null || true
start:
systemctl --user start openwebui
@echo "✅ Open WebUI started → http://localhost:3000"
stop:
systemctl --user stop openwebui
@echo "✅ Open WebUI stopped."
restart:
systemctl --user restart openwebui
@echo "✅ Open WebUI restarted → http://localhost:3000"
status:
@systemctl --user status openwebui --no-pager || true
@echo ""
@docker ps --filter name=open-webui --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
logs:
docker logs open-webui -f
update:
bash scripts/update.sh
backup:
@mkdir -p backups
docker run --rm \
-v openwebui-stack_open-webui:/data \
-v $(PWD)/backups:/backup \
alpine tar czf /backup/openwebui-$(shell date +%Y%m%d-%H%M).tar.gz /data
@echo "✅ Backup saved to backups/"
restore:
@test -n "$(FILE)" || (echo "❌ Usage: make restore FILE=backups/openwebui-YYYYMMDD-HHMM.tar.gz" && exit 1)
docker run --rm \
-v openwebui-stack_open-webui:/data \
-v $(PWD)/backups:/backup \
alpine sh -c "cd / && tar xzf /backup/$(notdir $(FILE))"
@echo "✅ Restored from $(FILE)"