{"id":11314,"date":"2024-01-21T12:25:12","date_gmt":"2024-01-21T10:25:12","guid":{"rendered":"https:\/\/www.main-vision.com\/richard\/blog\/?p=11314"},"modified":"2024-01-21T12:25:12","modified_gmt":"2024-01-21T10:25:12","slug":"photoprism-self-boot","status":"publish","type":"post","link":"https:\/\/www.main-vision.com\/richard\/blog\/photoprism-self-boot\/","title":{"rendered":"PhotoPrism self-boot"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span><p>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. <\/p>\n<p>I used ChatGPT\u00a0for this help but this is to give you an idea of how to enable docker containers to boot automatically rather than manually. It&#8217;s by a little trial and error that I suceeded in what I wanted to do. <\/p>\n<p>Boiled down Chat GPT\u00a0gave this overview<\/p>\n<p>>    To start a service: sudo systemctl start servicename.service<br \/>\n>    To stop a service: sudo systemctl stop servicename.service<br \/>\n>    To restart a service: sudo systemctl restart servicename.service<br \/>\n>    To enable a service to start on boot: sudo systemctl enable servicename.service<br \/>\n>    To disable a service from starting on boot: sudo systemctl disable servicename service<\/p>\n<p>In concrete terms you need to &#8220;sudo nano \/etc\/systemd\/system\/photoprism.service&#8221; and add<\/p>\n<p>> [Unit]\n> Description=PhotoPrism Docker Compose Service<br \/>\n> Requires=docker.service<br \/>\n>  After=docker.service<\/p>\n<p>> [Service]\n> Type=oneshot<br \/>\n> RemainAfterExit=yes<br \/>\n> ExecStart=\/usr\/local\/bin\/docker-compose -f \/path\/to\/your\/docker-compose.yml up -d<br \/>\n> ExecStop=\/usr\/local\/bin\/docker-compose -f \/path\/to\/your\/docker-compose.yml down<\/p>\n<p>> [Install]\n> WantedBy=default.target<\/p>\n<p>In my case it was \/usr\/bin rather than local bin. That&#8217;s a little thing to look out for. To double check use &#8220;which docker-compose&#8221; and you will see what to use for the execstart address.<\/p>\n<p>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 &#8220;original picture folder empty&#8221; message due to the photo drive being mounted in the wrong place. To fix this I used. <\/p>\n<p>> sudo blkid <\/p>\n<p>to locate the uuid of the hard drive before personalising this line: <\/p>\n<p>> UUID=<your-uuid>  \/path\/to\/mountpoint  ext4  defaults  0  2<br \/>\nI left the defaults behaviouts. The 0 is for fsck to check the file system and 2 is the backup priority number.<\/p>\n<p>This is added via:<\/p>\n<p>> sudo nano \/etc\/fstab<\/p>\n<p>Once you have ensured that the drive mount point will remain the same, boot after boot you can run the next lines. <\/p>\n<p>Reload Systemd<br \/>\n> sudo systemctl daemon-reload<\/p>\n<p>Enable PhotoPrism to launch at boot<br \/>\n> sudo systemctl enable photoprism.service<\/p>\n<p>To start the service<br \/>\n> sudo systemctl start photoprism.service<\/p>\n<p>And finally you can run <\/p>\n<p>> sudo systemctl status photoprism.service<br \/>\nto check service status. <\/p>\n<p>## And Finally<\/p>\n<p>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&#8217;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. <\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>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. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11292,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[6346,1094,6275,6345,6347,6348],"class_list":["post-11314","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech-related","tag-booting","tag-learning","tag-photoprism","tag-systemd","tag-volumes","tag-walk-thru"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/posts\/11314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/comments?post=11314"}],"version-history":[{"count":1,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/posts\/11314\/revisions"}],"predecessor-version":[{"id":11315,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/posts\/11314\/revisions\/11315"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/media\/11292"}],"wp:attachment":[{"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/media?parent=11314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/categories?post=11314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.main-vision.com\/richard\/blog\/wp-json\/wp\/v2\/tags?post=11314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}