Skip to content

Commit 45da174

Browse files
rubenvdlindeclaude
andcommitted
Initial commit: Open WebUI Nextcloud ExApp
- Beautiful chat interface integrated with Nextcloud AppAPI - FastAPI wrapper for lifecycle management - Auto-connects to Ollama ExApp - Supports OpenAI-compatible APIs - Multi-user support Co-Authored-By: Claude <noreply@anthropic.com>
0 parents  commit 45da174

10 files changed

Lines changed: 860 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
tags: ['v*']
7+
pull_request:
8+
branches: [main, master]
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Log in to Container Registry
29+
if: github.event_name != 'pull_request'
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=ref,event=branch
43+
type=ref,event=pr
44+
type=semver,pattern={{version}}
45+
type=semver,pattern={{major}}.{{minor}}
46+
type=raw,value=latest,enable={{is_default_branch}}
47+
48+
- name: Build and push Docker image
49+
uses: docker/build-push-action@v5
50+
with:
51+
context: .
52+
push: ${{ github.event_name != 'pull_request' }}
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}
55+
cache-from: type=gha
56+
cache-to: type=gha,mode=max
57+
58+
test:
59+
runs-on: ubuntu-latest
60+
needs: build
61+
if: github.event_name != 'pull_request'
62+
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v4
66+
67+
- name: Log in to Container Registry
68+
uses: docker/login-action@v3
69+
with:
70+
registry: ${{ env.REGISTRY }}
71+
username: ${{ github.actor }}
72+
password: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Test container startup
75+
run: |
76+
docker run -d --name test-container \
77+
-e APP_ID=open_webui \
78+
-e APP_SECRET=test \
79+
-e NEXTCLOUD_URL=http://localhost:8080 \
80+
-e OLLAMA_BASE_URL=http://localhost:11434 \
81+
-p 9000:9000 \
82+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
83+
84+
sleep 30
85+
86+
# Test heartbeat (before init, will return error)
87+
curl http://localhost:9000/heartbeat || true
88+
89+
docker stop test-container

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
env/
8+
venv/
9+
.venv/
10+
*.egg-info/
11+
dist/
12+
build/
13+
14+
# Docker
15+
.docker/
16+
17+
# IDE
18+
.idea/
19+
.vscode/
20+
*.swp
21+
*.swo
22+
*~
23+
24+
# OS
25+
.DS_Store
26+
Thumbs.db
27+
28+
# Logs
29+
*.log
30+
logs/
31+
32+
# Local development
33+
.env
34+
.env.local
35+
*.local
36+
37+
# Data
38+
/data/

Dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Open WebUI Nextcloud ExApp
2+
# Combines Open WebUI chat interface with AppAPI lifecycle management
3+
4+
FROM ghcr.io/open-webui/open-webui:main
5+
6+
# Install additional dependencies for AppAPI wrapper
7+
USER root
8+
9+
RUN apt-get update && apt-get install -y \
10+
curl \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# Install Python dependencies (Open WebUI already has Python)
14+
COPY requirements.txt /app/exapp_requirements.txt
15+
RUN pip install --no-cache-dir -r /app/exapp_requirements.txt
16+
17+
# Install FRP client for HaRP support
18+
RUN set -ex; \
19+
ARCH=$(uname -m); \
20+
if [ "$ARCH" = "aarch64" ]; then \
21+
FRP_URL="https://raw.githubusercontent.com/nextcloud/HaRP/main/exapps_dev/frp_0.61.1_linux_arm64.tar.gz"; \
22+
FRP_DIR="frp_0.61.1_linux_arm64"; \
23+
else \
24+
FRP_URL="https://raw.githubusercontent.com/nextcloud/HaRP/main/exapps_dev/frp_0.61.1_linux_amd64.tar.gz"; \
25+
FRP_DIR="frp_0.61.1_linux_amd64"; \
26+
fi; \
27+
curl -L "$FRP_URL" -o /tmp/frp.tar.gz; \
28+
tar -C /tmp -xzf /tmp/frp.tar.gz; \
29+
cp /tmp/${FRP_DIR}/frpc /usr/local/bin/frpc; \
30+
chmod +x /usr/local/bin/frpc; \
31+
rm -rf /tmp/frp* /tmp/${FRP_DIR}
32+
33+
# Copy ExApp wrapper
34+
COPY ex_app /app/ex_app
35+
36+
# Create data directory
37+
RUN mkdir -p /data
38+
39+
WORKDIR /app
40+
41+
# Expose ports
42+
EXPOSE 9000 8080
43+
44+
# Environment defaults
45+
ENV APP_HOST=0.0.0.0
46+
ENV APP_PORT=9000
47+
ENV PYTHONUNBUFFERED=1
48+
ENV WEBUI_AUTH=true
49+
ENV ENABLE_SIGNUP=false
50+
51+
# Entrypoint script
52+
COPY entrypoint.sh /entrypoint.sh
53+
RUN chmod +x /entrypoint.sh
54+
55+
ENTRYPOINT ["/entrypoint.sh"]

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
GNU AFFERO GENERAL PUBLIC LICENSE
2+
Version 3, 19 November 2007
3+
4+
Copyright (C) 2024 Conduction B.V.
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU Affero General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU Affero General Public License for more details.
15+
16+
You should have received a copy of the GNU Affero General Public License
17+
along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
19+
Full license text: https://www.gnu.org/licenses/agpl-3.0.txt

Makefile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Open WebUI Nextcloud ExApp - Build System
2+
3+
REGISTRY ?= ghcr.io/conductionnl
4+
IMAGE_NAME ?= open-webui-nextcloud
5+
VERSION ?= 1.0.0
6+
7+
.PHONY: build push run test clean help
8+
9+
help:
10+
@echo "Open WebUI Nextcloud ExApp"
11+
@echo ""
12+
@echo "Usage:"
13+
@echo " make build - Build Docker image"
14+
@echo " make push - Push to registry"
15+
@echo " make run - Run locally for testing"
16+
@echo " make test - Test endpoints"
17+
@echo " make clean - Remove local images"
18+
@echo ""
19+
@echo "Variables:"
20+
@echo " REGISTRY=$(REGISTRY)"
21+
@echo " VERSION=$(VERSION)"
22+
23+
build:
24+
docker build -t $(REGISTRY)/$(IMAGE_NAME):$(VERSION) -t $(REGISTRY)/$(IMAGE_NAME):latest .
25+
26+
push: build
27+
docker push $(REGISTRY)/$(IMAGE_NAME):$(VERSION)
28+
docker push $(REGISTRY)/$(IMAGE_NAME):latest
29+
30+
run:
31+
docker run -it --rm \
32+
-e APP_ID=open_webui \
33+
-e APP_SECRET=dev-secret \
34+
-e NEXTCLOUD_URL=http://host.docker.internal:8080 \
35+
-e OLLAMA_BASE_URL=http://host.docker.internal:11434 \
36+
-p 9000:9000 \
37+
-p 8081:8080 \
38+
$(REGISTRY)/$(IMAGE_NAME):latest
39+
40+
test:
41+
@echo "Testing heartbeat endpoint..."
42+
@curl -s http://localhost:9000/heartbeat || echo "Container not running"
43+
@echo ""
44+
@echo "Testing Open WebUI health..."
45+
@curl -s http://localhost:9000/health || echo "Open WebUI not running"
46+
47+
clean:
48+
-docker rmi $(REGISTRY)/$(IMAGE_NAME):$(VERSION)
49+
-docker rmi $(REGISTRY)/$(IMAGE_NAME):latest

0 commit comments

Comments
 (0)