Skip to content

Commit 454559b

Browse files
committed
fixed windows-wysiwyg installation and container (watcher)
1 parent 5a18cf0 commit 454559b

File tree

10 files changed

+75
-7
lines changed

10 files changed

+75
-7
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If you'd like to host your own files, you'll have to fork this repository.
2828
* Generate different views on a document to keep exam-questions, answers and testing-questions together in one document.
2929
* Full Obsidian-flavor Markdown support
3030
* Switch between teacher- and student-view
31-
* Local [WYSIWIG Editor Setup](docs-wysiwig.md) that allows you to see the changes to your documents instantly.
31+
* Local [WYSIWYG Editor Setup](docs-wysiwyg.md) that allows you to see the changes to your documents instantly.
3232
### Features for Students
3333
* Availability
3434
* Teaching materials are always up-to-date
@@ -86,8 +86,8 @@ So there are some intricacies you should be aware of when working with it and se
8686
If you'd like to use any other server, set your secret accordingly.
8787
## Obsidian Language Extensions
8888
Here you can find the technical intricacies of the Obsidian-specific language extension implemented in this project [docs](docs-obsidian.md).
89-
## Local WYSIWIG Container
90-
Start a container running the server, which is exposing a web-page and constantly scanning for changes in your files [here](docs-wysiwig.md).
89+
## Local WYSIWYG Container
90+
Start a container running the server, which is exposing a web-page and constantly scanning for changes in your files [here](docs-wysiwyg.md).
9191
## Permissions
9292
You can specify who is able to read whole files, or only parts of it.
9393
Here you can find more information about [permissions](docs-permissions.md).

docs-wysiwig.md renamed to docs-wysiwyg.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
# WYSIWIG
1+
# WYSIWYG
22
If you'd like to run a local container of this server in order to see changes you make on your files on-the-fly, you've come to the right page.
33

44
[Back](README.md) to the main page.
55
## How to setup your local container
66
### Prerequisites
7-
- Local [Docker](https://docker.com)-installation
7+
- Local [Docker](https://docker.com)-installation (or Docker-Desktop for Windows-installations)
88
- Some access to the keycloak-server that's being used (may be local, or the standard remote one)
99
- Free port `8081` on your local machine (you may change that, but it has to be configured on the keycloak-client as a `valid redirect URL` like `http://localhost:<port>/*`)
1010
### Installation
1111
- Clone this repository
12-
- Copy the contents of the directory `local-wysiwig-container` to your local host
12+
- Copy the contents of the directory `wysiwyg-container-linux` or `wysiwyg` to your local host
13+
- **Windows-Only:** Open Docker-Desktop UI and go to Settings -> Resources -> File Sharing. Add your directory to the shared drives this way (the `\md` subdir).
1314
- Adjust the contents of the `.env` file
1415
- Adjust the contents of the `keycloak.json` file
15-
- Run `up.sh` to start your container as a persistent container
16+
- Run `./up.sh` on linux or `./up.ps1` on windows to start your container as a persistent container
1617
### `.env` File
1718

1819
| Field | Example-value | Description |
@@ -31,3 +32,9 @@ This should be self-explanatory for keycloak-users. It's the config file for the
3132
| auth-server-url | The full URL to the server. |
3233
| resource | The client of your application. |
3334
| secret | The client-secret of your client. |
35+
### Windows-Explanation
36+
There is a bit of a problem with file mounts on windows / WSL and programs running in either of those two contexts.
37+
While you may access `\\wsl$\<distro>\home\<user>\` from your Windows-context and `/mnt/c/utils/` from you WSL context, the file-events are not propagated over this border (and changes propagate slowly).
38+
On Windows machines you may either choose to...
39+
- ...fully use WSL, clone and push your repo from there using native WSL-installed tools and use the container and files in the `wysiwyg-container-linux`.
40+
- ...fully use Windows, clone and push your repo from there using native Windows-installed tools and use the container and files in the `wysiwyg-container-windows` directory. Then you have to use Powershell to start and stop the container.
File renamed without changes.
File renamed without changes.
File renamed without changes.

wysiwyg-container-windows/.env

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
WEBSERVER_PORT=8081
2+
PUBLIC_SERVER_URL=http://localhost:8081
3+
PUBLIC_START_PAGE=/md/index.md
4+
5+
LOCAL_DEV_MD_DIR=\path\to\your\local\md
6+
# Don't forget to add your path to the docker-desktop shared drives via
7+
# Settings -> Resources -> File Sharing.
8+
# Use baskslash and drive letters here.
9+
AUTOSCAN=true
10+
11+
INTERNAL_PORT=8080
12+
DOCKER_HUB_USER=gufalcon
13+
DOCKER_IMAGE_NAME=safe-learn
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
services:
2+
3+
safeLearn:
4+
image: ${DOCKER_HUB_USER}/${DOCKER_IMAGE_NAME}:latest
5+
container_name: safeLearn
6+
restart: unless-stopped
7+
ports:
8+
- ${WEBSERVER_PORT}:${INTERNAL_PORT}
9+
environment:
10+
- NEXT_PUBLIC_SERVER_URL=${PUBLIC_SERVER_URL}
11+
- NEXT_PUBLIC_START_PAGE=${PUBLIC_START_PAGE}
12+
- NEXT_AUTOSCAN=${AUTOSCAN}
13+
# Turn on polling so changes on local windows drives are seen reliably.
14+
- CHOKIDAR_USEPOLLING=true
15+
- CHOKIDAR_INTERVAL=500
16+
- WATCHPACK_POLLING=true
17+
- WATCHPACK_POLL_INTERVAL=500
18+
- WATCHDOG_FORCE_POLLING=true
19+
volumes:
20+
- type: bind
21+
source: "${LOCAL_DEV_MD_DIR}"
22+
target: /app/md
23+
- type: bind
24+
source: ./keycloak.json
25+
target: /app/keycloak.json
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"realm": "realm",
3+
"auth-server-url": "https://yourserver.com/",
4+
"ssl-required": "external",
5+
"resource": "client",
6+
"verify-token-audience": false,
7+
"credentials": {
8+
"secret": "clien-secret"
9+
},
10+
"use-resource-role-mappings": true,
11+
"confidential-port": 0
12+
}

wysiwyg-container-windows/up.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# up.ps1
2+
$ErrorActionPreference = "Stop"
3+
Set-Location -Path $PSScriptRoot
4+
5+
Write-Host "Pulling images..." -ForegroundColor Cyan
6+
docker compose pull
7+
8+
Write-Host "Starting containers..." -ForegroundColor Cyan
9+
docker compose up -d --force-recreate --remove-orphans
10+
11+
Write-Host "Containers are running (detached)." -ForegroundColor Green

0 commit comments

Comments
 (0)