Webclipper port with joplin terminal

Could it be possible to open the port of the webclipper when using joplin terminal ?
Thus we won’t have to start the Joplin Desktop and thus joplin-web could be used on a dedicated hosting services too.
Today all run on a workstation which blocks some users for joplin-web

1 Like

It’s still the same issue, we’d need to finish the headless server feature: https://github.com/laurent22/joplin/tree/headless-server

ha I knew something existed about it but did not find it.

Hope to see it soon :slight_smile:
THanks for all the work!

I’ve added the server command in v145, could you give it a try?

server <command>

    Start, stop or check the API server. To specify on which port it should run, set the api.port
    config variable. Commands are (start|stop|status). This is an experimental feature - use at your
    own risks! It is recommended that the server runs off its own separate profile so that no two
    CLI instances access that profile at the same time. Use --profile to specify the profile path.

For example, in one terminal you can run joplin server start, and in another joplin server status to check the status or joplin server stop to stop the server. You can also make the server run in background using joplin server start &.

Thanks, I’ll try this evening

A post was split to a new topic: CLI error updating from 141 to 145

the server start but ignore the token parms

00:43:39 [foxmask@localhost:~] 1 $ joplin server start
2019-09-09 00:43:48: "Starting Clipper server on port 41184"
2019-09-09 00:43:54: "Request: GET /folders/?token=fff6170db0bbb65ff563fc5977d533a0b4a60ce3203b8c6252f500fbf9e37211a056dcc8f7cf6239e8745a90bd62da0ff328fcc6e8162552139e382301520ca8&fields=id%2C+title%2C+created_time%2C+updated_time%2C+user_created_time%2C+user_updated_time%2C+encryption_cipher_text%2C+encryption_applied%2C+parent_id"
2019-09-09 00:43:54: "Request: GET /tags/?token=fff6170db0bbb65ff563fc5977d533a0b4a60ce3203b8c6252f500fbf9e37211a056dcc8f7cf6239e8745a90bd62da0ff328fcc6e8162552139e382301520ca8"
2019-09-09 00:43:54: "Error: Invalid "token" parameter
Error: Invalid "token" parameter
    at Api.checkToken_ (/home/foxmask/.joplin-bin/lib/node_modules/joplin/lib/services/rest/Api.js:180:49)
    at Api.defaultAction_ (/home/foxmask/.joplin-bin/lib/node_modules/joplin/lib/services/rest/Api.js:184:8)
    at Api.action_tags (/home/foxmask/.joplin-bin/lib/node_modules/joplin/lib/services/rest/Api.js:301:15)
    at Api.route (/home/foxmask/.joplin-bin/lib/node_modules/joplin/lib/services/rest/Api.js:138:42)
    at execRequest (/home/foxmask/.joplin-bin/lib/node_modules/joplin/lib/ClipperServer.js:157:39)
    at Server.server_.on (/home/foxmask/.joplin-bin/lib/node_modules/joplin/lib/ClipperServer.js:199:7)
    at Server.emit (events.js:198:13)
    at parserOnIncoming (_http_server.js:677:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)"

I made another try and it’s working

I did not start the server with the expected profile path

 joplin --profile ~/.config/joplin-desktop/ server start

looks better !

Thanks a lot !!

1 Like

For over a decade now I have been using Evernote with a wireless scanner to archive the various “important” snail mail items we get. I could drop a document into the scanner, it would upload that to a folder on my desktop mac, which in turn would cause a script to launch Evernote and add the document as a new note to the Inbox notebook.

The end result is anyone in the family could send a doc, receipt, etc. to Evernote with one button push and Evernote would OCR it so it was searchable. This worked great.

I am trying to move to self-hosting with Joplin and I desire to re-create this wonderful setup. Another problem is my scanner will no longer upload to my mac in the latest MacOS (Catalina).

Ok - here’s what I got set up:

GOAL: Drop a document into a scanner, hit scan, doc appears OCR’d in Joplin’s synced storage in Nextcloud.

My Setup:

  • Intel NUC (headless) running Ubuntu and Docker
  • I created a docker container with rest_uploader, all the dependencies for OCRing and Joplin CLI.

How I run it:

  • Run joplin & (starts an instance of the joplin CLI)
  • Run joplin server start & (gets the clipper API running)
  • Run rest_uploader /my_watch_dir

So at this point, when a new doc hits /my_watch_dir, it fires up rest_uploader, which OCRs the doc, and uploads to joplin server. The “regular” joplin instance ‘sees’ the new note and syncs with Nextcloud. My Mac syncs with nextcloud and so a few minutes after hitting “scan” I have what I want.

My question is - Is this the “simplest” I can make it? I have to run two instances of joplin (server and regular) to make this work… is there any way the server can “sync” without needing a second instance of Joplin? The Joplin CLI doesn’t seem to listen for the clipper API - or am I missing something?

2 Likes

I’ve been able to somewhat get this working with just the webclipper service and cron in a docker container. I’ve got some other changes in this branch, but I’m hoping to get something clean up this weekend that I can link to in the forum. Note: I don’t have rest_uploader in my image, but I think the same principle will apply.

Essentially, I’m doing about the same thing, but instead of starting up joplin cli with joplin, I’ve created a cron job that runs joplin sync. I’m not sure if this is better, but it does appear to be mostly working for me.

Rough outline of my Dockerfile is:

  1. Build joplin from source (working with a slightly modified version)
  2. Setup cron
  3. Start joplin server
  4. (Rest_uploader?)

I already asked this question in the other thread but didn’t get an answer yet so here’s another shot.

When a new note is created by rest_uploader the regular instance of joplin CLI doesn’t automatically detect the change and hence doesn’t sync. I have to manually sync via joplin sync in order to make the sync happen.
I’d like to avoid running a cron job that syncs every 5 or so minutes as this drives my cpu usage up to around 80% for a few seconds which will impact the performance of other services running on the same host.

@laurent is Joplin CLI supposed to automatically sync whenever there’s a new note?

Yes

Little update: Auto sync works just fine as long as I don’t run joplin CLI in the background.
With joplin & auto sync is no working for some reason (process is running)
Running joplin in a screen session or as a supervisor daemon has been working without issues so far.

I'm trying to set up a headless Joplin server running in a Docker container using the "joplin server start" command, with the goal of being able to interact with the web clipper API remotely (i.e. from another Docker container).
I notice that there is an "api.port" setting which can be configured via "joplin config", however the server's bind address is hard-coded to '127.0.0.1', which makes it impossible to access it from outside the Docker container.
Could you please consider adding an "api.host" configuration setting that would enable binding to "0.0.0.0"?

The goal here being to set up a headless server running in the cloud to facilitate integration with n8n.io or Zapier: specifically, a cloud-based "email to Joplin" workflow, where emails sent to an IMAP email inbox get added to Joplin as notes. I've got this mostly working by installing Joplin alongside n8n.io in the same Docker image, but it would be much cleaner to have a separate headless Joplin container listening on 0.0.0.0.

Let me know if I'm making sense. :slight_smile:

EDIT: Just noticed this thread. Have security issues been resolved with the use of the "api.token", such that (optional) use of 0.0.0.0 with a required secret token would be secure enough? I'm by no means a security expert, but it seems so to me. Cheers.

@laurent @tessus In the meantime, I've resorted to running an nginx reverse proxy in the same container as the headless joplin web clipper, with a cron job for syncing:

Updated: now using socat instead of nginx for the 0.0.0.0:80 => 127.0.0.1:41184 port forward of the dockerized Joplin clipper server container