From 81c81a5d831b43f25e748dbee8a0d03286ffa5b8 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Sat, 1 Feb 2025 02:32:36 +0100 Subject: [PATCH] Add open-webui and improve readme Signed-off-by: Bensuperpc --- .github/workflows/main.yml | 4 +- DockerCompose.mk | 15 ++++--- Makefile | 4 +- README.md | 34 ++++++++++++++- infrastructure/docker-compose.yml | 2 + .../caddy/config/bensuperpc.org/Caddyfile | 4 ++ .../services/homepage/config/services.yaml | 6 +++ infrastructure/services/minecraft-server | 2 +- .../open-webui/docker-compose.open-webui.yml | 43 +++++++++++++++++++ .../services/open-webui/env/open-webui.env | 18 ++++++++ 10 files changed, 121 insertions(+), 11 deletions(-) create mode 100644 infrastructure/services/open-webui/docker-compose.open-webui.yml create mode 100644 infrastructure/services/open-webui/env/open-webui.env diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61b6c6f..b941566 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,8 +26,10 @@ jobs: with: submodules: "recursive" fetch-depth: 0 + - name: "Check compose" + run: make check - name: "Update server image" - run: make update-docker + run: make image-update - name: "Build server" run: make build # - name: "Start server" diff --git a/DockerCompose.mk b/DockerCompose.mk index 6daaaf1..670e67c 100644 --- a/DockerCompose.mk +++ b/DockerCompose.mk @@ -44,8 +44,8 @@ start: start-at: $(DOCKER_COMPOSE_COMMAND) up -.PHONY: docker-check -docker-check: +.PHONY: check +check: $(DOCKER_COMPOSE_COMMAND) config .PHONY: stop @@ -67,15 +67,18 @@ state: $(DOCKER_COMPOSE_COMMAND) ps $(DOCKER_COMPOSE_COMMAND) top -.PHONY: update-docker -update-docker: +.PHONY: image-update +image-update: $(DOCKER_COMPOSE_COMMAND) pull -.PHONY: update -update: update-docker +.PHONY: git-update +git-update: # git submodule update --init --recursive --remote git pull --recurse-submodules --all --progress +.PHONY: update +update: image-update git-update + .PHONY: clean clean: docker system prune -f diff --git a/Makefile b/Makefile index 4ad010c..8081adc 100644 --- a/Makefile +++ b/Makefile @@ -16,11 +16,11 @@ TORRENTS_SERVICES := qbittorrent transmission SHARING_SERVICES := psitransfer picoshare privatebin projectsend jellyfin dufs gitea syncthing ADMIN_SERVICES := yacht uptime-kuma openssh UTILS_SERVICES := it-tools stirlingpdf +IA_SERVICES := open-webui # gitea-runner GAME_SERVICES := mc-server mc-backup 7daystodie_server 7daystodie_backup - PROJECT_DIRECTORY := infrastructure -DOCKER_PROFILES := main_infrastructure caddy homepage $(BLOG_SERVICES) $(SHARING_SERVICES) $(TORRENTS_SERVICES) $(ADMIN_SERVICES) $(UTILS_SERVICES) $(GAME_SERVICES) +DOCKER_PROFILES := main_infrastructure caddy homepage $(BLOG_SERVICES) $(SHARING_SERVICES) $(TORRENTS_SERVICES) $(ADMIN_SERVICES) $(UTILS_SERVICES) $(IA_SERVICES) $(GAME_SERVICES) include DockerCompose.mk diff --git a/README.md b/README.md index c4bfd5c..d6dea1b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,9 @@ If you have any **questions** or **suggestions**, feel free to open an issue or - [x] it-tools (Tools for IT) - [x] Privatebin (Pastebin) - [x] Yacht (Web interface for managing docker containers) -- [ ] Integrate games ([Satisfactory](https://github.com/bensuperpc/docker-satisfactory), [7 days to die](https://github.com/bensuperpc/docker-7daystodie), Minecraft...) +- [ ] [Satisfactory](https://github.com/bensuperpc/docker-satisfactory) +- [x] [7 days to die](https://github.com/bensuperpc/docker-7daystodie) +- [x] [minecraft](https://github.com/bensuperpc/docker-minecraft-server) ## Architecture @@ -76,6 +78,7 @@ And then, caddy will generate the certificate for you and renew it automatically | --- | --- | --- | | [bensuperpc.org](https://bensuperpc.org) | Main | Redirect to [www.bensuperpc.org](https://www.bensuperpc.org) | | [www.bensuperpc.org](https://www.bensuperpc.org) | Main | Homepage | +| [open-webui.bensuperpc.org](https://open-webui.bensuperpc.org) | Sub | For local chatGPT | | [wordpress.bensuperpc.org](https://wordpress.bensuperpc.org) | Sub | Wordpress website | | [uptimekuma.bensuperpc.org](https://uptimekuma.bensuperpc.org) | Sub | Uptime Kuma for monitoring | | [qbittorrent.bensuperpc.org](https://qbittorrent.bensuperpc.org) | Sub | Torrent client/server | @@ -93,6 +96,7 @@ And then, caddy will generate the certificate for you and renew it automatically | [dufs.bensuperpc.org](https://dufs.bensuperpc.org) | Sub | Dufs for file sharing | | [public.bensuperpc.org](https://public.bensuperpc.org) | Sub | Caddy for file sharing | | [memos.bensuperpc.org](https://memos.bensuperpc.org) | Sub | Caddy for file sharing | +| [stirlingpdf.bensuperpc.org](https://stirlingpdf.bensuperpc.org) | Sub | Stirling PDF tools | | bensuperpc.com | Main | Redirect to [www.bensuperpc.org](https://www.bensuperpc.org) | | bensuperpc.fr | Main | Redirect to [www.bensuperpc.org](https://www.bensuperpc.org) | | bensuperpc.net | Main | Redirect to [www.bensuperpc.org](https://www.bensuperpc.org) | @@ -110,12 +114,16 @@ openssl rand -base64 32 Or online: [passwordsgenerator.net](https://passwordsgenerator.net/) +#### Caddy + For [caddy_backup.env](infrastructure/services/caddy/env/caddy_backup.env) file, you need to change the password(s) for the restic backup. ```sh RESTIC_PASSWORD=7L1Ncbquax0B2TCOmrjaQl9n5mnY88bQ ``` +#### Wordpress + For the [wordpress.env](infrastructure/services/wordpress/env/wordpress.env) file, you need to change the password and user for the database. ```sh @@ -137,6 +145,8 @@ For [wordpress_backup.env](infrastructure/services/wordpress/env/wordpress_backu RESTIC_PASSWORD=7L1Ncbquax0B2TCOmrjaQl9n5mnY88bQ ``` +#### Gitea + For [gitea.env](infrastructure/services/gitea/env/gitea.env) file, you need to change the password(s) and user for the database. ```sh @@ -153,6 +163,8 @@ MARIADB_USER=bensuperpc MARIADB_PASSWORD=K7s5yoHknnEd7vsZoxb8I3dK9mjToF1j ``` +#### PsiTransfer + For [psitransfer.env](infrastructure/services/psitransfer/env/psitransfer.env) file, you need to change the secret key. ```sh @@ -173,18 +185,24 @@ MARIADB_USER=bensuperpc MARIADB_PASSWORD=wdSUa1JEZhXie5AJ5NcX1w73xmpO12EY ``` +#### Picoshare + For [picoshare.env](infrastructure/services/picoshare/env/picoshare.env) file, you need to change the secret key. ```sh PS_SHARED_SECRET=CBuS4DJLqIe93xF1KGYRrnhxUFBqLD2n ``` +#### Dufs + For [dufs.env](infrastructure/services/dufs/env/dufs.env) file, you need to change the secret key and if you want the user name. ```sh DUFS_AUTH="admin:heqihlOfBmJDESGFlpbPi7P7Mi6F7RkV@/:rw|@/:ro" ``` +#### Stirling PDF + For [stirlingpdf.env](infrastructure/services/stirlingpdf/env/stirlingpdf.env) file, it's **completly optional**, you can change the password(s) and user. ```sh @@ -197,6 +215,8 @@ SECURITY_INITIALLOGIN_USERNAME=admin SECURITY_INITIALLOGIN_PASSWORD=Jw9U039f5xc2mFcacvGvPD9RjwIh4DzO ``` +#### OpenSSH + You can need to add/change the public ssh key [id_ed25519.pub](infrastructure/services/openssh/config/authorized_keys/id_ed25519.pub) (its my public key), also change the config/password in [openssh.env](infrastructure/services/openssh/env/openssh.env): ```sh @@ -211,6 +231,16 @@ USER_PASSWORD=rdUwf36C11PLmpU9Lvq7tP5pfFBKAuCh #USER_PASSWORD_FILE=/path/to/file ``` +#### Open-WebUI + +For [open-webui.env](infrastructure/services/open-webui/env/open-webui.env) file, entirely optional. + +To download the model, you can use: + +```sh +docker exec ollama ollama run deepseek-r1:8b +``` + ### Start the infrastructure Start the website with: @@ -294,6 +324,8 @@ ssh -p 2222 admin@bensuperpc.org - [Picoshare](https://github.com/mtlynch/picoshare) - [Dufs](https://github.com/sigoden/dufs) - [demos](https://github.com/usememos/memos) +- [Stirling PDF](https://github.com/Stirling-Tools/Stirling-PDF) +- [open-webui](https://github.com/open-webui/open-webui) - [Fix docker volume](https://pratikpc.medium.com/use-docker-compose-named-volumes-as-non-root-within-your-containers-1911eb30f731) ## License diff --git a/infrastructure/docker-compose.yml b/infrastructure/docker-compose.yml index 3cb0ed1..ace6552 100644 --- a/infrastructure/docker-compose.yml +++ b/infrastructure/docker-compose.yml @@ -37,6 +37,8 @@ include: - services/uptime-kuma/docker-compose.uptime-kuma.yml # Yacht - services/yacht/docker-compose.yacht.yml +# open-webui + - services/open-webui/docker-compose.open-webui.yml # Minecraft - services/minecraft-server/minecraft-server/minecraft-server/docker-compose.yml # Backup minecraft diff --git a/infrastructure/services/caddy/config/bensuperpc.org/Caddyfile b/infrastructure/services/caddy/config/bensuperpc.org/Caddyfile index ec70aa5..eb21762 100644 --- a/infrastructure/services/caddy/config/bensuperpc.org/Caddyfile +++ b/infrastructure/services/caddy/config/bensuperpc.org/Caddyfile @@ -138,6 +138,10 @@ memos.bensuperpc.org { reverse_proxy memos:5230 } +open-webui.bensuperpc.org { + reverse_proxy open-webui:8080 +} + link.bensuperpc.org { # TODO: Use service with database # Friendly links diff --git a/infrastructure/services/homepage/config/services.yaml b/infrastructure/services/homepage/config/services.yaml index c069df6..2e390ea 100644 --- a/infrastructure/services/homepage/config/services.yaml +++ b/infrastructure/services/homepage/config/services.yaml @@ -90,6 +90,12 @@ description: Gitea ping: gitea.bensuperpc.org container: gitea + - open-webui: + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/open-webui.png + href: https://open-webui.bensuperpc.org/ + description: ChatGPT local + ping: open-webui.bensuperpc.org + container: open-webui - Admin: - uptime-kuma: diff --git a/infrastructure/services/minecraft-server b/infrastructure/services/minecraft-server index 25cccca..6099025 160000 --- a/infrastructure/services/minecraft-server +++ b/infrastructure/services/minecraft-server @@ -1 +1 @@ -Subproject commit 25cccca1805b92cb17cb5e6d542a02fcd8a0de49 +Subproject commit 609902576fa569b6ea07007519f93ea29866fd3a diff --git a/infrastructure/services/open-webui/docker-compose.open-webui.yml b/infrastructure/services/open-webui/docker-compose.open-webui.yml new file mode 100644 index 0000000..307835c --- /dev/null +++ b/infrastructure/services/open-webui/docker-compose.open-webui.yml @@ -0,0 +1,43 @@ + +services: + ollama: + image: ollama/ollama:latest + #platform: linux/amd64 + container_name: ollama + profiles: + - open-webui + depends_on: + - caddy + restart: on-failure:5 + tty: true + volumes: + - ollama:/root/.ollama + security_opt: + - no-new-privileges:true + networks: + - infra-network + + open-webui: + image: ghcr.io/open-webui/open-webui:main + container_name: open-webui + profiles: + - open-webui + volumes: + - open-webui:/app/backend/data + depends_on: + - ollama + - caddy + env_file: + - ./env/open-webui.env + #environment: + # - UID=${PUID:-1000} + # - GID=${PGID:-1000} + restart: on-failure:5 + networks: + - infra-network + security_opt: + - no-new-privileges:true + +volumes: + ollama: {} + open-webui: {} diff --git a/infrastructure/services/open-webui/env/open-webui.env b/infrastructure/services/open-webui/env/open-webui.env new file mode 100644 index 0000000..7f50a22 --- /dev/null +++ b/infrastructure/services/open-webui/env/open-webui.env @@ -0,0 +1,18 @@ +OLLAMA_BASE_URL=http://ollama:11434 +#WEBUI_SECRET_KEY= +#HF_HUB_OFFLINE=1 + +# Only with stable-diffusion-webui +#ENABLE_IMAGE_GENERATION=true +#AUTOMATIC1111_BASE_URL=http://stable-diffusion-webui:7860 +#IMAGE_SIZE=64x64 +#IMAGE_STEPS=3 + +# Disable analytics +SCARF_NO_ANALYTICS=true +DO_NOT_TRACK=true +ANONYMIZED_TELEMETRY=false + +#OPENAI_API_BASE_URL= +#OPENAI_API_KEY= +