home.social

#walkthru — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #walkthru, aggregated by home.social.

  1. Reading Time: 2 minutes

    This morning I made PhotoPrism self-booting. I am not certain that this is the write term so I will specify what I mean. PhotoPrism, when run via docker boots, when we tell it to boot, like any other app on our laptop. This morning, after a little time spent with AI I found the solution.

    I used ChatGPT for this help but this is to give you an idea of how to enable docker containers to boot automatically rather than manually. It’s by a little trial and error that I suceeded in what I wanted to do.

    Boiled down Chat GPT gave this overview

    To start a service: sudo systemctl start servicename.service
    To stop a service: sudo systemctl stop servicename.service
    To restart a service: sudo systemctl restart servicename.service
    To enable a service to start on boot: sudo systemctl enable servicename.service
    To disable a service from starting on boot: sudo systemctl disable servicename service

    In concrete terms you need to “sudo nano /etc/systemd/system/photoprism.service” and add

    [Unit]Description=PhotoPrism Docker Compose Service
    Requires=docker.service
    After=docker.service

    [Service]Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml up -d
    ExecStop=/usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml down

    [Install]WantedBy=default.target

    In my case it was /usr/bin rather than local bin. That’s a little thing to look out for. To double check use “which docker-compose” and you will see what to use for the execstart address.

    If you are using an external volume double check that the mount point is static. I rebooted twice and got three mount points as well as an “original picture folder empty” message due to the photo drive being mounted in the wrong place. To fix this I used.

    sudo blkid

    to locate the uuid of the hard drive before personalising this line:

    UUID= /path/to/mountpoint ext4 defaults 0 2
    I left the defaults behaviouts. The 0 is for fsck to check the file system and 2 is the backup priority number.

    This is added via:

    sudo nano /etc/fstab

    Once you have ensured that the drive mount point will remain the same, boot after boot you can run the next lines.

    Reload Systemd

    sudo systemctl daemon-reload

    Enable PhotoPrism to launch at boot

    sudo systemctl enable photoprism.service

    To start the service

    sudo systemctl start photoprism.service

    And finally you can run

    sudo systemctl status photoprism.service
    to check service status.

    And Finally

    When I set up a server for photoprism or other services I want it to boot automatically as soon as the computer is booted. I don’t want to have to start services manually. With this workflow I was able to setup PhotoPrism to boot automatically, as well as to make sure that the photo drive would mount to the right place each time I booted the system.

    https://www.main-vision.com/richard/blog/photoprism-self-boot/

    #booting #learning #photoprism #systemd #volumes #walkThru