Switch to myTinyTodo running in a Docker container

I have been using myTinyTodo since 5-6 years at least and very happy with it. It keeps things simple but does have all the features that are necessary to implement GTD techniques. Until recently I had Ubuntu VM in my homelab dedicated to run the service. However, now I migrated it to a Docker container and this is a write-up regarding the steps it took.

First, I choose to deploy an OVA template from VMware website with the latest Photon image. In my case it was “photon-hw13-4.0-a3a49f5400.ova” but there should be a newer image available now. When it’s done it is time to login to the new VM and enable the Docker service:

systemctl start docker
systemctl enable docker

Then I moved all the myTinyTodo files from /var/www/html directory from the Ubuntu server to /root/project/html directory on the Photon VM. You can skip this step if you’re doing a new deployment. I was using sqlite database on the Ubuntu server so /var/www/html/db/ directory was the only one that I really have to copy over to migrate the configuration. Documentation says that you might need to run ‘setup.php’ as well but it wasn’t necessary in my case.

Created a named volume to have a persistent storage where the database will be kept:

root@photon-machine [ ~/project ]# docker volume create todo-db

Dockerfile content:

FROM php:apache
RUN pwd
RUN apt-get update && apt-get upgrade -y && apt-get -y install wget unzip
RUN wget $(curl -s https://api.github.com/repos/maxpozdeev/mytinytodo/releases/latest | grep 'browser_' | cut -d\" -f4) -O latest.zip
RUN unzip latest.zip
RUN rm latest.zip
RUN cp -R mytinytodo/* /var/www/html
ADD html/favicon.ico /var/www/html/
ADD html/db/* /var/www/html/db/
RUN chmod 644 /var/www/html/favicon.ico
RUN chown -R www-data:www-data /var/www/html/*
RUN rm /var/www/html/setup.php

Created an image from Dockerfile:

root@photon-machine [ ~/project ]# docker build -t mytinytodo_1.6.5 .

And started a container from that image:

root@photon-machine [ ~/project ]# docker container run -d -p 80:80 --restart=always --name mytinytodo_1.6.5 -v todo-db:/var/www/html/db/ mytinytodo_1.6.5

The container starts automatically if you reboot the host VM. Afterwards I commented out the step in the Dockerfile where database is copied over as it was necessary for the migration but won’t be desirable during future upgrades. Instead, the database located on the volume should be reused. The line to comment out:

#ADD html/db/* /var/www/html/db/

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.