{"id":13314183,"url":"https://github.com/jspiers/headless-joplin","last_synced_at":"2025-03-10T20:33:33.308Z","repository":{"id":158128174,"uuid":"337880839","full_name":"jspiers/headless-joplin","owner":"jspiers","description":"Dockerized Joplin terminal client with exposed Data API","archived":false,"fork":false,"pushed_at":"2024-02-24T18:57:17.000Z","size":74,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-29T19:05:54.248Z","etag":null,"topics":["cli","container","container-image","docker","headless","joplin","joplin-api"],"latest_commit_sha":null,"homepage":"https://joplinapp.org/api/references/rest_api/","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jspiers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-02-10T23:21:02.000Z","updated_at":"2024-03-30T15:16:18.000Z","dependencies_parsed_at":"2023-09-26T07:29:07.159Z","dependency_job_id":null,"html_url":"https://github.com/jspiers/headless-joplin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jspiers%2Fheadless-joplin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jspiers%2Fheadless-joplin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jspiers%2Fheadless-joplin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jspiers%2Fheadless-joplin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jspiers","download_url":"https://codeload.github.com/jspiers/headless-joplin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242922053,"owners_count":20207142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","container","container-image","docker","headless","joplin","joplin-api"],"created_at":"2024-07-29T18:11:02.420Z","updated_at":"2025-03-10T20:33:33.286Z","avatar_url":"https://github.com/jspiers.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# headless-joplin\n\nA Docker container which runs the [Joplin terminal client] as a daemon with its web clipper service exposed on port 80.[^1]\n\n[^1]: Because the [Joplin terminal client] Clipper Server is [hard-coded](https://github.com/laurent22/joplin/blob/a58d1d040cfdb0c9898e02b7c96ea9abff13270b/packages/lib/ClipperServer.ts#L231) to bind to localhost `127.0.0.1`, the `headless-joplin` container includes a background [socat] service which redirects to that localhost port from the container's external port `0.0.0.0:80`\n\nSynchronization, encryption, and other Joplin parameters may be configured by mounting a [JSON config file] to `/run/secrets/joplin-config.json` or equivalently by creating a secret named `joplin-config.json` in a `docker-compose.yml` file.\n\n## Basic Usage:\n\nTry out one of the tagged images from the [container registry]:\n```\ndocker run --rm -p 3000:80 --name my_joplin_container jspiers/headless-joplin:2.12.1-node-18.18.0\n```\nThen, in another terminal, check that the Joplin Clipper server (*i.e.* [Data API]) is running from your host's command-line:\n```\ncurl http://localhost:3000/ping\n```\nYou should get a response of `JoplinClipperServer`.\n\nYou can also open the [Joplin terminal client] running on the container to interactively view/edit notes:\n```\ndocker exec -it my_joplin_container joplin\n```\n\nWhen done, stop the container by typing *Ctrl-C*. Because we specified the `--rm` option when invoking `docker run` above, the container is automatically deleted.\n\n## Persistent Joplin Data\nTo persist Joplin data between runs of the Docker container, mount a volume at `/home/node/.config/joplin`:\n```\ndocker run --rm -p 3000:80 --name my_joplin_container -v joplin-data:/home/node/.config/joplin jspiers/headless-joplin:2.12.1-node-18.18.0\n```\n\n## Configuration:\n\n### Environment Variables\nSet `JOPLIN_LOG_ENABLED=true` to tell the container to display the contents of Joplin's log file (`log.txt`) in the Docker logs in real time.\n\n```\ndocker run --rm -p 3000:80 --name my_joplin_container -e JOPLIN_LOG_ENABLED=true jspiers/headless-joplin:2.12.1-node-18.18.0\n```\n\n### Joplin JSON Config File\n\nThe [Joplin terminal client] includes commands for importing and exporting its settings in JSON format:\n```\njoplin config --export \u003e json-config.json\n```\nAnd then in another joplin instance:\n```\njoplin config --import-file json-config.json\n```\n\nSee the [official Joplin terminal documentation](https://joplinapp.org/terminal/#commands) for supported JSON key/value pairs. **Note:** there are also several unofficial configuration keys, which can be exported/observed by adding the '-v' flag to the export command: `joplin config --export -v`. For example, the encryption master password can be set via `encryption.masterPassword`.\n\n#### How `headless-joplin` Configures Joplin\n`headless-joplin` leverages the Joplin terminal client's JSON configuration functionality to configure Joplin via three files:\n1. [default settings](joplin-config-defaults.json) suitable for most envisioned scenarios;\n2. an optional JSON configuration file which can either be provided as a Docker secret with the name `json-config.json`, or equivalently, by mounting a JSON file at a location specified via the `JOPLIN_CONFIG_JSON` environment variable, which defaults to `/run/secrets/joplin-config.json`; and\n3. [required settings](joplin-config-required.json) expected by `headless-joplin` for its correct operation.[^2]\n\nFor example, to load a `joplin-config.json` file from your current directory:\n[^2]: Special note regarding `sync.interval`: When running in server mode, the Joplin terminal client does not (as of Joplin version 2.12.1) perform any synchronization of its own, even if the `sync.interval` is set to a non-zero value. To account for this, the `headless-joplin` container is designed to read the `sync.interval` value from either the defaults or the user-provided JSON config file, and periodically invoke the `joplin sync` command as a background process.\n\n```\ndocker run --rm -p 3000:80 --name my_joplin_container -v ${PWD}/joplin-config.json:/run/secrets/joplin-config.json jspiers/headless-joplin:2.12.1-node-18.18.0\n```\n\nIn particular, consider specifying `api.token` override the default value for the sake of [security](#security-considerations).\n\n## Docker Compose\nFor most scenarios, it is more convenient to configure a `headless-joplin` container via a `docker-compose.yml` file.\n\n### Examples\nSee the [examples] subdirectory for `docker-compose.yml` files suitable for a few scenarios.\n\n## Build Options:\n\nIf you clone the repo, you can also build the Docker image yourself:\n```\ndocker build . -t headless-joplin\ndocker run --rm -p 3000:80 headless-joplin\n```\n\n### Set Joplin and/or Node versions\n```\ndocker build . -t headless-joplin --build-arg JOPLIN_VERSION=2.3.2 --build-arg NODE_VERSION=16\n```\n\u003e Joplin version should be set to one of the official *[joplin](https://www.npmjs.com/package/joplin?activeTab=versions)* NPM package versions.\n\n\u003e Node version should be one of the official *[node](https://hub.docker.com/_/node/tags)* Docker image tags.\n\n### Building with Docker Compose\nJust run the following in the root directory of the repo:\n\n```\ndocker compose build\n```\n\n## Security Considerations\n### Insecure HTTP\nCommunication with the `headless-joplin` [Data API] on its exposed port 80 is via insecure HTTP. As such, care should be taken not to expose this port to public networks. The intended usage of `headless-joplin` is to communicate with other containers via an internal network (*e.g.* declared with `internal: true` in a `docker-compose.yml`).\n\nFor scenarios where the `headless-joplin` [Data API] is to be accessed via a public network, a reverse-proxy sidecar container (*i.e.* [nginx], [traefik], or [Caddy]) could be used to secure the connection.\n\n### API Token\nThe default configuration sets the `api.token` to a value of `mytoken`. This should be set to a secret value provided to the container via a [JSON config file].\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n[Joplin]: https://github.com/laurent22/joplin/\n[Joplin terminal client]: https://joplinapp.org/terminal/\n[socat]: https://linuxcommandlibrary.com/man/socat#tldr\n[container registry]: https://hub.docker.com/r/jspiers/headless-joplin/\n[Data API]: https://joplinapp.org/api/references/rest_api/\n[JSON config file]: #joplin-json-config-file\n[examples]: examples\n[nginx]: https://domysee.com/blogposts/reverse-proxy-nginx-docker-compose\n[traefik]: https://doc.traefik.io/traefik/user-guides/docker-compose/basic-example/\n[Caddy]: https://github.com/lucaslorentz/caddy-docker-proxy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjspiers%2Fheadless-joplin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjspiers%2Fheadless-joplin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjspiers%2Fheadless-joplin/lists"}