Skip to content

Commit 86342e6

Browse files
Merge pull request #96 from JankariTech/opencloud
make extension work also with OpenCloud
1 parent c9a453a commit 86342e6

19 files changed

+197
-5496
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,28 @@ on:
1212
workflow_call:
1313

1414
env:
15-
OCIS_URL: https://localhost:9200
15+
OC_URL: https://localhost:9200
1616

1717
jobs:
1818
lint-and-tests:
19+
strategy:
20+
matrix:
21+
server:
22+
- Ocis
23+
- Opencloud
1924
runs-on: ubuntu-latest
2025
steps:
2126
- name: checkout
2227
uses: actions/checkout@v4
2328

29+
- name: generate-package-json
30+
run: make dependencies${{ matrix.server }}
31+
2432
- name: pnpm-install
2533
uses: pnpm/action-setup@v4
26-
with:
27-
run_install: |
28-
- args: [--frozen-lockfile, --strict-peer-dependencies]
34+
35+
- name: install
36+
run: make install${{ matrix.server }}
2937

3038
- name: lint
3139
run: pnpm lint
@@ -45,10 +53,11 @@ jobs:
4553
run: pnpm test:unit --coverage
4654

4755
- name: ocis-server
56+
if: matrix.server == 'Ocis'
4857
run: |
4958
docker run --rm -d \
5059
-p 9200:9200 \
51-
-e OCIS_URL=$OCIS_URL \
60+
-e OCIS_URL=$OC_URL \
5261
-e OCIS_INSECURE=true \
5362
-e OCIS_LOG_LEVEL=error \
5463
-e IDM_ADMIN_PASSWORD=admin \
@@ -61,6 +70,24 @@ jobs:
6170
owncloud/ocis-rolling:latest \
6271
-c 'ocis init || true && ocis server'
6372
73+
- name: opencloud-server
74+
if: matrix.server == 'Opencloud'
75+
run: |
76+
docker run --rm -d \
77+
-p 9200:9200 \
78+
-e OC_URL=$OC_URL \
79+
-e OC_INSECURE=true \
80+
-e OC_LOG_LEVEL=error \
81+
-e IDM_ADMIN_PASSWORD=admin \
82+
-e PROXY_ENABLE_BASIC_AUTH=true \
83+
-e PROXY_CSP_CONFIG_FILE_LOCATION=/etc/opencloud/csp.yml \
84+
-e WEB_ASSET_APPS_PATH=/web/apps \
85+
-v ${{ github.workspace }}/dev/config/csp.yml:/etc/opencloud/csp.yml:ro \
86+
-v ${{ github.workspace }}/dist:/web/apps:ro \
87+
--entrypoint sh \
88+
opencloudeu/opencloud-rolling:latest \
89+
-c 'opencloud init || true && opencloud server'
90+
6491
- name: host-ip
6592
id: host_ip
6693
run: echo "host_ip=$(hostname -I | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020

2121
- name: create-artifacts
2222
run: |
23-
(cd dist && zip -r - .) >mdpresentation-viewer-${{ github.ref_name }}.zip
23+
(cd dist && zip -r - .) >mdpresentation-viewer-${{ matrix.server }}-${{ github.ref_name }}.zip
2424
mkdir -p dist/release
25-
mv mdpresentation-viewer-${{ github.ref_name }}.zip dist/release/
26-
md5sum dist/release/mdpresentation-viewer-${{ github.ref_name }}.zip >dist/release/md5sum.txt
27-
sha256sum dist/release/mdpresentation-viewer-${{ github.ref_name }}.zip >dist/release/sha256sum.txt
25+
mv mdpresentation-viewer-${{ matrix.server }}-${{ github.ref_name }}.zip dist/release/
26+
md5sum dist/release/mdpresentation-viewer-${{ matrix.server }}-${{ github.ref_name }}.zip >dist/release/md5sum.txt
27+
sha256sum dist/release/mdpresentation-viewer-${{ matrix.server }}-${{ github.ref_name }}.zip >dist/release/sha256sum.txt
2828
2929
- name: publish-artifacts
3030
uses: fnkr/github-action-ghr@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules
22
dist
33
coverage
4+
pnpm-lock.yaml
45

56
# Editor directories and files
67
.vscode

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
FROM owncloudci/nodejs:20 AS stage
2+
ARG server=Ocis
23

34
WORKDIR /extension
45

56
COPY . .
6-
RUN pnpm install
7+
RUN make install$server
78
RUN pnpm build
89

910
FROM alpine:3.20
1011
WORKDIR /app
11-
COPY --from=stage /extension/dist ./
12+
COPY --from=stage /extension/dist ./

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.PHONY: installOcis installOpencloud dependenciesOcis dependenciesOpencloud install clean package
2+
3+
installOcis: dependenciesOcis install
4+
5+
installOpencloud: dependenciesOpencloud install
6+
7+
dependenciesOcis: clean
8+
$(MAKE) package PACKAGE_JSON=package-ocis.json
9+
$(MAKE) depencenciesReplacement SOURCE=opencloud-eu DEST=ownclouders
10+
11+
dependenciesOpencloud: clean
12+
$(MAKE) package PACKAGE_JSON=package-opencloud.json
13+
$(MAKE) depencenciesReplacement SOURCE=ownclouders DEST=opencloud-eu
14+
15+
package:
16+
jq -s '.[0] * .[1]' package-common.json $(PACKAGE_JSON) > package.json
17+
18+
depencenciesReplacement:
19+
find . -type f \( -name "*.ts" -o -name "*.vue" -o -name "*.prettierrc" \) -not \( -path "./node_modules/*" -o -path "./dist/*" \) -print0 | xargs -0 sed -i 's/${SOURCE}/${DEST}/g'
20+
21+
clean:
22+
rm -f package.json
23+
rm -rf dist
24+
rm -f pnpm-lock.yaml
25+
26+
install:
27+
pnpm install

README.md

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![cover photo](./images/cover-large.png)
44

5-
A markdown presentation viewer for [ownCloud web](https://github.com/owncloud/web/) (the webUI of [oCIS](https://github.com/owncloud/ocis/)) using the [reveal.js](https://revealjs.com/) library.
5+
A markdown presentation viewer for [OpenCloud](https://github.com/opencloud-eu/opencloud/) and [oCIS](https://github.com/owncloud/ocis/) using the [reveal.js](https://revealjs.com/) library.
66

77
It allows users to:
88

@@ -11,42 +11,35 @@ It allows users to:
1111

1212
## Demonstration
1313

14-
- [Demonstation page](https://ocis.in-nepal.de/com.github.jankaritech.mdpresentation-viewer/public/phDIUqntYOMSfcE/presentation.md)
14+
- [Demonstation page OpenCloud](https://opencloud.in-nepal.de/files/link/public/PHxkrAlpSRaqNNK)
15+
- [Demonstation page oCIS](https://ocis.in-nepal.de/files/link/public/phDIUqntYOMSfcE)
1516
- Click on `Open in Presentation Viewer` to view the slides
1617

1718
## Supported oCIS and Web Versions
1819

19-
- [oCIS](https://github.com/owncloud/ocis) (>= 6.x.x)
20-
- [Web](https://nodejs.org/en/) (>= 9.x.x)
20+
- [oCIS](https://github.com/owncloud/ocis) (>= 6.x.x) or [OpenCloud](https://github.com/opencloud-eu/opencloud/) (>= 2.0.0)
2121

2222
## App Installation
2323

24-
> NOTE: Requires oCIS >= 6.0.0
25-
2624
1. Download the zip file from the [releases page](https://github.com/JankariTech/web-app-presentation-viewer/releases)
2725

28-
For example: `mdpresentation-viewer-x.x.x.zip`
26+
For example: `mdpresentation-viewer-<server>-x.x.x.zip`
2927

30-
2. Extract the zip file to the `apps` directory of the oCIS server.
28+
2. Extract the zip file to the `apps` directory of the OpenCloud/oCIS server.
3129

3230
Apps directory is set using the `WEB_ASSET_APPS_PATH` environment variable.
3331

34-
### App Installation With [oCIS Deployment](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_full)
32+
### App Installation With [OpenCloud](https://github.com/opencloud-eu/opencloud/tree/main/deployments/examples/opencloud_full) or [oCIS Deployment](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_full)
3533

36-
1. Copy [`deployments/mdpresentation-viewer.yml`](./deployments/mdpresentation-viewer.yml) into the [web_extensions](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_full/web_extensions)
37-
subfolder of oCIS full deployment example.
38-
2. Add `MDPRESENTATION_VIEWER=:web_extensions/mdpresentation-viewer.yml` to the `## oCIS Web Extensions ##` section of the `.env` file of your installation (file is located in `deployments/examples/ocis_full`) and append it to the `COMPOSE_FILE` variable.
34+
1. Copy the `yml` file that corresponds with your server (OpenCloud or oCIS) from [`deployments/`](./deployments/) into the `web_extensions`
35+
subfolder.
36+
2. Add `MDPRESENTATION_VIEWER=:web_extensions/mdpresentation-viewer-<your-server>.yml` to the `Web Extensions` section of the `.env` file of your installation and append it to the `COMPOSE_FILE` variable.
3937
```env
40-
## oCIS Web Extensions ##
41-
MDPRESENTATION_VIEWER=:web_extensions/mdpresentation-viewer.yml
38+
MDPRESENTATION_VIEWER=:web_extensions/mdpresentation-viewer-<your-server>.yml
4239
4340
COMPOSE_FILE=docker-compose.yml${...}${MDPRESENTATION_VIEWER:-}
4441
```
45-
3. Run `docker compose up` to run oCIS with the extensions
46-
47-
oCIS URL: [ocis.owncloud.test](https://ocis.owncloud.test)
48-
49-
See the [docs](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_full).
42+
3. Run `docker compose up` to run the server with the extensions
5043
5144
## Creating Presentation
5245
@@ -59,16 +52,26 @@ This app has the following default slide separators:
5952
6053
## Development
6154
55+
> [!IMPORTANT] When switching between OpenCloud and oCIS, make sure to clean the browser cache!
56+
> [!CAUTION] Before commiting changes run `make installOcis` and `make clean`
57+
6258
#### Prerequisites
6359
6460
- [Node.js `v18`](https://nodejs.org/en/)
6561
- [pnpm `v8`](https://pnpm.io/)
6662
- [Docker Compose](https://docs.docker.com/compose/)
63+
- [jq](https://jqlang.org/)
6764
6865
#### 1. Install dependencies:
6966
67+
For OpenCloud:
7068
```bash
71-
pnpm install
69+
make installOpencloud
70+
```
71+
72+
For oCIS:
73+
```bash
74+
make installOcis
7275
```
7376

7477
#### 2. Build the extension
@@ -81,12 +84,29 @@ pnpm build:w
8184

8285
#### 3. Load the extension
8386

84-
> NOTE: Requires oCIS >= 6.0.0
87+
Run the server with the extension:
8588

86-
Run the oCIS server:
89+
For OpenCloud:
90+
```bash
91+
docker compose -f docker-compose-opencloud.yml up
92+
```
8793

94+
For oCIS:
8895
```bash
89-
docker compose up
96+
docker compose -f docker-compose-ocis.yml up
9097
```
9198

92-
oCIS URL: [localhost:9200](https://localhost:9200)
99+
server URL: [localhost:9200](https://localhost:9200)
100+
101+
## Building Docker Container
102+
103+
For OpenCloud:
104+
```bash
105+
docker build --build-arg server=Opencloud -t jankaritech/mdpresentation-viewer-opencloud:<version> .
106+
```
107+
108+
109+
For Ocis:
110+
```bash
111+
docker build --build-arg server=Ocis -t jankaritech/mdpresentation-viewer-ocis:<version> .
112+
```

deployments/mdpresentation-viewer.yml renamed to deployments/mdpresentation-viewer-ocis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
condition: service_completed_successfully
77

88
mdpresentation-viewer:
9-
image: jankaritech/mdpresentation-viewer:2.0.0
9+
image: jankaritech/mdpresentation-viewer:2.1.0
1010
volumes:
1111
- ocis-apps:/apps
1212
entrypoint:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
services:
3+
opencloud:
4+
depends_on:
5+
mdpresentation-viewer:
6+
condition: service_completed_successfully
7+
8+
mdpresentation-viewer:
9+
image: jankaritech/mdpresentation-viewer-opencloud:2.1.0
10+
volumes:
11+
- opencloud-apps:/apps
12+
entrypoint:
13+
- /bin/sh
14+
command: ["-c", "cp -R /app/* /apps"]

docker-compose-opencloud.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
services:
2+
opencloud:
3+
image: opencloudeu/opencloud-rolling:${OC_IMAGE_TAG:-latest}
4+
entrypoint: /bin/sh
5+
command: ['-c', 'opencloud init || true && opencloud server']
6+
ports:
7+
- 9200:9200
8+
environment:
9+
OC_URL: https://localhost:9200
10+
OC_INSECURE: true
11+
OC_LOG_LEVEL: error
12+
# WEB
13+
WEB_ASSET_APPS_PATH: /web/apps
14+
# IDM
15+
IDM_CREATE_DEMO_USERS: true
16+
IDM_ADMIN_PASSWORD: admin
17+
# PROXY
18+
PROXY_ENABLE_BASIC_AUTH: true
19+
PROXY_CSP_CONFIG_FILE_LOCATION: /etc/opencloud/csp.yml
20+
volumes:
21+
- ./dist:/web/apps:ro
22+
- ./dev/config/csp.yml:/etc/opencloud/csp.yml

0 commit comments

Comments
 (0)