Skip to content

Commit 877a41a

Browse files
committed
Add external persistence ENV variables/config
Also add helper scripts and update README and AGENTS.md.
1 parent 90dfb02 commit 877a41a

File tree

7 files changed

+230
-14
lines changed

7 files changed

+230
-14
lines changed

.env

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Disable Ollama
2+
ENABLE_OLLAMA_API=false
3+
4+
# Database config
5+
DATABASE_TYPE=postgresql
6+
DATABASE_NAME=openwebui
7+
8+
# Vector DB config
9+
VECTOR_DB=pgvector
10+
11+
# Cloud storage
12+
STORAGE_PROVIDER=s3
13+
S3_ADDRESSING_STYLE=path
14+
S3_ENDPOINT_URL=https://s3.fr-par.scw.cloud
15+
S3_REGION_NAME=fr-par

.env.local.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Database
2+
DATABASE_USER=
3+
DATABASE_PASSWORD=
4+
DATABASE_HOST=
5+
DATABASE_PORT=
6+
7+
# Cloud storage
8+
S3_BUCKET_NAME=
9+
S3_ACCESS_KEY_ID=
10+
S3_SECRET_ACCESS_KEY=
11+
12+
# Web auth secret
13+
WEBUI_SECRET_KEY=

.gitignore

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/node
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=node
3+
4+
### Node ###
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
.pnpm-debug.log*
13+
14+
# Diagnostic reports (https://nodejs.org/api/report.html)
15+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
*.lcov
29+
30+
# nyc test coverage
31+
.nyc_output
32+
33+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
34+
.grunt
35+
36+
# Bower dependency directory (https://bower.io/)
37+
bower_components
38+
39+
# node-waf configuration
40+
.lock-wscript
41+
42+
# Compiled binary addons (https://nodejs.org/api/addons.html)
43+
build/Release
44+
45+
# Dependency directories
46+
node_modules/
47+
jspm_packages/
48+
49+
# Snowpack dependency directory (https://snowpack.dev/)
50+
web_modules/
51+
52+
# TypeScript cache
53+
*.tsbuildinfo
54+
55+
# Optional npm cache directory
56+
.npm
57+
58+
# Optional eslint cache
59+
.eslintcache
60+
61+
# Optional stylelint cache
62+
.stylelintcache
63+
64+
# Microbundle cache
65+
.rpt2_cache/
66+
.rts2_cache_cjs/
67+
.rts2_cache_es/
68+
.rts2_cache_umd/
69+
70+
# Optional REPL history
71+
.node_repl_history
72+
73+
# Output of 'npm pack'
74+
*.tgz
75+
76+
# Yarn Integrity file
77+
.yarn-integrity
78+
79+
# dotenv environment variable files
80+
.env
81+
.env.development.local
82+
.env.test.local
83+
.env.production.local
84+
.env.local
85+
86+
# parcel-bundler cache (https://parceljs.org/)
87+
.cache
88+
.parcel-cache
89+
90+
# Next.js build output
91+
.next
92+
out
93+
94+
# Nuxt.js build / generate output
95+
.nuxt
96+
dist
97+
98+
# Gatsby files
99+
.cache/
100+
# Comment in the public line in if your project uses Gatsby and not Next.js
101+
# https://nextjs.org/blog/next-9-1#public-directory-support
102+
# public
103+
104+
# vuepress build output
105+
.vuepress/dist
106+
107+
# vuepress v2.x temp and cache directory
108+
.temp
109+
110+
# Docusaurus cache and generated files
111+
.docusaurus
112+
113+
# Serverless directories
114+
.serverless/
115+
116+
# FuseBox cache
117+
.fusebox/
118+
119+
# DynamoDB Local files
120+
.dynamodb/
121+
122+
# TernJS port file
123+
.tern-port
124+
125+
# Stores VSCode versions used for testing VSCode extensions
126+
.vscode-test
127+
128+
# yarn v2
129+
.yarn/cache
130+
.yarn/unplugged
131+
.yarn/build-state.yml
132+
.yarn/install-state.gz
133+
.pnp.*
134+
135+
### Node Patch ###
136+
# Serverless Webpack directories
137+
.webpack/
138+
139+
# Optional stylelint cache
140+
141+
# SvelteKit build / generate output
142+
.svelte-kit
143+
144+
# End of https://www.toptal.com/developers/gitignore/api/node
145+
146+
!.env

AGENTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
This repository is an experiment with Open WebUI and Docker to use Scaleway serverless infrastructure.
44

5-
At the moment I am trying to create a sample/example Dockerfile to run Open WebUI with a remote database (through environment variables) that is hosted on Scaleway serverless DB service. My idea is to test this sample Dockerfile locally and then try to move it to Scaleway managed container service and possibly have a serverless service to run Open WebUI.
5+
I have created a `docker-compose.yml` file and several helper scripts on `package.json` that allow me to mimick the serverless nature of Scaleway Serverless Containers service (when restarting the container all the volumes are dropped, etc).
66

7-
Open WebUI will also need information about the models, and I also expect to use a serverless inference service (with an OpenAI compatible API) from Nscale.
7+
The `docker-compose.yml` relies on `.env` files to set up the necessary ENV variables to make it work with stateless Scaleway Serverless Container service, and persist the necessary data on external services thus making the actual container truly serverless and transient.
88

9-
## Additional context for current `dockerfile` branch
9+
I tested it on the Serverless Container service, by mimicking the config and environment variables and it works as expected.
1010

11-
I am putting up the Dockerfile, but Docker Compose is more convenient, so I will only need a `docker-compose.yml` and won't need a `Dockerfile` for now.
11+
I also used the serverless inference service (with an OpenAI compatible API) from Nscale, wich also worked as expected.

README.md

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
1+
12
# openwebui-docker-sandbox
23

34
An experiment with Open WebUI and Docker to use Scaleway serverless infrastructure.
45

6+
## Setup
7+
8+
Before running the project, copy the example environment file and fill in your secrets and configuration:
9+
10+
```sh
11+
cp .env.local.example .env.local
12+
# Then edit .env.local to add your actual secrets and configurations
13+
```
14+
515
## Usage
616

7-
This sandbox/example uses Docker Compose for convenience.
17+
This sandbox/example uses Docker Compose and npm scripts for convenience.
818

9-
Make sure you have your Docker Engine/runtime/daemon running and use the following command to run:
19+
Make sure you have your Docker Engine/runtime/daemon running.
1020

11-
```shell
12-
docker compose up
13-
```
21+
### Scripts
22+
23+
- **Start normally:**
24+
```sh
25+
npm start
26+
```
27+
28+
- **Start fresh (stateless, mimics serverless cold start):**
29+
```sh
30+
npm run start:fresh
31+
```
32+
33+
- **Stop containers:**
34+
```sh
35+
npm stop
36+
```
37+
38+
- **Clean up everything (remove containers, volumes, orphans):**
39+
```sh
40+
npm run clean
41+
```
42+
43+
- **Full clean restart:**
44+
```sh
45+
npm run restart
46+
```
1447

1548
Open http://localhost:8080 on your browser.

docker-compose.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ services:
44
container_name: openwebui-docker-sandbox
55
ports:
66
- "8080:8080"
7-
volumes:
8-
- open-webui:/app/backend/data
9-
10-
volumes:
11-
open-webui:
7+
env_file:
8+
- .env
9+
- .env.local

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "openwebui-docker-sandbox",
3+
"private": true,
4+
"scripts": {
5+
"start": "docker compose up",
6+
"start:fresh": "docker compose up --force-recreate --renew-anon-volumes",
7+
"stop": "docker compose down",
8+
"clean": "docker compose down --volumes --remove-orphans",
9+
"restart": "npm run clean && npm run start:fresh"
10+
}
11+
}

0 commit comments

Comments
 (0)