waschinski / photo-stream

Self-hosted, super simple photo stream
https://github.com/waschinski/photo-stream
MIT License
449 stars 70 forks source link

Error when deploying via Docker #31

Closed oliverhihn closed 2 years ago

oliverhihn commented 2 years ago

After the change in the docker-compose.yml it now successfully build. Thank you again for the fast help, but now it still doesn't work on my Raspberry Pi. I tried it with the example pictures and also with a own picture in jpg format. Bouth give the same error. Am I missing something or doing something wrong? Also I would love to help solving that deprecated call warning but I cannot find the file where this is called.

Output of docker logs photo-stream

Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Configuration file: /photo-stream/_config.yml
            Source: /photo-stream
       Destination: /photo-stream/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
  Liquid Exception: No such file or directory @ rb_sysopen - photos/original/carrie-cronan-XNJdMuqtk70-unsplash.jpg in feed.xml
                    ------------------------------------------------
      Jekyll 4.2.2   Please append `--trace` to the `serve` command
                     for any additional information or backtrace.
                    ------------------------------------------------
/usr/local/bundle/gems/exifr-1.3.9/lib/exifr/jpeg.rb:34:in `initialize': No such file or directory @ rb_sysopen - photos/original/carrie-cronan-XNJdMuqtk70-unsplash.jpg (Errno::ENOENT)
        from /usr/local/bundle/gems/exifr-1.3.9/lib/exifr/jpeg.rb:34:in `open'
        from /usr/local/bundle/gems/exifr-1.3.9/lib/exifr/jpeg.rb:34:in `initialize'
        from /usr/local/bundle/gems/jekyll-exif-data-0.0.3/lib/jekyll/exif-data.rb:9:in `new'
        from /usr/local/bundle/gems/jekyll-exif-data-0.0.3/lib/jekyll/exif-data.rb:9:in `exif'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/strainer.rb:56:in `invoke'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/context.rb:86:in `invoke'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/variable.rb:84:in `block in render'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/variable.rb:82:in `each'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/variable.rb:82:in `inject'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/variable.rb:82:in `render'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/block_body.rb:103:in `render_node_to_output'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/block_body.rb:80:in `render'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/tags/for.rb:160:in `block (2 levels) in render_segment'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/tags/for.rb:158:in `each'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/tags/for.rb:158:in `block in render_segment'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/context.rb:123:in `stack'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/tags/for.rb:150:in `render_segment'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/tags/for.rb:79:in `render'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/block_body.rb:103:in `render_node_to_output'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/block_body.rb:82:in `render'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/template.rb:208:in `block in render'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/template.rb:242:in `with_profiling'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/template.rb:207:in `render'
        from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/template.rb:220:in `render!'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:39:in `block (3 levels) in render!'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:59:in `measure_counts'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:38:in `block (2 levels) in render!'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:63:in `measure_bytes'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:37:in `block in render!'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:70:in `measure_time'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/liquid_renderer/file.rb:36:in `render!'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/renderer.rb:131:in `render_liquid'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/renderer.rb:80:in `render_document'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/renderer.rb:63:in `run'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/site.rb:547:in `render_regenerated'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/site.rb:539:in `block in render_pages'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/site.rb:538:in `each'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/site.rb:538:in `render_pages'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/site.rb:211:in `render'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/site.rb:80:in `process'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/command.rb:28:in `process_site'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:65:in `build'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:36:in `process'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `each'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        from /usr/local/bundle/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
        from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from /usr/local/bundle/gems/jekyll-4.2.2/exe/jekyll:15:in `<top (required)>'
        from /usr/local/bundle/bin/jekyll:25:in `load'
        from /usr/local/bundle/bin/jekyll:25:in `<top (required)>'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:63:in `load'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:63:in `kernel_load'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:28:in `run'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/cli.rb:494:in `exec'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/cli.rb:30:in `dispatch'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/cli.rb:24:in `start'
        from /usr/local/bundle/gems/bundler-2.2.15/exe/bundle:49:in `block in <top (required)>'
        from /usr/local/bundle/gems/bundler-2.2.15/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
        from /usr/local/bundle/gems/bundler-2.2.15/exe/bundle:37:in `<top (required)>'
        from /usr/local/bundle/bin/bundle:25:in `load'
        from /usr/local/bundle/bin/bundle:25:in `<main>'
waschinski commented 2 years ago

Not completely sure but the deprecation warning might be coming from a dependency. I will have to check in detail.

Regarding your problem with the images not being properly processed: please check the permissions on your photos folder. I think photo-stream is unable to write the processed image files to the folder because it might be read-only.

oliverhihn commented 2 years ago

It was read only. But even after fixing that and recreating the container, logs still give the same error message. I also noticed a warning whilest building:

Building photo-stream
Step 1/10 : ARG  BASE_IMAGE=ruby:3.1.2-alpine3.15
Step 2/10 : FROM ${BASE_IMAGE}
 ---> 9eea51636263
Step 3/10 : ENV VIPSVER 8.12.2
 ---> [Warning] The requested image's platform (linux/arm/v6) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
 ---> Running in a881bc928671
Removing intermediate container a881bc928671
 ---> 7d7e1061419b
Step 4/10 : RUN apk update && apk upgrade &&    apk add --update --no-cache build-base glib-dev libexif-dev expat-dev tiff-dev jpeg-dev libgsf-dev git rsync lftp openssh &&    rm -rf /var/cache/apk/*
 ---> [Warning] The requested image's platform (linux/arm/v6) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
 ---> Running in c1ac92b90b97

But I don't think, that this is the problem. Or could it be the problem?

waschinski commented 2 years ago

Sorry I didn't saw it earlier, but in #30 you said you're running this on a Raspberry Pi 4 Model B. While that should be backwards compatible with arm/v6 you really should be using arm64/v8 like the warning message tries to tell you. I would definitely switch over to that architecture and by doing so you could actually just use the image I provide on Docker Hub.

Not sure if this will fix everything on your end but please do so and report back.

oliverhihn commented 2 years ago

As far as i understand, I am using linux/arm64/v8 (as it says in the warning detected host platform (linux/arm64/v8)) and the image platform is (linux/arm/v6). So I should downgrade from v8 to v6 now?

oliverhihn commented 2 years ago

I can confirm that im using v8:

root@pi:$ uname -r
5.15.32-v8+
waschinski commented 2 years ago

What it says is you requested a v6 image while your host (your pi) is v8. As far as I can tell you followed the instructions in the README regarding Raspberry Pi but that is actually for v6 only. I probably should highlight that.

So basically just revert your changes in the docker-compose.yml and build the image again or use the pre-built image I provide on Docker Hub by pulling it:

docker pull waschinski/photo-stream:latest

which you can then run by e.g.

docker run -i -t waschinski/photo-stream /bin/bash

oliverhihn commented 2 years ago

Okay i tried that. Same error. Then I did a docker system purge -a to make sure all images and build cache is cleaned. Then i deleted the cloned repo, and cloned a fresh copy. Then I modified the permissions of photos/ and original/ and all .jpg files inside original. Still the same (Errno::ENOENT) logs. At this point I dont know what I could possibly be doing wrong. But when I do docker run -p 80:80 -i -t waschinski/photo-stream /bin/bash I get the "No photos!" Page. So I tried to delete all the photos from photos/original and ran docker-compose up it worked without errors! I also get the error page saying that there are no photos. So to me it seems as if there is just a problem converting photos from original dir. But why?

oliverhihn commented 2 years ago

Update: I found an error in the volume key of the docker-compse.yml and fixed it. Made an PR where I explain it.