Recipes
Use Nginx proxy with subpath
Demonstrate how to use HomeGallery with docker compose and http proxy nginx with base path /pictures
File nginx.conf:
1server {
2 location / {
3 root /var/www/html;
4 }
5
6 location = /pictures {
7 rewrite ^ /pictures/;
8 }
9
10 location /pictures/ {
11 proxy_set_header Host $host;
12 proxy_set_header X-Real-IP $remote_addr;
13 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14 proxy_set_header X-Forwarded-Proto $scheme;
15
16 proxy_pass http://gallery:3000/pictures/;
17 }
18}
File compose.yml:
1services:
2 gallery:
3 image: xemle/home-gallery
4 environment:
5 #- GALLERY_API_SERVER=http://api:3000
6 - GALLERY_API_SERVER_CONCURRENT=1 # for SoC devices like Rasperry Pi. Use 5 otherwise
7 - GALLERY_API_SERVER_TIMEOUT=60 # for SoC devices like Rasperry Pi. Use 30 otherwise
8 #- GALLERY_USE_NATIVE=ffprobe,ffmpeg,vipsthumbnail # On issues with sharp resizer
9 - GALLERY_OPEN_BROWSER=false
10 # Use polling for safety of possible network mounts. Try 0 to use inotify via fs.watch
11 - GALLERY_WATCH_POLL_INTERVAL=300
12 # Define server prefix
13 - GALLERY_PREFIX=/pictures
14 volumes:
15 - ./data:/data
16 # Mount your media directories below /data
17 - ${HOME}/Pictures:/data/Pictures
18 user: "${CURRENT_USER}"
19 entrypoint: ['node', '/app/gallery.js']
20 command: ['run', 'server']
21
22 nginx:
23 image: nginx:1-alpine
24 ports:
25 - 8080:80
26 volumes:
27 - ./nginx.conf:/etc/nginx/conf.d/default.conf
Start
1mkdir -p data/config
2echo "CURRENT_USER=$(id -u):$(id -g)" >> .env
3docker compose run gallery run init --source /data/Pictures
4docker compose up -d
Open localhost:8080/pictures in your browser
Use Traefik proxy with subpath
Demonstrate how to use HomeGallery with docker compose and http proxy traefik with base path /pictures
File config.conf:
1http:
2 routers:
3 gallery:
4 rule: "PathPrefix(`/pictures`)"
5 service: gallery
6 services:
7 gallery:
8 loadBalancer:
9 servers:
10 - url: "http://gallery:3000"
File compose.yml:
1services:
2 gallery:
3 image: xemle/home-gallery
4 environment:
5 #- GALLERY_API_SERVER=http://api:3000
6 - GALLERY_API_SERVER_CONCURRENT=1 # for SoC devices like Rasperry Pi. Use 5 otherwise
7 - GALLERY_API_SERVER_TIMEOUT=60 # for SoC devices like Rasperry Pi. Use 30 otherwise
8 #- GALLERY_USE_NATIVE=ffprobe,ffmpeg,vipsthumbnail # On issues with sharp resizer
9 - GALLERY_OPEN_BROWSER=false
10 # Use polling for safety of possible network mounts. Try 0 to use inotify via fs.watch
11 - GALLERY_WATCH_POLL_INTERVAL=300
12 # Define server prefix
13 - GALLERY_PREFIX=/pictures
14 volumes:
15 - ./data:/data
16 # Mount your media directories below /data
17 - ${HOME}/Pictures:/data/Pictures
18 user: "${CURRENT_USER}"
19 entrypoint: ['node', '/app/gallery.js']
20 command: ['run', 'server']
21
22 traefik:
23 image: traefik
24 command:
25 - "--entryPoints.web.address=:8080"
26 - "--providers.file.filename=/etc/config.yml"
27 ports:
28 - "8080:8080"
29 volumes:
30 - ./config.yml:/etc/config.yml
Start
1mkdir -p data/config
2echo "CURRENT_USER=$(id -u):$(id -g)" >> .env
3docker compose run gallery run init --source /data/Pictures
4docker compose up -d
Open localhost:8080/pictures in your browser