Comments (13)
Are you using docker-compose, if so could you post your config?
If you are running the container directly from Docker, could you then please post the full command you used to run it?
from photoview.
Sure thing, here's the snippet
## Photoview - Image Gallery
photoview:
image: viktorstrate/photoview:latest
container_name: photoview
restart: unless-stopped
networks:
- proxy
depends_on:
- mariadb
security_opt:
- no-new-privileges:true
ports:
- "$PHOTOVIEW_PORT:80"
volumes:
- "$DOCKER_DIR/photoview:/app/cache"
- "$PHOTO_DIR/_EXPORTS/Collections:/photos:ro"
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
environment:
MYSQL_URL: "$PHOTOVIEW_MYSQL_USER:$PHOTOVIEW_MYSQL_PASSWORD@tcp($DB_HOST)/photoview"
API_LISTEN_IP: photoview
API_LISTEN_PORT: 80
PHOTO_CACHE: /app/cache
PUBLIC_ENDPOINT: "https://photoview.$DOMAINNAME/"
labels:
- "traefik.enable=false"
## HTTP Routers
- "traefik.http.routers.photoview-rtr.entrypoints=https"
- "traefik.http.routers.photoview-rtr.rule=HostHeader(`photoview.$DOMAINNAME`)"
- "traefik.http.routers.photoview-rtr.tls=true"
## Middlewares
# - "traefik.http.routers.photoview-rtr.middlewares=chain-no-auth@file" #No Authentication
# - "traefik.http.routers.photoview-rtr.middlewares=chain-basic-auth@file" #Basic Authentication
# - "traefik.http.routers.photoview-rtr.middlewares=chain-oauth@file" #Google OAuth 2.0
# - "traefik.http.routers.photoview-rtr.middlewares=chain-organizr@file" #Organizr Authentication
- "traefik.http.routers.photoview-rtr.middlewares=chain-authelia@file" #Authelia Authentication
## HTTP Services
- "traefik.http.routers.photoview-rtr.service=photoview-svc"
- "traefik.http.services.photoview-svc.loadbalancer.server.port=80"
from photoview.
It seems to have problems parsing the MYSQL_URL environment variable.
I'm not entirely sure why this happends, maybe the quotes around the MYSQL_URL value trips it up, could you try to delete them? Like so:
- "/etc/localtime:/etc/localtime:ro"
environment:
- MYSQL_URL: "$PHOTOVIEW_MYSQL_USER:$PHOTOVIEW_MYSQL_PASSWORD@tcp($DB_HOST)/photoview"
+ MYSQL_URL: $PHOTOVIEW_MYSQL_USER:$PHOTOVIEW_MYSQL_PASSWORD@tcp($DB_HOST)/photoview
API_LISTEN_IP: photoview
from photoview.
I did try that and it behaves the same.
from photoview.
I read here that someone had similar problems because of whitespaces, could you try to format the config like so (again just a guess):
- "/etc/localtime:/etc/localtime:ro"
environment:
- MYSQL_URL: "$PHOTOVIEW_MYSQL_USER:$PHOTOVIEW_MYSQL_PASSWORD@tcp($DB_HOST)/photoview"
- API_LISTEN_IP: photoview
- API_LISTEN_PORT: 80
- PHOTO_CACHE: /app/cache
- PUBLIC_ENDPOINT: "https://photoview.$DOMAINNAME/"
+ MYSQL_URL=$PHOTOVIEW_MYSQL_USER:$PHOTOVIEW_MYSQL_PASSWORD@tcp($DB_HOST)/photoview
+ API_LISTEN_IP=photoview
+ API_LISTEN_PORT=80
+ PHOTO_CACHE=/app/cache
+ PUBLIC_ENDPOINT=https://photoview.$DOMAINNAME/
labels:
Hope it helps
from photoview.
Same thing. I have a few other containers that use mysql databases and they are all configured with environment variables like below and work great. Not sure how difficult that would be to implement.
environment:
MYSQL_DB_HOST: $DB_HOST
MYSQL_DB_PORT: $DB_PORT
MYSQL_DB_NAME: $DB
MYSQL_DB_USER: $MYSQL_USER
MYSQL_DB_PASS: $MYSQL_PASSWORD
from photoview.
I would have to look further into that
from photoview.
Cool, let me know what you figure out. I've tried just about every format I can think of for the environment variable to get it to work and I end up with the same error every time.
from photoview.
So Photoprism is using pretty much the same format as you are for database connection and I am able to spin up that container using the example docker-compose.yml they have provided. I'm still unable to get yours to work, maybe something in there will clarify what the issue is, but I'm not savvy enough to dig into the code unfortunately.
I have my database set up like this, which differs from their example, but it still works.
mariadb:
image: linuxserver/mariadb:latest
container_name: mariadb
restart: always
networks:
- proxy
security_opt:
- no-new-privileges:true
volumes:
- "$DOCKER_DIR/mariadb:/config"
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
environment:
TZ: $TZ
PUID: $PUID
PGID: $PGID
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASS
from photoview.
I just looked at the way Photoprism does it, and it seems that they use a different library for connecting to the database, which makes it hard to compare.
I found this article describing the use of variables in docker compose:
https://medium.com/better-programming/using-variables-in-docker-compose-265a604c2006
It mentions the command docker-compose config
which will read the docker-compose.yml
file and parse all the variables and prints the result. It will also show syntax errors if it finds any.
Could you try to run that command on your config and post the result?
from photoview.
Here's the output of that command with sensitive info removed.
photoview:
container_name: photoview
depends_on:
- mariadb
environment:
API_LISTEN_IP: photoview
API_LISTEN_PORT: 80
MYSQL_URL: photoviewdb_user:dbpass@tcp(mariadb:3306)/photoview
PHOTO_CACHE: /app/cache
PUBLIC_ENDPOINT: https://photoview.mydomain.com/
image: viktorstrate/photoview:latest
labels:
traefik.enable: "false"
traefik.http.routers.photoview-rtr.entrypoints: https
traefik.http.routers.photoview-rtr.middlewares: chain-authelia@file
traefik.http.routers.photoview-rtr.rule: HostHeader(`photoview.mydomain.com`)
traefik.http.routers.photoview-rtr.service: photoview-svc
traefik.http.routers.photoview-rtr.tls: "true"
traefik.http.services.photoview-svc.loadbalancer.server.port: '80'
networks:
database: null
proxy: null
ports:
- published: 8247
target: 80
restart: unless-stopped
security_opt:
- no-new-privileges:true
user: 1001:100
volumes:
- /mnt/photography/Photoview:/app/cache:rw
- /mnt/photography/_EXPORTS/Collections:/photos:ro
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
from photoview.
I just tried to reproduce the error, but everything worked as expected.
I modified the docker-compose.example.yml to the following:
version: "3"
services:
db:
image: mariadb
restart: always
environment:
- MYSQL_DATABASE=photoview
- MYSQL_USER=$PHOTOVIEW_MYSQL_USER
- MYSQL_PASSWORD=$PHOTOVIEW_MYSQL_PASSWORD
- MYSQL_RANDOM_ROOT_PASSWORD=1
volumes:
- db_data:/var/lib/mysql
photoview:
image: viktorstrate/photoview:latest
restart: always
ports:
- "8000:80"
depends_on:
- db
environment:
# - MYSQL_URL=photoview:photo-secret@tcp(db)/photoview
- MYSQL_URL=$PHOTOVIEW_MYSQL_USER:$PHOTOVIEW_MYSQL_PASSWORD@tcp($DB_HOST)/photoview
- API_LISTEN_IP=photoview
- API_LISTEN_PORT=80
- PHOTO_CACHE=/app/cache
# Change This: The publicly exposed url
# For example if the server is available from the domain example.com,
# change this value to http://example.com/
- PUBLIC_ENDPOINT=http://localhost:8000/
volumes:
- api_cache:/app/cache
# Change this to the directory where your photos are located on your server.
# If the photos are located at `/home/user/photos`, then change this value
# to the following: `/home/user/photos:/photos:ro`.
# You can mount multiple paths, if your photos are spread across multiple directories.
- ./photos_path:/photos:ro
volumes:
db_data:
api_cache:
And exported the following environment variables:
export PHOTOVIEW_MYSQL_USER=photoview
export PHOTOVIEW_MYSQL_PASSWORD=photo-secret
export DB_HOST=db:3306
You said that you've removed sensetive information, which is understandable, but does your real db username, password or host contain a colon symbol :
?
from photoview.
So I think I figured it out. It wasn't any characters in the string, it turns out it was the database container that was causing the problem. I switched from linuxserver/mariadb:latest
to mariadb:latest
and it was able to make the connection along with the rest of my services.
from photoview.
Related Issues (20)
- MapLibre instead of MapBox HOT 3
- when installing photoview i get error HOT 3
- add comment system HOT 1
- Add cross compile support for arm64-amd64 HOT 2
- Stand alone program HOT 1
- Weird behaviour when inputing passwords with a trailing backslash HOT 1
- Show GPS metadata for video files HOT 1
- Fix pipelines HOT 2
- Folder view request HOT 2
- create user add photo path failure HOT 1
- Explicitly providing alternative versions of a file HOT 1
- Map Default Location HOT 1
- Allow setting GPS coordinates to pictures HOT 2
- TypeError: "t" is undefined HOT 10
- Exif data does not get updated? HOT 1
- Damaged image in folder break the scanning in that folder HOT 1
- WARN: SafeEXIF for .. failed: failed to parse exif data: exiftool's buffer too small (see Buffer init option) HOT 4
- The second user has a different root with the same settings HOT 8
- Align on person/people vs faces/face terms in languages
- open /dev/core: permission denied HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from photoview.