Skip to content

Commit

Permalink
build: add support for app_loading via ocis env
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Mar 21, 2024
1 parent 9cd29d0 commit aebe76a
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 20 deletions.
11 changes: 11 additions & 0 deletions dev/docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
server {
listen 80;
server_name localhost;

location / {
add_header 'Access-Control-Allow-Origin' '*';
}
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
2 changes: 1 addition & 1 deletion dev/docker/web.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
{
"id": "presentation-viewer",
"path": "http://localhost:8082/web-app-presentation-viewer.js"
"path": "https://host.docker.internal:3000/com.github.jankaritech.web.mdpresentation/extension.js"
}
]
}
12 changes: 12 additions & 0 deletions docker-compose.override.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
ocis:
image: owncloud/ocis:latest
environment:
WEB_UI_CONFIG_FILE: null
WEB_ASSET_APPS_PATH: /web/apps
volumes:
- ./dist:/web/apps:ro

extension:
profiles:
- skip
69 changes: 57 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,69 @@
services:
ocis:
image: ${OCIS_IMAGE:-owncloud/ocis:latest}
container_name: web_ocis
image: ${OCIS_IMAGE:-owncloud/ocis:5.0.0}
entrypoint: /bin/sh
command: ['-c', 'ocis init || true && ocis server']
ports:
- 9200:9200
environment:
# OCIS
OCIS_URL: https://host.docker.internal:9200
OCIS_INSECURE: '${OCIS_INSECURE:-true}'
OCIS_LOG_LEVEL: '${OCIS_LOG_LEVEL:-error}'

OCIS_INSECURE: true
OCIS_LOG_LEVEL: error
# WEB
WEB_UI_CONFIG_FILE: /web/config.json
WEB_ASSET_APPS_PATH: /web/apps

# IDM
IDM_CREATE_DEMO_USERS: '${DEMO_USERS:-true}'
IDM_ADMIN_PASSWORD: '${ADMIN_PASSWORD:-admin}'
IDM_CREATE_DEMO_USERS: ${DEMO_USERS:-true}
IDM_ADMIN_PASSWORD: admin
# PROXY
PROXY_ENABLE_BASIC_AUTH: true
PROXY_TLS: false
volumes:
- ./dev/docker/web.config.json:/web/config.json:ro
- ./dist:/web/apps:ro
extra_hosts:
- host.docker.internal:host-gateway
labels:
traefik.enable: true
traefik.http.routers.ocis.tls: true
traefik.http.routers.ocis.rule: PathPrefix(`/`)
traefik.http.routers.ocis.entrypoints: ocis
traefik.http.services.ocis.loadbalancer.server.port: 9200
depends_on:
- traefik

extension:
image: nginx:1.25.3
volumes:
- ./dev/docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./dist:/usr/share/nginx/html:ro
labels:
traefik.enable: true
traefik.http.routers.extension.tls: true
traefik.http.routers.extension.rule: PathPrefix(`/`)
traefik.http.routers.extension.entrypoints: extension
traefik.http.services.extension.loadbalancer.server.port: 80
depends_on:
- traefik

traefik:
image: traefik:2.11.0
restart: unless-stopped
command:
[
'--log.level=ERROR',
'--api.insecure=true',
'--api.dashboard=true',
'--pilot.dashboard=false',
'--providers.docker=true',
'--entrypoints.ocis.address=:9200',
'--entrypoints.extension.address=:3000',
'--providers.docker.exposedbydefault=false',
'--entrypoints.websecure.http.tls.options=default'
]
labels:
traefik.enable: true
traefik.http.routers.traefik.rule: HostRegexp(`{any:.+}`)
ports:
- 8080:8080 # traefik dashboard
- 9200:9200 # ocis
- 3000:3000 # extension
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@babel/eslint-parser": "^7.23.10",
"@ownclouders/extension-sdk": "0.0.5-alpha.2",
"@ownclouders/prettier-config": "0.0.1",
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
Expand Down
19 changes: 14 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { defineConfig } from '@ownclouders/extension-sdk'
import { id } from './public/manifest.json'

// TODO: make APPS_LOADING default when supported ocis is released
const base =
process.env.APPS_LOADING === 'true' ? '/assets/apps' : 'https://host.docker.internal:3000'

export default defineConfig({
base: '/vendor/apps/com.github.jankaritech.web.mdpresentation/',
base: `${base}/${id}/`,
build: {
rollupOptions: {
output: {
dir: `dist/${id}`,
entryFileNames: `extension.js`
entryFileNames: 'extension.js'
}
}
}
Expand Down

0 comments on commit aebe76a

Please sign in to comment.