fav-server
v1.2.0
Published
Small Express API to persist changes to your favourite media in your thumbsup website
Downloads
10
Maintainers
Readme
Fav-server
A docker container containing thumbsup, but with an Express API to allow you to record (and change) your favourite images through the ThumbsUp website that is generated.
Requirements
- A machine capable of running Docker (e.g. your computer, a Synology NAS, etc)
- This docker image:
ghcr.io/uglow/thumbsup-fav-server:latest
(which is build using this repo).
How it works
Fav-server is a simple NodeJS Express application that does one-thing: it creates/updates picasa.ini
files
with the favourite-state of images that you toggle the favourite-state for (via theme-cards-fav
).
When the picasa.ini
files change, the server initiates a rebuild of your site to persist the favourite-state, after a short delay.
PM2 is used to keep the server alive forever, even when there are crashes (which shouldn't happen). Note that "alive forever" means "as long as the Docker container is running" when run inside of a Docker container.
Docker Command Line Parameters
The following additional arguments can be passed on the command line:
rebuildDelay
(optional, default = 3sec): Number of seconds to wait before rebuilding the site. Balance between usability (seeing the site update) and performance.
These parameters are passed to the NodeJS server for processing.
Installation - Local Machine
- Edit
./run-remote.sh
and change theinput
andoutput
volumes. By default, these volumes point to<repo>/example/...
. - Run
./run-remote.sh
to start the server in Docker. - Create a web-server to serve the
output
directory. E.g.cd <outputDir> && python -m SimpleHTTPServer 8000
- Open a browser to
http://localhost:8000/
(or whatever port you have setup in the above step).
Installation - Synology
The main steps are:
- Install image onto Synology.
- Setup config
- Setup Synology Web Station
- Configure & Run
1. Install image onto Synology
Synology's Docker support for non-DockerHub registries and images is not great. Normally you would
use the Synology > Docker app to add a new Docker image. However, at the time of writing, Synology
cannot read this image: ghcr.io/uglow/thumbsup-fav-server:latest
.
So here's how to get ghcr.io/uglow/thumbsup-fav-server:latest
onto the Synology box.
- Synology: Control Panel -> Terminal & SNMP -> Enable SSH
- From your computer, in a new terminal window:
ssh <user>@<ip.address.for.synology-device>
- Once logged in,
sudo -i
(To be able to use docker on cli. Note: use the same password as your user.) docker pull ghcr.io/uglow/thumbsup-fav-server:latest
5Synology: Control Panel -> Terminal & SNMP -> Disable SSH
After download completes, the image appears in the Synology Docker.
2. Setup config
In this step we will provide the Thumbsup theme and config required by the Docker image.
When Docker is installed on Synology, a /docker
share folder is created. We need to create a sub-folder for the
thumbsup-fav-server config.
- Open a new terminal window.
git clone https://github.com/uglow/thumbsup-fav-server.git
to copy the source code, which includes example config.- Copy the files from
<gitRepo>/example/config
to Synology/docker/fav-server/config
. - Edit
config.json
to supply the Thumbsup config.- Do not change the following properties:
theme-path
,theme-style
,albums-from
- Do not change the following properties:
3. Setup Synology Web Station
There are lots of ways to run a website (including using a Docker image). But on a Synology NAS, the easiest way is to use Synology Web Station.
- Synology > Package Center > Search "Web Station"
- Install the "Web Station" package. Once this is installed you will see a new share-folder
called
/web
. This will be where the Thumbsup-generated website will be published to.
4. Configure & Run
Synology: Docker > Image > Select
uglow/thumbsup-fav-server
> Launch:Enter the container name, then press "Advanced Settings"
Advanced Settings > Enable auto-restart. Optionally create a shortcut on the desktop.
Volume Tab, press Add Folder for each folder below:
- Folder:
/photo
(in this example), Mount:/input
- Folder:
/web
(defined in step 3), Mount:/output
- Folder:
/docker/fav-server/config
(defined in step 2), Mount:/config
- Folder:
(optional) Environment Tab, set the Command to
rebuild\=5
to rebuild the website after waiting for 5 seconds. Note: As per this article, the=
characters have to be escaped with\
. E.g.inputDir\=...
Press Apply.
Review the changes, then press Done.
Running
Open the website. Click the ⭐️ icon for images/photos that you like these selections will be persisted once the site rebuilds.
Development
See DEVELOPERS.md.
Upgrading
When installing a new Docker image, repeat steps 1,2 and 4 in "Installation - Synology".
Troubleshooting
Website not building
The first time you run this container, it will take a long time before the website is generated. You may even find that the container hangs. Don't worry! Just restart the Docker container, and Thumbsup will resume where it left off.
In terms of time, it took over 8 hours to finish building the website for 182 GB of images and videos, including hang-time.
The build is finished once the /web
folder on Synology contains a bunch of *.html
files, representing
the different albums. Increasing available RAM improves performance.
Device is slow while building
Thumbsup has a --concurrency
option. In order to keep your device responsive, it is best
not to use all the CPU cores on your device for rebuilding the site.