tw editions and docker questions

102 views
Skip to first unread message

Jean-Pierre Rivière

unread,
Sep 9, 2021, 5:23:54 PMSep 9
to TiddlyWiki
Hi everybody!

I need to have some of my tiddlywiki being onto nodejs to gain some functionality. For this, I have selected docker to have iti as easy as I can. Besides docker, I need some shell script to setup the wiki (docker images) ready to launch (listen command). Good point: this was an occasion for me to invest into docker.

But there remains a problem, which is that of the tiddlywiki edition. the "editions" command list the available options with a quick summary. But some options would gain a little more explanations, like the server-external-js which seems to mean that the js is not mangled inside the js. That could be useful to serve several wikis from the same server.

But in fact, I need a localized edition. Alas, editions are not cumulative (but the server-external-js really should be an option and not a proper edition because that's not an editorial difference at all and it could be useful for many editions).

By localized, I mean that I want the content in French, but without all the fuss of fr-FR editions which I would need to get rid of but for a few tiddlers (and this would be a burden to implement and maintain). As for the fr-FR-server, the interface has not been translated (I wonder what has been translated and where I could find this information?)

docker code used (without the volume and port stuff) on my tiddlywiki docker image tiddock:

docker run -d --rm tiddock wiki --init fr-FR-server
docker run -d --rm tiddock server host=0.0.0.0

(I used elasticdog Dockerfile and shells to see what was needed to do. Thanks elasticdog!)

Also, if I understand what is said here, I must not directly use tiddlywiki for a production wiki but use a proxy liki nginx can provide. I have no knowledge of nginx so far. Where could I find some useful docs or sources of a tiddlywiki with this kind of setup?

Thanks in advance for your help.

PMario

unread,
Sep 10, 2021, 10:04:07 AMSep 10
to TiddlyWiki
Hi,

It would be nice to have some links to the docker file and docs that you used. ... Your docker start commands look super strange.

> docker run -d --rm tiddock wiki --init fr-FR-server
> docker run -d --rm tiddock server host=0.0.0.0

That's not how it should be done. ... the fr-FR-server  is ONLY used for development, since it contains an includeWikis parameter, that includes the French wiki translatiions and it includes the english original wiki content as "read only". ... So  that's a complete m

The whole TW initialisation of your wiki folders should be done with the docker build commands.

The commands you posted won't work at all. The complete volume info is missing. ...

As I wrote, if you give a link to the docker build file it would be easier to help.

-mario

mauloop

unread,
Sep 11, 2021, 6:59:09 PMSep 11
to TiddlyWiki
I published on Github a little project to run Tiddlyserver with Docker. You can find it at https://github.com/mauloop/tiddlyserver-docker.
It allows multiple wikis within a single server instance and custom editions path.

I made it for my own use,  so it does not provide very rich documentation, but just a quick and dirty readme with minimum commands needed to get started. However it could fit some of your requirements.

Finally here is good example about how to set up Apache to proxy a Nodejs TW5. I think it could work with TiddlyServer too with very little changes, but I never experienced this.

Hope this could help. Have fun, )+(auloop

Jean-Pierre Rivière

unread,
Sep 15, 2021, 6:43:10 AMSep 15
to TiddlyWiki
Hi @PMario and mauloop!

I(ve taken my time but I can now bring some valuable new input. But before that, let me thank you for your answers. I've dipped deeper in docker and nodejs tiddlywiki as a result. And I can tell you that I've finally come to a successful setup but some problems are still there. But I can create an OK docker image and use it to launch it a suceesfull tiddlywiki and load stuff inside before really launching it as a server (I have not yet seen how to use apache as a proxy).

So for the sake of answering my question, here is my Dockerfile:
---------
# Dockerfile pour lancer le tiddlywiki proteva
# copiée et adaptée du modèle elasticdog/tiddlywiki disponible sur le docker hub
from node:16.9.0-alpine3.11

LABEL author="Jean-Pierre RIVIÈRE"
LABEL content="instance de nodejs avec le tiddliwki proteva"

env TIDDLYWIKI_VERSION=5.1.23
env PROTEVA_FEED=proteva-data.json
env WORKDIR=/usr/share/tiddlywiki/proteva-wiki

EXPOSE 8080

WORKDIR $WORKDIR
VOLUME $WORKDIR

run apk update && apk add --no-cache tini
run npm install -g tiddlywiki@$TIDDLYWIKI_VERSION && npm install clean --force

#ENTRYPOINT ["tiddlywiki", "proteva"]
#CMD ["--listen", "host=0.0.0.0"]
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["tiddlywiki", "proteva", "--listen", "host=0.0.0.0"]
------

and here is my proteva.sh script that I use to manage the wiki with ./proteva.sh init  && ./proteva.sh start
--------
#!/bin/sh
# shell pour initialiser ou lancer proteva via docker

IMAGE=proteva
WIKI=$IMAGE
PROTEVA_FEED=proteva-data.json
PROTEVA_DIR=$PWD/proteva-data
WORKDIR=/usr/share/tiddlywiki/proteva-wiki
EDITION=rerver

case $1 in
  init)
    echo wiping $PROTEVA_DIR
    [ -d $PROTEVA_DIR ] && sudo rm -rf $PROTEVA_DIR
    mkdir $PROTEVA_DIR
    echo building $IMAGE docker image
    sudo docker build . -t $IMAGE
    echo built
    sudo docker run --rm -v $PROTEVA_DIR:$WORKDIR $IMAGE tiddlywiki $WIKI --init $EDITION
    echo initialized
    cp $PROTEVA_FEED $PROTEVA_DIR
    sudo docker run --rm -v $PROTEVA_DIR:$WORKDIR $IMAGE tiddlywiki $WIKI --load $PROTEVA_FEED
    rm $PROTEVA_DIR/$PROTEVA_FEED
    echo import done
    ;;
  start)
    [ -d $PROTEVA_DIR ] || mkdir $PROTEVA_DIR
    sudo docker run --rm -it -p 8080:8080 -v $PROTEVA_DIR:$WORKDIR --name $WIKI $IMAGE tiddlywiki $WIKI --listen host=0.0.0.0
    ;;
  *) echo "usage : ${0##/} ORDER"
     echo '  where ORDER is either "init" or "start"'
     echo '  to initialize or launch proteva tiddlywiki nodejs via docker.'
     ;;
esac
----------------

Now for the remaining problem: the fr-FR-server edition seems at fault. If I use iti instead of server (as value of the EDITION variable in the script)' the --init and --listen part is OK (launching the "proteva" wiki), the --load part is wrong for the data are copied in the fr-FR sub-directory (instead of the proteva sub-directory). Besides, I can't see any French with that edition.

the real command I use is:

sudo docker run --rm -v /home/jnpr/big/workspace/accessibilite/dockerized/proteva-data:/usr/share/tiddlywiki/proteva-wiki proteva tiddlywiki proteva --load proteva-data.json

This commands create this strucure all of its own:

proteva-data
├── fr-FR
│   └── tiddlers
│       ├── $__StoryList.tid
│       └── TODO.tid

(proteva-data is created previously along proteva-data/proteva by --init)

Where can I get the fr-FR sources/fellows of this project to help sort out this mystery?

Xavier Cazin

unread,
Sep 15, 2021, 9:20:35 AMSep 15
to tiddl...@googlegroups.com
Hi Jean-Pierre,

Historically, the fr-FR and fr-FR-server editions were aimed at providing a translated version of tw5.com. I had wanted to gather a team of translators in order to achieve this, but I eventually gave up as the task seemed too daunting. I focused instead on the fr-FR language plugin.

What you experience — tiddlers are saved in the fr-FR sub-directory instead of the served wiki — is probably due to the "default-tiddler-location": "../fr-FR/tiddlers" in the config of the fr-FR-server edition. If you remove that before you --init a new wiki, you will get a more natural behaviour. If you confirm that it solves the problem, I'll propose a removal from the official edition.

Cheers,
-- Xavier Cazin.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f81dff53-55f4-4d85-b0b7-07605729288dn%40googlegroups.com.

Jean-Pierre Rivière

unread,
Sep 15, 2021, 2:55:15 PMSep 15
to TiddlyWiki
Hi Xavier,

Thanks for your telling. I found only one occurence of default-tiddler-location and that's in $:/boot/boot.js :

if ($tw.boot.wikiPath == wikiPath) { $tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir); }

Well... so what? Where is the change I should made? Is that a modification within $:/core/modules/config.js ? I have not found any reference to fr-FR so I assume it was deducted from the name of the file/plugin.

Where are the sources for fr-FR and fr-FR-server?

I have found the same problem with es-ES-server and ko-KR-server which are the two only other translated server editions.

Regards,

Xavier Cazin

unread,
Sep 16, 2021, 6:56:22 AMSep 16
to tiddl...@googlegroups.com
Hi Jean-Pierre,

Per the tree of the TW5 source:

src/
└── TiddlyWiki5
    (...)
    ├── editions
    │   ├── fr-FR
    │   │   ├── tiddlers
    │   │   │   ├── (a few translated tiddlers from tw5.com)
    │   │   └── tiddlywiki.info
    │   ├── fr-FR-server
    │   │   ├── tiddlers
    │   │   │   ├── config-Navigation-UpdateAddressBar.tid
    │   │   │   ├── config-more-button.tid
    │   │   │   └── system
    │   │   │       ├── favicon.ico
    │   │   │       └── favicon.ico.meta
    │   │   └── tiddlywiki.info
    │  (...)
    └── tiddlywiki.js


you may want to study the config parameter in the tiddlywiki.info files.

Cheers,
-- Xavier Cazin.

Jean-Pierre Rivière

unread,
Sep 16, 2021, 7:13:54 AMSep 16
to TiddlyWiki
thank you Xavier. got it.

As for fr-FR-server, I think it should only have these tiddlers for its tiddlers (no more, no less):

├── $__Acknowledgements.tid
├── $__ContributionBanner.tid
├── $__core_ui_DefaultSearchResultList.tid
├── $__core_ui_ListItemTemplate.tid
├── $__core_ui_SideBar_Open.tid
├── $__core_ui_TagTemplate.tid
├── $__core_ui_ViewTemplate_title.tid
├── $__CurvedText.tid
├── $__DefaultTiddlers.tid
├── $__editions_fr-FR_CSS stylesheets_latex.tid
├── $__editions_fr-FR_CSS Stylesheets_mesStyles.tid
├── $__editions_fr-FR_CSS Stylesheets_utils.tid
├── $__editions_fr-FR_Macros_list.tid
├── $__editions_fr-FR_Macros_timeline-title.tid
├── $__editions_fr-FR_Macros_toc-caption.tid
├── $__editions_fr-FR_Macros_wikitexte-exemple.tid
├── $__editions_fr-FR_util-macros.tid
├── $__SiteSubtitle.tid

Now, the question I need to ask: how would I proceed to build tw from my own modified tw repository in order to check if that is the case or not that modifying of tiddlywiki.info is doing what we want to achieve?

Jean-Pierre Rivière

unread,
Sep 18, 2021, 4:23:48 PMSep 18
to TiddlyWiki
I'm sorry Xavier, but I've been unable to create any edition to see what you suggest would do. I haven't understood how to do it. Could you help me please?

cheers,

Le mercredi 15 septembre 2021 à 15:20:35 UTC+2, xca...@immateriel.fr a écrit :

Xavier Cazin

unread,
Sep 19, 2021, 8:40:17 AMSep 19
to tiddl...@googlegroups.com
Hi Jean-Pierre,

Embarrassingly, I'm not sure I still grasp the whole thing anymore. The confusing thing is that the fr-FR server edition is not meant as an fr-FR localisation of the server edition (nor any xx-YY-server editions by the way). As far as I know, they are mostly useful when one wants to edit the source of their xx-XX edition counterpart in-place (typically in a dedicated git branch).

With the help of https://tiddlywiki.com/prerelease/#tiddlywiki.info%20Files, it must be possible to combine these editions in order to create a NodeJS wiki that is bootstrapped with the payload tiddlers contained in these editions, but I didn't succeed to write down a straightforward description of the process. Maybe @pmario has a better understanding of these mechanisms?

-- Xavier.


Jean-Pierre Rivière

unread,
Sep 19, 2021, 4:14:45 PMSep 19
to TiddlyWiki
Thank you Xavier.

I'm closing this topic and will start another one on Talk about having localized server edition for the sake of it and not that of translating another edition.

PMario

unread,
Sep 20, 2021, 10:11:16 AMSep 20
to TiddlyWiki
On Sunday, September 19, 2021 at 2:40:17 PM UTC+2 xca...@immateriel.fr wrote:

Embarrassingly, I'm not sure I still grasp the whole thing anymore. The confusing thing is that the fr-FR server edition is not meant as an fr-FR localisation of the server edition (nor any xx-YY-server editions by the way). As far as I know, they are mostly useful when one wants to edit the source of their xx-XX edition counterpart in-place (typically in a dedicated git branch).

That's right. It's there for users, who want to translate the content of tiddlywiki.com to the French language.
fr-FR-server includes the fr-FR wiki content, which is the translated content
fr-FR includes ../tw5.com as readOnly             ... As I wrote. This is for development only!
 
With the help of https://tiddlywiki.com/prerelease/#tiddlywiki.info%20Files, it must be possible to combine these editions in order to create a NodeJS wiki that is bootstrapped with the payload tiddlers contained in these editions, but I didn't succeed to write down a straightforward description of the process. Maybe @pmario has a better understanding of these mechanisms?

If you want to "spawn" a french server you have to do this:

tiddlywiki myWiki --init server

add this to your tiddlywiki.info file the was created in myWiki folder

    "languages": [
        "fr-FR"
    ],


So the whole file will look like this:

{
    "description": "Basic client-server edition",
    "plugins": [
        "tiddlywiki/tiddlyweb",
        "tiddlywiki/filesystem",
        "tiddlywiki/highlight"
    ],
    "themes": [
        "tiddlywiki/vanilla",
        "tiddlywiki/snowwhite"
    ],
    "languages": [
        "fr-FR"
    ],
    "build": {
        "index": [
            "--rendertiddler","$:/plugins/tiddlywiki/tiddlyweb/save/offline","index.html","text/plain"
        ],
        "static": [
            "--rendertiddler","$:/core/templates/static.template.html","static.html","text/plain",
            "--rendertiddler","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
            "--rendertiddlers","[!is[system]]","$:/core/templates/static.tiddler.html","static","text/plain",
            "--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain"
        ]
    }
}

Start your server:

tiddlywiki sWiki --listen

-mario

PMario

unread,
Sep 20, 2021, 10:12:55 AMSep 20
to TiddlyWiki
After the server is started, you need to switch the language setting to French manually
-m

Jean-Pierre Rivière

unread,
Sep 20, 2021, 1:37:43 PMSep 20
to TiddlyWiki
Thank you PMario, this is hugely appreciated.

As for manually selecting French, it can be automated as

tiddlywiki --load french.json

where french.json is

============
[{text:$:/languages/fr-FR,title:$:/language}]
============

There is no created field for this tiddler this way, though. I could forge one if is was really necessary.
Reply all
Reply to author
Forward
0 new messages