Some time ago I discovered Termux this cool Android app that allows you to find a good part of your linux environment on your phone or tablet.
It has helped me more than once to make a quick change on the move, save it under git or mercurial before pushing it towards continuous integration. Since I’ve migrated this blog under Nikola I was thinking it would be convenient to be able to work on blog posts on the move, to preview them in a browser and to deploy the whole blog on GAE, everything from a phone.
It actually works pretty well.
Here are the steps to follow:
This is simply done from the Google Play app store or better from the f-droid repository.
Install mercurial (optional)¶
Mercurial allows me to manage the history of my blog editing and to push it into a bitbucket private repository. I like mercurial as revision system management tool mainly because of its consistent and well documented interface. Of course you can also use git.
Preparing a virtual environment¶
Install Nikola itself¶
Install the google cloud sdk¶
I took my inspiration from the notes by geoffrey looker:
export CLOUDSDK_PYTHON=/data/data/com.termux/files/usr/bin/python2.7 curl -k https://storage.googleapis.com/gceprd-iso/google-cloud-sdk-134.0.0-linux-x86_64__TERMUX.tar.gz -O tar -xzf google-cloud-sdk-134.0.0-linux-x86_64__TERMUX.tar.gz cd google-cloud-sdk bash ./install.sh bash a #(or zsh depending upon your taste) gcloud components update ~/update-gcloud-sheebang.sh gcloud auth login
Where the script
update-gcloud-sheebang updates the shebang
of each file potentially updated by the command
update and contains the following few lines:
Writing and publishing¶
Restart a shell and then:
Then visualize your site in an android browser by visiting http://localhost:8000.
And finally deploy it on Google App Engine with the command
What remains to be improved¶
- I have some error messages like [2018-01-19T21:28:28Z] WARNING: Nikola: Local fr_FR. utf8 for language fr not accepted by local python and apparently the locales are not well supported by termux. I’m not quite sure of the consequences.
- During my first tests, I realized that some utf8 characters were not well rendered under vim. I may have a configuration to complete.
- The jpegoptim software is not available on termux, I had to disable it in the nikola filter configuration which allows the optimization of jpeg files for the web.
I will update this post to reflect any improvements or other problems I have encountered.