This commit is contained in:
Kaikawala Gedara Theekshana Nadun Bandara Kaikawla 2025-03-31 11:32:52 +05:30
commit 59bcf646bc
27 changed files with 129 additions and 15 deletions

2
backend/open_webui/conda Normal file
View File

@ -0,0 +1,2 @@
L:\CeylonAlly\open-webui\backend\open_webui>conda.bat activate open-webui

View File

@ -1370,8 +1370,19 @@ async def healthcheck_with_db():
return {"status": True}
app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
app.mount("/cache", StaticFiles(directory=CACHE_DIR), name="cache")
class CORSStaticFiles(StaticFiles):
async def get_response(self, path: str, scope):
response = await super().get_response(path, scope)
if isinstance(response, FileResponse):
origin = scope.get('headers', {}).get((b'origin', None))
if origin:
response.headers["Access-Control-Allow-Origin"] = origin.decode()
response.headers["Access-Control-Allow-Methods"] = "GET, HEAD, OPTIONS"
response.headers["Access-Control-Allow-Headers"] = "*"
return response
app.mount("/static", CORSStaticFiles(directory=STATIC_DIR), name="static")
app.mount("/cache", CORSStaticFiles(directory=CACHE_DIR), name="cache")
def swagger_ui_html(*args, **kwargs):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,15 +1,15 @@
{
"name": "Open WebUI",
"short_name": "WebUI",
"name": "MyWebSite",
"short_name": "MySite",
"icons": [
{
"src": "/static/web-app-manifest-192x192.png",
"src": "/web-app-manifest-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/static/web-app-manifest-512x512.png",
"src": "/web-app-manifest-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,101 @@
# Deploying Open WebUI to Google Cloud
This guide will help you deploy Open WebUI to Google Cloud Platform using Docker and Cloud Run.
## Prerequisites
1. Install [Google Cloud SDK](https://cloud.google.com/sdk/docs/install)
2. Install [Docker](https://docs.docker.com/get-docker/)
3. A Google Cloud account with billing enabled
## Setup Google Cloud Project
1. Create a new project or select an existing one:
```bash
gcloud projects create [PROJECT_ID] --name="[PROJECT_NAME]"
gcloud config set project [PROJECT_ID]
```
2. Enable required APIs:
```bash
gcloud services enable cloudbuild.googleapis.com run.googleapis.com artifactregistry.googleapis.com
```
3. Create a Docker repository in Artifact Registry:
```bash
gcloud artifacts repositories create open-webui --repository-format=docker --location=[REGION] --description="Open WebUI Docker repository"
```
## Build and Push Docker Images
1. Configure Docker authentication:
```bash
gcloud auth configure-docker [REGION]-docker.pkg.dev
```
2. Build and tag the images:
```bash
# Build Ollama image
docker build -t [REGION]-docker.pkg.dev/[PROJECT_ID]/open-webui/ollama:latest .
# Build Open WebUI image
docker build -t [REGION]-docker.pkg.dev/[PROJECT_ID]/open-webui/open-webui:latest .
```
3. Push the images to Artifact Registry:
```bash
docker push [REGION]-docker.pkg.dev/[PROJECT_ID]/open-webui/ollama:latest
docker push [REGION]-docker.pkg.dev/[PROJECT_ID]/open-webui/open-webui:latest
```
## Deploy to Cloud Run
1. Deploy Ollama service:
```bash
gcloud run deploy ollama \
--image=[REGION]-docker.pkg.dev/[PROJECT_ID]/open-webui/ollama:latest \
--region=[REGION] \
--platform=managed \
--port=11434 \
--memory=4Gi \
--cpu=2 \
--allow-unauthenticated
```
2. Deploy Open WebUI service:
```bash
gcloud run deploy open-webui \
--image=[REGION]-docker.pkg.dev/[PROJECT_ID]/open-webui/open-webui:latest \
--region=[REGION] \
--platform=managed \
--port=8080 \
--memory=2Gi \
--cpu=1 \
--set-env-vars="OLLAMA_BASE_URL=[OLLAMA_SERVICE_URL]" \
--allow-unauthenticated
```
Replace `[PROJECT_ID]`, `[REGION]`, and `[OLLAMA_SERVICE_URL]` with your specific values.
## Access Your Deployment
After deployment, you can access your Open WebUI instance at the URL provided by Cloud Run. You can find this URL in the Google Cloud Console or by running:
```bash
gcloud run services describe open-webui --region=[REGION] --format='value(status.url)'
```
## Important Notes
1. Ensure your Cloud Run service account has the necessary permissions.
2. Consider setting up a custom domain if needed.
3. Monitor your usage to control costs.
4. Set up appropriate security measures and environment variables.
5. Consider using Cloud Run jobs for background tasks if needed.
## Troubleshooting
1. Check service logs in Cloud Console
2. Verify environment variables are set correctly
3. Ensure services can communicate with each other
4. Check resource allocation if experiencing performance issues

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -2,7 +2,7 @@
<ShortName>Open WebUI</ShortName>
<Description>Search Open WebUI</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">http://localhost:5137/favicon.png</Image>
<Url type="text/html" method="get" template="http://localhost:5137/?q={searchTerms}"/>
<moz:SearchForm>http://localhost:5137</moz:SearchForm>
<Image width="16" height="16" type="image/x-icon">/static/favicon.png</Image>
<Url type="text/html" method="get" template="/?q={searchTerms}"/>
<moz:SearchForm>/</moz:SearchForm>
</OpenSearchDescription>

BIN
static/spalash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -1,15 +1,15 @@
{
"name": "Open WebUI",
"short_name": "WebUI",
"name": "MyWebSite",
"short_name": "MySite",
"icons": [
{
"src": "/static/web-app-manifest-192x192.png",
"src": "/web-app-manifest-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/static/web-app-manifest-512x512.png",
"src": "/web-app-manifest-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 28 KiB