-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add flist and dockerfile for openwebui #328
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM ubuntu:22.04 | ||
|
||
RUN apt update && \ | ||
apt -y install wget openssh-server curl sudo iproute2 | ||
|
||
RUN wget -O /sbin/zinit https://github.com/threefoldtech/zinit/releases/download/v0.2.5/zinit && \ | ||
chmod +x /sbin/zinit | ||
|
||
RUN curl -fsSL https://get.docker.com -o /usr/local/bin/install-docker.sh && \ | ||
chmod +x /usr/local/bin/install-docker.sh | ||
|
||
RUN sh /usr/local/bin/install-docker.sh | ||
|
||
COPY ./scripts/ /scripts/ | ||
COPY ./zinit/ /etc/zinit/ | ||
RUN chmod +x /scripts/*.sh | ||
|
||
ENTRYPOINT ["/sbin/zinit", "init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<h1> OpenWebUI Deployment with Ollama Flist</h1> | ||
|
||
<h2> Table of Contents </h2> | ||
|
||
- [Introduction](#introduction) | ||
- [Directory Structure](#directory-structure) | ||
- [Create the Docker Image](#create-the-docker-image) | ||
- [Convert the Docker Image to Zero-OS FList](#convert-the-docker-image-to-zero-os-flist) | ||
- [TFGrid Deployment](#tfgrid-deployment) | ||
- [Playground Steps](#playground-steps) | ||
- [Conclusion](#conclusion) | ||
|
||
*** | ||
|
||
## Introduction | ||
|
||
This project provides a self-contained deployment of **OpenWebUI** on the ThreeFold Grid, using a micro VM. The deployment is managed via **zinit** for automatic service management and includes: | ||
|
||
- Docker daemon for container management | ||
- Secure SSH server configuration | ||
- **OpenWebUI** with Ollama integration | ||
- Automatic container updates via Watchtower | ||
- Self-healing services via **zinit** | ||
|
||
The deployment automatically provisions: | ||
- Secure SSH access | ||
- OpenWebUI on port `8080` | ||
- Persistent storage for Docker and WebUI data | ||
|
||
*** | ||
|
||
## Directory Structure | ||
|
||
``` | ||
. | ||
├── Dockerfile | ||
├── README.md | ||
├── scripts | ||
│ ├── start_containers.sh | ||
│ └── sshd_init.sh | ||
└── zinit | ||
├── dockerd.yaml | ||
├── start_containers.yaml | ||
├── sshd.yaml | ||
└── ssh-init.yaml | ||
``` | ||
|
||
- **`scripts/`**: Contains initialization and service scripts | ||
- **`zinit/`**: Contains **zinit** service configurations for managing services | ||
- **`Dockerfile`**: Defines the Docker image with all dependencies and configurations | ||
|
||
*** | ||
|
||
## Create the Docker Image | ||
|
||
To create the Docker image: | ||
|
||
1. Clone this repository: | ||
```bash | ||
git clone https://github.com/threefoldtech/tf-images | ||
cd ./tf-images/tfgrid3/openwebui | ||
``` | ||
|
||
2. Build the Docker image: | ||
```bash | ||
docker build -t <your-dockerhub-username>/openwebui-tfgrid . | ||
``` | ||
|
||
3. Push to Docker Hub: | ||
```bash | ||
docker push <your-dockerhub-username>/openwebui-tfgrid | ||
``` | ||
|
||
*** | ||
|
||
## Convert the Docker Image to Zero-OS FList | ||
|
||
1. Use the [TF Hub Docker Converter](https://hub.grid.tf/docker-convert) | ||
2. Enter your Docker image name: | ||
```text | ||
<your-dockerhub-username>/openwebui-tfgrid:latest | ||
``` | ||
3. Convert and get your FList URL (example): | ||
```text | ||
https://hub.grid.tf/<your-3bot>/openwebui-tfgrid-latest.flist | ||
``` | ||
|
||
*** | ||
|
||
## TFGrid Deployment | ||
|
||
### Playground Steps | ||
|
||
1. Go to [ThreeFold Dashboard](https://dashboard.grid.tf) | ||
2. Create a Micro VM: | ||
- **VM Image**: Paste your FList URL | ||
- **Entry Point**: `/sbin/zinit init` (default) | ||
- **Resources**: Minimum 2 vCPU, 4GB RAM, 10GB disk | ||
- **Mount**: Add a mount point at `/mnt/data` | ||
3. Deploy | ||
4. Set a gateway domain with port 8080 to access OpenWebUI | ||
|
||
*** | ||
|
||
## Conclusion | ||
|
||
This FList provides a self-contained deployment of **OpenWebUI** with Ollama on the ThreeFold Grid with: | ||
- Automatic service management via **zinit** | ||
- Docker container management | ||
- Automatic container updates via Watchtower | ||
- SSH access for maintenance | ||
- Persistent storage for data | ||
- Easy deployment via Docker and TF Grid | ||
|
||
Deploy and enjoy a fully functional OpenWebUI setup on the decentralized ThreeFold Grid! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p ~/.ssh | ||
mkdir -p /var/run/sshd | ||
chmod 600 ~/.ssh | ||
chmod 600 /etc/ssh/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Wait for Docker daemon | ||
while ! docker info >/dev/null 2>&1; do | ||
echo "Waiting for Docker..." | ||
sleep 2 | ||
done | ||
|
||
# Start OpenWebUI container | ||
docker run \ | ||
-d \ | ||
-p 8080:8080 \ | ||
-v ollama:/root/.ollama \ | ||
-v open-webui:/app/backend/data \ | ||
--name open-webui \ | ||
--restart always \ | ||
ghcr.io/open-webui/open-webui:ollama | ||
|
||
# Start WatchTower container | ||
docker run -d --name watchtower \ | ||
--volume /var/run/docker.sock:/var/run/docker.sock \ | ||
containrrr/watchtower -i 300 open-webui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exec: /usr/bin/dockerd --data-root /mnt/data/docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
exec: /scripts/sshd_init.sh | ||
oneshot: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
exec: bash -c "/usr/sbin/sshd -D" | ||
after: | ||
- ssh-init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
exec: /scripts/start_containers.sh | ||
oneshot: true | ||
after: | ||
- dockerd |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / Trivy
Image user should not be 'root' High