diff --git a/Dockerfile b/Dockerfile index 12bd3f319..282de5e4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,9 @@ ENV PORT=80 # copy artifact build from the 'build environment' COPY --from=build /app/dist/browser /usr/share/nginx/html +# copy nginx config +COPY ./nginx/default.conf.template /etc/nginx/templates/default.conf.template + # expose port: defaults to 80 EXPOSE $PORT diff --git a/README.md b/README.md index 99c6873dd..dd8fecf95 100644 --- a/README.md +++ b/README.md @@ -311,6 +311,40 @@ Packaging the app is done via [electron-builder](https://github.com/electron-use docker run -d -p 80:80 johannesjo/super-productivity:latest ``` +Now you can access the web app from your browser at `http://localhost`. + +This container only serves the web app, and the user data is stored in the browser. Therefore, it does not have any persistent storage. + +### Integrate with WebDAV backend server + +You can integrate the container with a WebDAV server container to provides WebDAV service with base url `http://localhost/webdav`. + +**Download pre-configured files** + +Download the pre-configured `docker-compose.yaml` and `webdav.yaml` from this repository to a local directory, say `sp/`. + +```bash +# Alternatively, you can get them by cloning this repository +git clone https://github.com/johannesjo/super-productivity.git +mkdir -p sp +cp super-productivity/docker-compose.yaml sp/ +cp super-productivity/webdav.yaml sp/ +cd sp +``` + +**Setup user accounts** + +Edit `webdav.yaml` to configure username and password. Remember to allocate separate directories to different user (within `/data`) to avoid mixing up user data. + +**Start the services** + +```bash +docker compose pull +docker compose up -d +``` + +Additionally to accessing the web app from your browser at `http://localhost`, you can set up WebDAV synchronization with base url `http://localhost/webdav/`. + ## Custom themes (desktop only) In addition to color coding your projects and tags and to the dark and light theme you can also load completely custom css to restyle everything. To load a custom theme you simply need put them into a new file named `styles.css` directly in the [user data folder](#user-data-folder). diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..8249053fa --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,17 @@ +services: + sp: + image: johannesjo/super-productivity:latest + ports: + - 80:80 + environment: + - WEBDAV_BACKEND=http://webdav # Optional + + # Optional: WebDAV backend server + # (used with the WEBDAV_BACKEND environment variable) + webdav: + image: hacdias/webdav:latest + ports: + - 81:80 + volumes: + - ./webdav.yaml:/config.yml:ro + - ./data:/data diff --git a/nginx/default.conf.template b/nginx/default.conf.template new file mode 100644 index 000000000..966c73e91 --- /dev/null +++ b/nginx/default.conf.template @@ -0,0 +1,26 @@ +server { + listen 80; + server_name localhost; + + # serve super-productivity as static files at the path / + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + # forward requests starting with "/webdav/" to $WEBDAV_BACKEND + # note: the prefix "/webdav" is removed during forwarding + location = /webdav { + return 302 /webdav/; + } + location /webdav/ { + proxy_pass $WEBDAV_BACKEND/; + # note: the trailing slash here matters! + } + + # redirect server error pages to the static page /50x.html + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/webdav.yaml b/webdav.yaml new file mode 100644 index 000000000..629109a81 --- /dev/null +++ b/webdav.yaml @@ -0,0 +1,13 @@ +address: 0.0.0.0 +port: 80 + +prefix: / +permissions: CRUD + +users: + - username: alice + password: alicepassword + directory: /data/alice + - username: bob + password: bobpassword + directory: /data/bob