How to keep multiple wikis running on node.js without terminal up

460 views
Skip to first unread message

Morgaine O'Herne

unread,
Aug 30, 2020, 10:37:09 PM8/30/20
to TiddlyWiki
Hi all. I have 3 wikis running on node.js on my computer. They each connect through a different port number. I want to be able to access any of them in the browser at any time without pulling up the terminal. I believe I remember doing this before, but I don't know how. How do I make my wikis permanent?

Rob Hoelz

unread,
Aug 30, 2020, 11:20:14 PM8/30/20
to TiddlyWiki
Hello!

This is how I approach that:

  1) Each wiki has a script in the same directory as tiddlywiki.info - all it does is check that the installed TiddlyWiki version matches what's in package-lock.json, set the TIDDLYWIKI_PORT environment variable, and invoke ./node_modules/.bin/tiddlywiki.  It's the TIDDLYWIKI_PORT part that's important here!
  2) I have a tmux session with a single window per wiki - in each of those windows, I run ./tiddlywiki --listen port=TIDDLYWIKI_PORT.  This way I don't have to remember which port I use for which wiki!
  3) I have custom DNS so that personal.wiki, games.wiki, etc all point to my machine running the various node processes.
  4) I have nginx set up to proxy to each node process - my config for a single wiki looks like this: https://gist.github.com/hoelzro/9a1706b2bf96c4836dfbb0c3e0afae87

-Rob

Morgaine O'Herne

unread,
Aug 31, 2020, 12:30:52 AM8/31/20
to tiddl...@googlegroups.com
Thanks Rob. I think #2 is the best I can do for the wikis on my own computer, given my current skill level.  If someone could simplify this for me, I'd be most grateful. Thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/XS0lO3_FSlo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f6416ea3-ff81-4a89-b5ee-5adccecc83e6n%40googlegroups.com.

Donald Coates

unread,
Sep 1, 2020, 10:02:18 AM9/1/20
to TiddlyWiki
What OS are you using?  There are some good tmux cheatsheets out there but you can

1) create a new session for each wiki (tmux new -s wiki1 , etc)  then tmux attach -t wiki1; run the wiki; ctrl-b then d to detach; repeat for each wiki

2) create a new session tmux new -s wiki ; then attach ; run wiki1; press ctrl-b then "quotion marks" to create a split screen! : run wiki2 then : press ctrl-b then "percentage" and get a vertical split!!!!!! and run wiki3 in that then ctrl-b then d to detach
;
To unsubscribe from this group and all its topics, send an email to tiddl...@googlegroups.com.

Darek Bobak

unread,
Sep 2, 2020, 11:19:29 AM9/2/20
to TiddlyWiki
That's how I dit it on Windows:
1. npm install -g tiddlywiki (I assume you've already done it)
2. Install pm2 - process manager for node.js (https://pm2.keymetrics.io/):
npm install pm2@latest -g
3. Initialise wiki folders:
tiddlywiki C:\Users\me\path\to\my\wiki1 --init server
tiddlywiki C:\Users\me\path\to\my\wiki2 --init server

4. Create config json files for each wiki (the sample below is for only one wiki):
tw_wiki1.json:
{
  "apps" : [{
    "name"        : "My TiddlyWiki 1",
    "script"      : "C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\tiddlywiki\\tiddlywiki.js",
    "watch"       : true,
    "cwd"         : "C:\\Users\\me\\AppData\\Roaming\\npm",
    "args"        : "C:\\Users\\me\\path\\to\\my\\wiki1 --listen port=8090",
    "out_file"    : "/dev/null",
    "error_file"  : "/dev/null"
  }]
}


out_file and error_file are logs location; setting it as /dev/null turns off logging.

5. To run your wiki, execute:
pm2 start C:\users\me\config\location\tw_wiki1.json

6. You can start, stop, restart or check status by those commands:
pm2 start all
pm2 stop all
pm2 restart all
pm2 ls


I believe that on other systems (Linux, MacOS) you'd only have to change the paths.

best,
Darek

Morgaine O'Herne

unread,
Sep 3, 2020, 11:56:40 AM9/3/20
to tiddl...@googlegroups.com
Thank you Darek, I will give this a try.


To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/11e1e3da-7516-4f2b-be6a-802b43def3e2n%40googlegroups.com.

Mark S.

unread,
Sep 3, 2020, 12:54:18 PM9/3/20
to TiddlyWiki
I understood your question to mean that you wanted to launch from the browser. So I was interested in responses. Apparently that isn't what you wanted.

If you use Bob or tiddlyserver, then all your wikis can use the same port number. You can just leave it running and have it launched by your operating system. Then just bookmark your files like you would any web page and they're available whenever you need them. The bookmarking is easier because the port number is always the same (that is, you don't have to launch each wiki with pre-determined port number). 

Morgaine O'Herne

unread,
Sep 3, 2020, 4:10:52 PM9/3/20
to tiddl...@googlegroups.com
That sounds like something I want to try. Thank you.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/XS0lO3_FSlo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

TW Tones

unread,
Sep 3, 2020, 8:52:26 PM9/3/20
to TiddlyWiki
Morgaine,

I support marks suggestion, the wikis then appear on a folder under the top wikis IP/Port address. Then you need only one IP address:port

A Couple of big tips I found are as follow, just ask if you want more details. I have assumed a certain level of knowledge in my reply, so I am happy to provide more info.

When loading node you can provide an address

Local host addresses
  • When using local host addresses very few applications realise 127.0.0.1 is the first of millions or addresses
  • This means you can get a server to listen at Server at addresses such as 127.0.4.85 
  • If you do this you can use the port 80 and need not provide the port number in the address bar (no competition for this valuable address.
  • You can even give such addresses a pseudo DNS name in the hosts file eg: bob.local 127.0.4.85
  • Thus all addresses will be bob.local/wikiname
  • This will allow you to change the IP address, even move the server to another computer if desired and all your addresses remain valid.
Using listen 0.0.0.0
  • Using this address makes the server available on a the LAN
  • It simply acquires an available port on all IP addresses assigned to the host
  • In windows and I am sure other platforms
    • You can assign additional IP addresses on the computer
    • Rather than use 0.0.0.0 use one of these additional IP addresses (Commonly taken from a static IP address range)
Using the information above I have a setup where my bob server exists locally at 
and simultaneously exists on the LAN at
With my own DNS this becomes
A Key advantage is the wikis can now always be addressed the same including links to tiddlers etc.., even If I move he server to another computer on the LAN.

Regards
Tony


On Friday, 4 September 2020 06:10:52 UTC+10, Morgaine O'Herne wrote:
That sounds like something I want to try. Thank you.

On Thu, Sep 3, 2020 at 10:54 AM 'Mark S.' via TiddlyWiki <tiddl...@googlegroups.com> wrote:
I understood your question to mean that you wanted to launch from the browser. So I was interested in responses. Apparently that isn't what you wanted.

If you use Bob or tiddlyserver, then all your wikis can use the same port number. You can just leave it running and have it launched by your operating system. Then just bookmark your files like you would any web page and they're available whenever you need them. The bookmarking is easier because the port number is always the same (that is, you don't have to launch each wiki with pre-determined port number). 


On Sunday, August 30, 2020 at 7:37:09 PM UTC-7, Morgaine O'Herne wrote:
Hi all. I have 3 wikis running on node.js on my computer. They each connect through a different port number. I want to be able to access any of them in the browser at any time without pulling up the terminal. I believe I remember doing this before, but I don't know how. How do I make my wikis permanent?

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/XS0lO3_FSlo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddl...@googlegroups.com.

Darek Bobak

unread,
Sep 4, 2020, 7:04:35 AM9/4/20
to TiddlyWiki
Yes, the tiddlyserver seems to be a better option. And you can also run tiddlyserver with pm2, putting it in the bacground (or even run  at system startup) without terminal window open.

Darek

oha...@gmail.com

unread,
Sep 4, 2020, 8:48:23 AM9/4/20
to TiddlyWiki
I use TiddlyServer for this, with the added benefit of being able to take my large files out of my TiddlyWikis and still serve them using TiddlyServer to access them inside any Wiki with just a canonical_uri or direct link.

TW Tones

unread,
Sep 5, 2020, 2:59:53 AM9/5/20
to TiddlyWiki
On other thing

When I setup node on my android and my Disk Station some liniux people told be to load tiddlywiki with the nohup command, no hang up, it returns to the console and you can load another.

I am not expert here.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages