Skip to content

Instantly share code, notes, and snippets.

@khia
Created May 18, 2018 10:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khia/471f8e74e36d5401adcce139172ae594 to your computer and use it in GitHub Desktop.
Save khia/471f8e74e36d5401adcce139172ae594 to your computer and use it in GitHub Desktop.
How to run TW5 on andriod
cat data/data/com.termux/files/home/.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||:

Install dependencies

  1. Install termux via android market
  2. Install packages
    apt install sv golang daemonize git termux-api termux-tools nodejs
    
  3. Compile caddy and place binary to bin/caddy

Configure wiki

Update $:/config/tiddlyweb/hosttiddler

$protocol$//$host$/wiki

Note:There shouldn’t be colon between $protocol$and $host$. Because the values are:

$protocol$ - “https:”
$host$ - “192.168.1.4:8080”

Problems

cat /data/data/com.termux/files/home/data/data/com.termux/files/home/etc/Caddyfile
192.168.1.4:8080, 127.0.0.1:8080 {
tls /data/data/com.termux/files/home/etc/ssl.crt /data/data/com.termux/files/home/etc/ssl.key
proxy /wiki 127.0.0.1:8090 {
without /wiki
}
}
cat data/data/com.termux/files/home/etc/sv/wiki/run
#!/data/data/com.termux/files/usr/bin/sh
exec node /data/data/com.termux/files/home/storage/shared/TiddlyWiki5/tiddlywiki.js /data/data/com.termux/files/home/storage/shared/wiki/ --server 8090 $:/core/save/all text/plane
text/html "user" "password" 127.0.0.1
cat /data/data/com.termux/files/home/etc/sv/wiki/log/run
#!/data/data/com.termux/files/usr/bin/sh
# taken from https://github.com/Neo-Oli/termux-services/blob/master/.sv/crond/log/run
# 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment