Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation issue #535

Closed
falkov237 opened this issue Oct 7, 2020 · 32 comments
Closed

Installation issue #535

falkov237 opened this issue Oct 7, 2020 · 32 comments
Assignees
Labels
technical-support Support request
Milestone

Comments

@falkov237
Copy link

I am new here, hello. I tried to install photoprism on Ubuntu 18.04 (VPS, hosted Server) and failed to start the photoprism container. Status is stuck: "(health: starting)" for hours. The photoprism bash status shows "ERRO[2020-10-07T08:17:33Z] can't connect to 0.0.0.0:2342". I have purged all containers, reinstalled docker and photoprism but the problem persists. My first attempt to install worked like a charm, then by accident i reinstalled photoprism-yml again (over) and after that prism didn't work anymore. My docker-compose.yml is attached.

version: '3.5'

Example Docker Compose config file for PhotoPrism (Intel / AMD64)

Documentation : https://docs.photoprism.org/getting-started/docker-compose/

Docker Hub URL: https://hub.docker.com/r/photoprism/photoprism/

Please run behind a reverse proxy like Caddy, Traefik or Nginx if you need HTTPS / SSL support

e.g. when running PhotoPrism on a public server outside your home network.

Usage: docker-compose up

services:
photoprism:
image: photoprism/photoprism:latest
restart: unless-stopped
# Uncomment and edit the following line to set a specific user / group id:
# user: "1000:1000"
security_opt:
- seccomp:unconfined
- apparmor:unconfined
ports:
- 2342:2342 # [local port]:[container port]
healthcheck: # Optional
test: "photoprism status"
interval: 60s
timeout: 15s
retries: 5
environment: # Run "photoprism help" and "photoprism config" too see all config options and current values
PHOTOPRISM_DEBUG: "false" # Run in debug mode (shows additional log messages)
PHOTOPRISM_PUBLIC: "false" # No authentication required (disables password protection)
PHOTOPRISM_READONLY: "false" # Don't modify originals directory (reduced functionality)
PHOTOPRISM_UPLOAD_NSFW: "true" # Allow uploads that MAY be offensive
PHOTOPRISM_DETECT_NSFW: "false" # Flag photos as private that MAY be offensive
PHOTOPRISM_EXPERIMENTAL: "false" # Enable experimental features
PHOTOPRISM_SITE_URL: "http://fato27.de:2342/" # Canonical / public site URL
PHOTOPRISM_SITE_TITLE: "PhotoPrism"
PHOTOPRISM_SITE_CAPTION: "Browse Your Life"
PHOTOPRISM_SITE_DESCRIPTION: ""
PHOTOPRISM_SITE_AUTHOR: ""
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
PHOTOPRISM_HTTP_PORT: 2342
PHOTOPRISM_SETTINGS_HIDDEN: "false" # Users can not view or change settings
PHOTOPRISM_ADMIN_PASSWORD: "photoprism" # Initial admin password (can be changed in settings)
# PHOTOPRISM_DATABASE_DRIVER: "sqlite" # Change to "mysql" for external MySQL or MariaDB
PHOTOPRISM_DATABASE_DRIVER: "mysql" # Using MariaDB or MySQL instead of SQLite is optional
# PHOTOPRISM_DATABASE_DSN: "user:passwd@tcp(photoprism-db:3306)/photoprism?charset=utf8mb4,utf8&parseTime=true"
PHOTOPRISM_SIDECAR_JSON: "true" # Automatically create JSON sidecar files using Exiftool
PHOTOPRISM_SIDECAR_YAML: "true" # Automatically backup metadata to YAML sidecar files
PHOTOPRISM_THUMB_FILTER: "lanczos" # Resample filter, best to worst: blackman, lanczos, cubic, linear
PHOTOPRISM_THUMB_UNCACHED: "false" # Enable on-demand thumbnail rendering (high memory and cpu usage)
PHOTOPRISM_THUMB_SIZE: 2048 # Pre-rendered thumbnail size limit (default 2048, min 720, max 7680)
# PHOTOPRISM_THUMB_SIZE: 4096 # Retina 4K, DCI 4K (requires more storage); 7680 for 8K Ultra HD
PHOTOPRISM_THUMB_SIZE_UNCACHED: 7680 # On-demand rendering size limit (default 7680, min 720, max 7680)
PHOTOPRISM_JPEG_SIZE: 7680 # Size limit for converted image files in pixels (720-30000)
PHOTOPRISM_JPEG_QUALITY: 92 # Set to 95 for high-quality thumbnails (25-100)
PHOTOPRISM_DARKTABLE_PRESETS: "false" # Use darktable presets (disables concurrent raw to jpeg conversion)
volumes:
- "/Photoprism/Pictures:/photoprism/originals" # [local path]:[container path]
# Multiple folders can be indexed by mounting them as subfolders of /photoprism/originals:
# - "
/Photoprism/Family:/photoprism/originals/Family" # [folder_1]:/photoprism/originals/[folder_1]
# - "/Photoprism/Friends:/photoprism/originals/Friends" # [folder_2]:/photoprism/originals/[folder_2]
# - "
/Photoprism/Storage:/photoprism/storage" # Settings, index, sidecar files, and generated thumbnails
# - "~/Photoprism/Import:/photoprism/import" # Mounting the import folder is optional (see docs)

Uncomment the following lines to use MariaDB instead of SQLite for improved performance & scalability:

photoprism-db:
image: mariadb:10.5 # Alternatively mysql:8.0
restart: unless-stopped
command: mysqld --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=50
volumes:
- "/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: f3LhEup9AD756UPS
MYSQL_USER: root

MYSQL_PASSWORD: passwd

  MYSQL_DATABASE: photoprism

Uncomment the following lines to upgrade automatically, whenever there is a new Docker image available:

watchtower:
image: containrrr/watchtower
restart: unless-stopped
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"

docker-compose.txt

lastzero added a commit that referenced this issue Oct 7, 2020
Signed-off-by: Michael Mayer <michael@lastzero.net>
@lastzero
Copy link
Member

lastzero commented Oct 7, 2020

Thanks for reporting this!

Should be fixed, starting a new Docker build. As a workaround, you may uncomment / remove the healthcheck: section if it causes unexpected restarts.

@lastzero lastzero self-assigned this Oct 7, 2020
@lastzero lastzero added the bug Something isn't working label Oct 7, 2020
@lastzero lastzero added this to the MVP milestone Oct 7, 2020
@lastzero
Copy link
Member

lastzero commented Oct 7, 2020

And please make sure the storage path is NOT disabled / commented out like this:

# - "/Photoprism/Storage:/photoprism/storage" # Settings, index, sidecar files, and generated thumbnails

Otherwise, settings and sidecar files can not be saved properly.

@lastzero
Copy link
Member

lastzero commented Oct 7, 2020

Updated our docker-compose.yml example:

https://dl.photoprism.org/docker/docker-compose.yml

@falkov237
Copy link
Author

falkov237 commented Oct 7, 2020 via email

@lastzero
Copy link
Member

lastzero commented Oct 7, 2020

You might also need to re-index (completely) since all thumbnails / preview images created earlier are lost if the storage path was not configured as permanent volume. Docker resets the filesystem by default when a container restarts.

It's possible to also render preview images dynamically on-demand, but this is turned off by default as it requires a powerful CPU and addition memory that is often not available on smaller servers like a Raspberry Pi.

@falkov237
Copy link
Author

falkov237 commented Oct 7, 2020 via email

@falkov237
Copy link
Author

falkov237 commented Oct 7, 2020 via email

@falkov237
Copy link
Author

falkov237 commented Oct 8, 2020 via email

@lastzero
Copy link
Member

lastzero commented Oct 8, 2020

No, won't happen again. We had to perform changes in our database in preparation for a stable release. You should still set a secure default password in case the database is lost or unavailable for any reason.

@lastzero
Copy link
Member

lastzero commented Oct 8, 2020

~ in volumes, like ~/Pictures, will mount them in the current user directory. So when you have a typical root server and didn't create any other users, it will be in the /root/Pictures directory. You may as well specify an absolute path like /share/photos, outside of any home directory. Home directories of regular users are typically located in /home, root is the only user that has /root as home.

@lastzero
Copy link
Member

I'll close this. You're welcome to contact us anytime should there be other issues!

@lastzero lastzero added technical-support Support request and removed bug Something isn't working labels Oct 12, 2020
@falkov237
Copy link
Author

falkov237 commented Nov 10, 2020 via email

@lastzero
Copy link
Member

You can create SQL backups using any standard database tools like mysqldump (simply google it). Make sure the docker-compose.yml file lists /var/lib/mysql in the volumes: section of the MariaDB / MySQL database service (somewhere at the bottom), so storage doesn't get lost when the container restarts e.g. after upgrades.

@lastzero
Copy link
Member

We'll add built-in tools that are easier to use, but this will take a while to develop.

@falkov237
Copy link
Author

falkov237 commented Nov 10, 2020 via email

@falkov237
Copy link
Author

falkov237 commented Nov 12, 2020 via email

@falkov237
Copy link
Author

falkov237 commented Nov 12, 2020 via email

@lastzero
Copy link
Member

It might help to use a named volume as shown here: https://docs.docker.com/compose/compose-file/#volumes

However, I never observed that docker randomly creates new volumes (instead of using the existing one) if no named volume is specified.

@falkov237
Copy link
Author

falkov237 commented Nov 27, 2020 via email

@alexislefebvre
Copy link
Contributor

Docker volumes can be hard to track. I prefer to mount volumes from the host server.

⚠️ Your data will be lost when restarting the database container. Backup (dump) the data before setting a volume. Then restart the database container and restore the data.

You can mount a directory on your host to keep the database data:

  photoprism-db:
    image: mariadb:10.5
    restart: unless-stopped
    command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=1024 --innodb-rollback-on-timeout=ON --innodb-lock-wait-timeout=120
    networks:
      - photoprism
    volumes:
      - "/DATA/photoprism/database:/var/lib/mysql"
    environment:
      MYSQL_ROOT_PASSWORD: photoprism
      MYSQL_USER: photoprism
      MYSQL_PASSWORD: photoprism
      MYSQL_DATABASE: photoprism

Replace DATA with a folder name on your host. Then run docker-compose up -d to restart the container with the new configuration.

@falkov237
Copy link
Author

falkov237 commented Nov 27, 2020 via email

@alexislefebvre
Copy link
Contributor

Ok, then remove this part:

networks:
      - photoprism

Or, take your previous configuration and change only the values in volumes:.

@falkov237
Copy link
Author

falkov237 commented Dec 12, 2020 via email

@graciousgrey
Copy link
Member

We will have a look at this later today or tomorrow!

@lastzero
Copy link
Member

@falkov237 You're welcome to open a new issue next time! Didn't find this because it is closed already.

Does this also happen using today's Docker image? The error message is strange in that we use external servers for geodata and maps only and there is no proxy config whatsoever (in fact, we should add it if someone is still using a proxy in 2020).

Maybe PhotoPrism can't connect to our backend to get an API key for the maps (which are served by an external service provider). It still shouldn't restart in this case. Or the error is from Watchtower, trying to update PhotoPrism and failing because of the request limit that Docker Hub introduced recently? You may send us your external IP address to hello@photoprism.app for debugging, maybe we can see something in our logs.

It's best to turn watchtower and the Docker health check off for testing, so that the issue can be located more easily and there is no distraction from other logs and processes.

In the worst case, we need to start debugging your server environment...

@falkov237
Copy link
Author

falkov237 commented Dec 21, 2020 via email

@lastzero
Copy link
Member

Fair enough! Sorry we couldn't take care of your issues earlier.

Frohe Weihnachten 🎄

@lastzero
Copy link
Member

Maybe removing the health check from docker-compose.yml would have been enough? This is now the default in our example:

https://dl.photoprism.org/docker/docker-compose.yml

I don't believe your error was an issue with PhotoPrism as such, but with the local configuration. Issues there have nothing to do with our software being unstable. We do our best to help users with setting up Docker. In addition we're going to provide other installation methods as we've noticed many users have issues with their Docker configuration. A typo or a wrong path is enough to cause major issues.

@lastzero
Copy link
Member

lastzero added a commit that referenced this issue Dec 28, 2020
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
lastzero added a commit that referenced this issue Dec 28, 2020
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
@Stokel
Copy link

Stokel commented Jan 19, 2021

I think the wrong volume is being mounted for the linuxserver/mariadb container in the case of the raspberry pi docker-compose yaml. ( Is there a reason the pi config uses linuxserver and the normal apparently doesn't?)

The current volume being mounted is - "./database:/var/lib/mysql" but linuxserver/mariadb says - path_to_data:/config should be mounted.
This would explain why my library wasn't showing after scanning images for 3h and restarting my setup. :D
There were no contents in my local directory for the volume.
I changed the mount point for inside the container and now the directory is being populated so I think it should also survive restarts (there is a directory named databases/photoprism.

I started the "re-indexing" only via the index command and it now says index: restored from IMG_20190825_161353.yml for all images. I guess that is good and saves me some computation time or should I redo everything from scratch just to be save?

@lastzero
Copy link
Member

lastzero commented Jan 19, 2021

Using linuxserver/mariadb was recommended by one of our users - without telling us that the storage path is different. Can you send a tested PR for our docker-compose.yml example?

lastzero added a commit that referenced this issue Jan 19, 2021
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
@lastzero
Copy link
Member

Hopefully fixed by using their official image, see https://dl.photoprism.org/docker/arm64/docker-compose.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical-support Support request
Projects
None yet
Development

No branches or pull requests

5 participants