-
Install termux from f-dropid
-
Grant permissions to access storage Android Settings -> Apps -> Termux -> Permissions
-
Setup home directory (this wouldn't work over ssh)
termux-setup-storage pkg install termux-api
-
Install ssh
pkg install openssh
-
set temporary password
passwd
-
start ssh server
sshd
-
copy ssh key to the phone
ssh-copy-id -p 8022 -i ~/.ssh/id_rsa 192.168.1.7
-
istall text editor so you can edit files
pkg install micro
-
disable remote access using password. By setting
PasswordAuthentication no
and commenting outSubsystem sftp
micro $PREFIX/etc/ssh/sshd_config
the file should look like the foloowing
cat $PREFIX/etc/ssh/sshd_config PrintMotd no PasswordAuthentication no PubkeyAcceptedKeyTypes +ssh-dss #Subsystem sftp /data/data/com.termux/files/usr/libexec/sftp-server
- install depdendencies
pkg update pkg install golang git
- get source
go get github.com/mholt/caddy/caddy
- get build tools
go get github.com/caddyserver/builds
- move caddy binary to bin
mv go/bin/caddy bin/
Simplified version of runit is available in termux. It is compiled in into a busybox app.
- Install daemonize package
pkg install daemonize
- Add following into
~/.bash_profile
if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi export SVDIR="$HOME/etc/sv" mkdir -p $PREFIX/var/run mkdir -p ~/.log daemonize -c $PREFIX \ -l $PREFIX/var/run/runsvdir.lock \ -p $PREFIX/var/run/runsvdir.pid \ $PREFIX/bin/applets/runsvdir \ $SVDIR 2>/dev/null||:
-
Clone Tiddlywki repository
mkdir -p /data/data/com.termux/files/home/storage/shared/Wiki cd /data/data/com.termux/files/home/storage/shared/Wiki git clone https://github.com/Jermolene/TiddlyWiki5
-
Install nodejs
pkg install nodejs
-
Install Bob
git clone --depth=1 https://github.com/OokTech/TW5-Bob.git /data/data/com.termux/files/home/storage/shared/Wiki/TiddlyWiki5/plugins/OokTech/Bob mkdir /data/data/com.termux/files/home/storage/shared/Wikis cp -r /data/data/com.termux/files/home/storage/shared/Wiki/TiddlyWiki5/plugins/OokTech/Bob/MultiUserWiki /data/data/com.termux/files/home/storage/shared/Wiki/Wikis/BobWiki
-
Configure Bob
{ "wikis": { "main": { "__path": "main" }, "testing": { "__path": "testing" } }, "scripts": { "NewWiki": "tiddlywiki #wikiName --init #editionName" }, "ws-server": { "port": 8090, "host": "127.0.0.1", "autoIncrementPort": false, "pathprefix": "/wiki" }, "heartbeat": { "interval": 1000 }, "wikiPathBase": "/data/data/com.termux/files/home/storage/shared/Wiki", "editionsPath": "./TiddlyWiki5/editions", "wikisPath": "./Wikis", "pluginsPath": "./plugins", "themesPath": "./themes", "API": {}, "serverInfo": { "ipAddress": "10.1.10.1", "port": 8090, "host": "127.0.0.1" }, "includePluginList": {}, "excludePluginList": {} }
-
Add host alias into /etc/hosts. We cannot use IP addresses due to this issue caddyserver/caddy#2356
- open AdAway app and add
phone.local
into your lists
-
Create
etc/Caddy
file with following content.# entrypoint for accessing from PC phone.local:8080 { tls /data/data/com.termux/files/home/etc/phone.crt /data/data/com.termux/files/home/etc/phone.key basicauth /wiki "username" password proxy /wiki 127.0.0.1:8090 { without /wiki } # entrypoint for accessing locally from phone 127.0.0.1:8000 { proxy /wiki 127.0.0.1:8090 { websocket } }
-
Generate self signed certificate
pkg install openssl-tool openssl req -new -x509 -newkey rsa:2048 -keyout etc/phone.key -out etc/phone.crt -days 10000 -nodes -subj /CN=phone.local openssl pkcs12 -export -out etc/phone.pfx -inkey etc/phone.key -in etc/phone.crt
-
Add start scripts for runit
cat etc/sv/caddy/run #!/data/data/com.termux/files/usr/bin/sh exec /data/data/com.termux/files/home/bin/caddy -conf /data/data/com.termux/files/home/etc/Caddyfile 2>&1
cat etc/sv/caddy/log/run #!/data/data/com.termux/files/usr/bin/sh # Get the name of the service from the PWD, this assumes the name of the # service is one level above the log directory. pwd=${PWD%/*} # $SVDIR/service/foo/log service=${pwd##*/} # foo mkdir -p "$HOME/.log/sv/$service" exec svlogd -tt "$HOME/.log/sv/$service"
cat etc/sv/wiki/run #!/data/data/com.termux/files/usr/bin/sh WIKI_ROOT=/data/data/com.termux/files/home/storage/shared/Wiki export TIDDLYWIKI_PLUGIN_PATH=${WIKI_ROOT}/TiddlyWiki5/plugins export TIDDLYWIKI_EDITION_PATH=${WIKI_ROOT}/TiddlyWiki5/editions exec node ${WIKI_ROOT}/TiddlyWiki5/tiddlywiki.js ${WIKI_ROOT}/Wikis/BobWiki/ --wsserver
cat etc/sv/wiki/log/run #!/data/data/com.termux/files/usr/bin/sh # Get the name of the service from the PWD, this assumes the name of the # service is one level above the log directory. pwd=${PWD%/*} # $SVDIR/service/foo/log service=${pwd##*/} # foo mkdir -p "$HOME/.log/sv/$service" exec svlogd -tt "$HOME/.log/sv/$service"