Skip to content

Commit

Permalink
Merge pull request #54 from JankariTech/build/configure-local-setup
Browse files Browse the repository at this point in the history
build: configure local dev setup for latest ocis
  • Loading branch information
saw-jan authored May 21, 2024
2 parents 67a6281 + 2997401 commit 2b16f83
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 314 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,21 @@ jobs:
- name: build
run: pnpm build

- name: generate-ssl-certs
run: |
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout ${{ github.workspace }}/tests/e2e/ci/nginx/nginx-ssl.key \
-out ${{ github.workspace }}/tests/e2e/ci/nginx/nginx-ssl.crt \
-subj "/CN=localhost"
- name: extension-server
run: |
docker run --rm -d \
-p 8443:443 \
-v ${{ github.workspace }}/tests/e2e/ci/nginx:/etc/nginx/conf.d \
-v ${{ github.workspace }}/dist:/usr/share/nginx/html \
nginx:1.25.3
- name: ocis-server
run: |
docker run --rm -d \
-p 9200:9200 \
-e OCIS_URL=$OCIS_URL \
-e OCIS_INSECURE=true \
-e OCIS_LOG_LEVEL=error \
-e WEB_UI_CONFIG_FILE=/web/config.json \
-e IDM_ADMIN_PASSWORD=admin \
-e PROXY_ENABLE_BASIC_AUTH=true \
-v ${{ github.workspace }}/tests/e2e/ci/web.config.json:/web/config.json:ro \
-e PROXY_CSP_CONFIG_FILE_LOCATION=/etc/ocis/csp.yml \
-e WEB_ASSET_APPS_PATH=/web/apps \
-v ${{ github.workspace }}/dev/config/csp.yml:/etc/ocis/csp.yml:ro \
-v ${{ github.workspace }}/dist:/web/apps:ro \
--entrypoint sh \
owncloud/ocis:5.0 \
owncloud/ocis:latest \
-c 'ocis init || true && ocis server'
- name: host-ip
Expand All @@ -67,7 +54,7 @@ jobs:
docker run --rm \
--add-host dockerhost:${{ steps.host_ip.outputs.host_ip }} \
owncloudci/wait-for \
-it dockerhost:8443,dockerhost:9200 -t 10
-it dockerhost:9200 -t 300
- name: install-chromium
run: npx playwright install chromium
Expand Down
26 changes: 0 additions & 26 deletions Dockerfile

This file was deleted.

91 changes: 31 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,98 +13,69 @@ It allows users to:
- Click on `Open in Text Editor` to view the markdown content.
- Click on `Open in Presentation Viewer` to view the rendered presentation.

## Prerequisites
## Supported oCIS and Web Versions

- [oCIS](https://github.com/owncloud/ocis) (>= 5.0.x)
- [Node.js](https://nodejs.org/en/) (v18.17.1)
- [pnpm](https://pnpm.io/) (v8.15.1)
- [Docker](https://www.docker.com/)(optional)
- [Docker Compose](https://docs.docker.com/compose/)(optional)
- [oCIS](https://github.com/owncloud/ocis) (>= 5.1.x)
- [Web](https://nodejs.org/en/) (>= 9.x.x)

## Installation
## App Installation

### 1. Install Dependencies
#### 1. Install Dependencies

```bash
pnpm install
```

### 2. Build the extension
#### 2. Build the extension

```bash
pnpm build
```

The extension will be built in the `dist` directory.

### 3. Serve the extension

1. serve the content of the `dist` folder using any HTTP web-server
2. configure web
1. If you already have a dedicated `web.config.json` file, add an `external_apps` section (or edit the existing one). It has to have an item with `"id": "presentation-viewer"` and a `path` pointing to `web-app-presentation-viewer.js` e.g.:
```
...
"external_apps": [
{
"id": "presentation-viewer",
"path": "https://<url-where-the-dist-folder-is-served>/web-app-presentation-viewer.js"
}
]
...
```
2. if you haven't used a `web.config.json` file yet
1. copy `config/web.config.json.sample` to the server that runs oCIS server
2. rename it to `web.config.json`
3. edit `web.config.json` and set `<your-ocis-domain>` & `<url-where-the-dist-folder-is-served>` to the correct values
3. start oCIS with the env. variable `WEB_UI_CONFIG_FILE` set to the full path of `web.config.json`
> NOTE: Requires oCIS >= 5.1 (not released yet)
## Development
External apps can be loaded into the oCIS without separate app server. We just have to use `WEB_ASSET_APPS_PATH`, an oCIS environment variable, while running oCIS server to set the directory where all the external apps are located.

Install dependencies:
For example:

```bash
pnpm install
...
WEB_ASSET_APPS_PATH=</path/to/dist> \
ocis server
```

Build the extension. For development, build with watch.

```bash
pnpm build:w
```

Depending on the oCIS version, we have two ways to load the apps into the oCIS server.
## Development

### 1. Separate Extension Server (oCIS 5.0.0)
#### Prerequisites

With oCIS 5.0.0, it is only possible to load the external apps using the config file and app server.
- [Node.js `v18`](https://nodejs.org/en/)
- [pnpm `v8`](https://pnpm.io/)
- [Docker Compose](https://docs.docker.com/compose/)

Run the following command to serve the oCIS and the extension servers:
#### 1. Install dependencies:

```bash
docker compose up
pnpm install
```

Extension URL: [host.docker.internal:3000](https://host.docker.internal:3000)

oCIS URL: [host.docker.internal:9200](https://host.docker.internal:9200)

### 2. oCIS Apps Loading (oCIS >= 5.1)
#### 2. Build the extension

Starting from oCIS 5.1.0 (not released yet), external apps can be loaded into the oCIS without config file and separate app server. We just use `WEB_ASSET_APPS_PATH`, an oCIS environment variable, while running oCIS server to set the directory where all the external apps are located.
For development, build with watch.

Follow these steps:
```bash
pnpm build:w
```

1. Build the extension with the following command:
#### 3. Load the extension

```bash
APPS_LOADING=true pnpm build:w
```
> NOTE: Requires oCIS >= 5.1 (not released yet)
2. Copy `docker-compose.override.example.yml` to `docker-compose.override.yml`
3. Run the oCIS server:
Run the oCIS server:

```bash
docker compose up
```
```bash
docker compose up
```

oCIS URL: [host.docker.internal:9200](https://host.docker.internal:9200)
oCIS URL: [localhost:9200](https://localhost:9200)
54 changes: 0 additions & 54 deletions config/web.config.json.sample

This file was deleted.

32 changes: 32 additions & 0 deletions dev/config/csp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
directives:
child-src:
- '''self'''
connect-src:
- '''self'''
- 'data:'
- 'blob:'
default-src:
- '''none'''
font-src:
- '''self'''
frame-ancestors:
- '''none'''
frame-src:
- '''self'''
img-src:
- '''self'''
- 'data:'
- 'blob:'
manifest-src:
- '''self'''
media-src:
- '''self'''
object-src:
- '''self'''
- 'blob:'
script-src:
- '''self'''
- '''unsafe-inline'''
style-src:
- '''self'''
- '''unsafe-inline'''
11 changes: 0 additions & 11 deletions dev/docker/nginx.conf

This file was deleted.

54 changes: 0 additions & 54 deletions dev/docker/web.config.json

This file was deleted.

12 changes: 0 additions & 12 deletions docker-compose.override.example.yml

This file was deleted.

Loading

0 comments on commit 2b16f83

Please sign in to comment.