LycheeOrg / Lychee-Docker

Docker image for Lychee
https://lycheeorg.github.io/
165 stars 56 forks source link

new deploy with installer won't work #202

Open Szparki opened 1 month ago

Szparki commented 1 month ago

This is a brand new deployment on Ubuntu 22.04 using almost the default docker compose file:

services:
  lychee_db:
    container_name: lychee_db
    image: mariadb:10
    environment:
      - MYSQL_ROOT_PASSWORD=pass
      - MYSQL_DATABASE=lychee
      - MYSQL_USER=lychee
      - MYSQL_PASSWORD=pass
    #expose:
    #  - 3306
    volumes:
      - /data/lychee/db:/var/lib/mysql
    networks:
      - lychee
    restart: unless-stopped

  lychee:
    image: lycheeorg/lychee
    container_name: lychee
    ports:
      - 8086:80
    volumes:
      - /data/lychee/config:/conf
      - /data/lychee/uploads:/uploads
      - /data/lychee/sym:/sym
      - /data/lychee/logs:/logs
    networks:
      - lychee
    environment:
      - PUID=1005
      - PGID=1005
      - PHP_TZ=UTC
      - TIMEZONE=UTC
      - DB_CONNECTION=mysql
      - DB_HOST=lychee_db
      - DB_PORT=3306
      - DB_DATABASE=lychee
      - DB_USERNAME=lychee
      - DB_PASSWORD=pass
      - MAIL_DRIVER=smtp
      - MAIL_HOST=my.smtp.server
      - MAIL_PORT=25
      - MAIL_ENCRYPTION=null
      - STARTUP_DELAY=30
    restart: unless-stopped
    depends_on:
      - lychee_db

networks:
  lychee:

volumes:
  mysql:

The directories with the proper permissions exists on the host server:

% id lychee
uid=1005(lychee) gid=1005(lychee) groups=1005(lychee)
% stat /data/lychee/
  File: /data/lychee/
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 803h/2051d  Inode: 1186313     Links: 8
Access: (0755/drwxr-xr-x)  Uid: ( 1005/  lychee)   Gid: ( 1005/  lychee)
Access: 2024-07-07 23:47:20.297317022 +0000
Modify: 2024-07-07 23:43:50.425224395 +0000
Change: 2024-07-07 23:43:50.425224395 +0000
 Birth: 2024-07-07 23:41:44.759563137 +0000

% ll /data/lychee
total 24
drwxr-xr-x  2 lychee           lychee           4096 Jul  7 23:42 conf
drwxr-xr-x  2 root             root             4096 Jul  7 23:46 config
drwxr-xr-x  6 systemd-coredump systemd-coredump 4096 Jul  7 23:52 db
drwxrwsr-x  2 lychee           lychee           4096 Jul  7 23:44 logs
drwxrwsr-x  2 lychee           lychee           4096 Jul  7 23:44 sym
drwxrwsr-x 11 lychee           lychee           4096 Jul  7 23:44 uploads

When I access the website I get the following screen, and if I click the "Create admin account" nothing happens. I tried Firefox and Safari.

Lychee-installer

Do you have any ideas what should I try?

d7415 commented 1 month ago

It's never a good sign when the CSS isn't loading - is there anything in the console or the network tab that may give a hint? When you click the button it should start a request that may have an error response.

It also may be worth changing the permissions on the config directory, though that shouldn't be causing this particular issue.

ildyria commented 1 month ago

@Szparki are you hosting behind reverse proxy ?

Szparki commented 1 month ago

@d7415 here is a paste with the logs, I can change the config permissions, what permissions do you recommend?

% stat /data/lychee/config
  File: /data/lychee/config
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 803h/2051d  Inode: 1339777     Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2024-07-07 23:49:14.223195378 +0000
Modify: 2024-07-07 23:46:29.146269491 +0000
Change: 2024-07-07 23:46:29.146269491 +0000
 Birth: 2024-07-07 23:43:50.425224395 +0000
% ll /data/lychee/config
total 0
-rw-rw-r-- 1 www-data lychee 0 Jul  7 23:44 custom.js
-rw-rw-r-- 1 www-data lychee 0 Jul  7 23:44 user.css

@ildyria it's behind nginx, here is my configuration:

server {
    if ($host = lychee.server.my) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

     listen  80;
     server_name lychee.server.my;

     location / {
             return 301 https://$server_name$request_uri;
     }

}

 server {
     listen          443 ssl;
     server_name     lychee.server.my;
     client_max_body_size 1024M;
     add_header 'Access-Control-Allow-Origin' $http_origin always;

     access_log      /var/log/nginx/lychee.server.my-acces.log;
     error_log       /var/log/nginx/lychee.server.my-error.log;

     ssl_certificate /etc/letsencrypt/live/lychee.server.my/fullchain.pem; # managed by Certbot
     ssl_certificate_key /etc/letsencrypt/live/lychee.server.my/privkey.pem; # managed by Certbot

     location / {
        limit_req zone=limited burst=500 nodelay;
        proxy_pass      http://127.0.0.1:8086;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_read_timeout    90;
        proxy_connect_timeout 90;
        proxy_redirect        off;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Port 443;
        proxy_set_header Proxy "";
     }

}
Szparki commented 1 month ago

Here is my docker compose log: https://pastebin.com/yVJtwZav

Szparki commented 1 month ago

Adding "- APP_FORCE_HTTPS=true" to my docker compose file under lychee/environment sections has helped! I'll post more details when I'm done.

Szparki commented 1 month ago

When I'm trying to upload a file I get a Upload failed. The server returned an error! message with a 401 return code. /data/lychee/uploads is writable by lychee:lychee

% stat lychee |grep Access
Access: (0755/drwxr-xr-x)  Uid: ( 1005/  lychee)   Gid: ( 1005/  lychee)
Access: 2024-07-10 01:44:51.496288661 +0000
% stat lychee/uploads |grep Access
Access: (2775/drwxrwsr-x)  Uid: ( 1005/  lychee)   Gid: ( 1005/  lychee)
Access: 2024-07-10 01:42:20.823046404 +000

/var/log/nginx/error.log within the container is empty and APP_DEBUG=true in environment is set

ildyria commented 1 month ago

We do not write on nginx logs, there is a log panel in Lychee. Otherwise you can find them in storage/logs. What does your diagnostic page is saying?

Szparki commented 1 month ago

This is in diagnostics:

    Diagnostics
    -----------
        Warning: Dropbox import not working. dropbox_key is empty.
        Warning: zend.assertions is disabled although Lychee is in debug mode. For easier debugging code generation for assertions should be enabled.
        Info: Latest version of PHP is 8.3
        Warning: Default timezone not properly set; you might experience strange results when importing photos without explicit EXIF timezone
        Warning: git (software) is not available.

    System Information
    ------------------
        Lychee Version (tag):                    v5.5.1 (656ffae) -- Up to date (-2.3069090265129E-10 years ago).
        DB Version:                              5.5.1

        composer install:                        --no-dev
        APP_ENV:                                 production
        APP_DEBUG:                               true
        APP_URL:                                 set
        APP_DIR:                                 default
        LOG_VIEWER_ENABLED:                      true
        LIVEWIRE_ENABLED:                        true

        System:                                  Linux
        PHP Version:                             8.2.20
        PHP User agent:                          Lychee/4 (https://lycheeorg.github.io/)
        Timezone:                                UTC
        Max uploaded file size:                  100M
        Max post size:                           100M
        Livewire chunk size:                     12.00 MB
        Max execution time:                      3600
        MySQL Version:                           10.11.8-MariaDB-ubu2204

        exec() Available:                        yes
        Imagick Available:                       1
        Imagick Enabled:                         1
        Imagick Version:                         1691
        GD Version:                              2.3.3
        Number of foreign key:                   12 found.

    Config Information
    ------------------
        version:                                 050501
        check_for_updates:                       0
        sorting_photos_col:                      taken_at
        sorting_photos_order:                    ASC
        sorting_albums_col:                      max_taken_at
        sorting_albums_order:                    ASC
        imagick:                                 1
        skip_duplicates:                         0
        small_max_width:                         0
        small_max_height:                        360
        medium_max_width:                        1920
        medium_max_height:                       1080
        lang:                                    en
        image_overlay_type:                      desc
        default_license:                         none
        compression_quality:                     90
        grants_full_photo_access:                1
        delete_imported:                         0
        mod_frame_enabled:                       1
        mod_frame_refresh:                       30
        thumb_2x:                                1
        small_2x:                                1
        medium_2x:                               1
        landing_page_enable:                     0
        force_migration_in_production:           0
        search_public:                           0
        hide_version_number:                     0
        SL_enable:                               0
        SL_for_admin:                            0
        recent_age:                              1
        grants_download:                         0
        photos_wraparound:                       1
        map_display:                             0
        zip64:                                   1
        map_display_public:                      0
        map_provider:                            Wikimedia
        force_32bit_ids:                         0
        map_include_subalbums:                   0
        update_check_every_days:                 3
        has_exiftool:                            1
        share_button_visible:                    0
        import_via_symlink:                      0
        has_ffmpeg:                              1
        location_decoding:                       0
        location_decoding_timeout:               30
        location_show:                           1
        location_show_public:                    0
        rss_enable:                              0
        rss_recent_days:                         7
        rss_max_items:                           100
        prefer_available_xmp_metadata:           0
        editor_enabled:                          1
        lossless_optimization:                   0
        swipe_tolerance_x:                       150
        swipe_tolerance_y:                       250
        local_takestamp_video_formats:           .avi|.mov
        log_max_num_line:                        1000
        unlock_password_photos_with_url_param:   0
        nsfw_visible:                            1
        nsfw_blur:                               0
        nsfw_warning:                            0
        nsfw_warning_admin:                      0
        nsfw_banner_override:                    
        map_display_direction:                   1
        album_subtitle_type:                     oldstyle
        upload_processing_limit:                 4
        new_photos_notification:                 0
        legacy_id_redirection:                   1
        zip_deflate_level:                       6
        default_album_protection:                1
        album_decoration:                        layers
        album_decoration_orientation:            row
        allow_username_change:                   1
        auto_fix_orientation:                    1
        use_job_queues:                          0
        random_album_id:                         starred
        use_last_modified_date_when_no_exif_date: 0
        layout:                                  justified
        date_format_photo_thumb:                 M j, Y, g:i:s A e
        date_format_photo_overlay:               M j, Y, g:i:s A e
        date_format_sidebar_uploaded:            M j, Y, g:i:s A e
        date_format_sidebar_taken_at:            M j, Y, g:i:s A e
        date_format_hero_min_max:                F Y
        date_format_hero_created_at:             M j, Y, g:i:s A T
        date_format_album_thumb:                 M Y
        upload_chunk_size:                       0
        nsfw_banner_blur_backdrop:               0
        search_pagination_limit:                 1000
        search_minimum_length_required:          4
        photo_layout_justified_row_height:       320
        photo_layout_masonry_column_width:       300
        photo_layout_grid_column_width:          250
        photo_layout_square_column_width:        200
        photo_layout_gap:                        12
        display_thumb_album_overlay:             always
        display_thumb_photo_overlay:             hover
        default_album_thumb_aspect_ratio:        1/1
        use_album_compact_header:                0
        login_button_position:                   left
        back_button_enabled:                     0
        back_button_text:                        Return to Home
        current_job_processing_visible:          1
        SA_random_thumbs:                        0
        job_processing_queue_visible:            1
        login_required:                          0
        enable_unsorted:                         1
        enable_starred:                          1
        enable_recent:                           1
        enable_on_this_day:                      1
        login_required_root_only:                1

I found the log panel within Lychee, thank you. This is what I see there when I'm trying to upload a photo:

Error   2024-07-10 11:25:59 production  Illuminate\Foundation\Application::abort:1389   

Illuminate\Foundation\Application::abort:1389 
App\Http\Middleware\QueryStringFixer::handle:40 ; caused by

Notice  2024-07-10 11:22:26 production  App\Livewire\Components\Modals\Login::submit:87 User (steve) has logged in from 172.22.0.1  

App\Livewire\Components\Modals\Login::submit:87 User (steve) has logged in from 172.22.0.1
d7415 commented 1 month ago

@d7415 here is a paste with the logs, I can change the config permissions, what permissions do you recommend?

I was concerned about ownership, but it's fine within that folder, so I wouldn't worry.

Szparki commented 1 month ago

I found this in docker logs

[11/Jul/2024:21:30:00 +0000] "POST /livewire/upload-file?expires=1720737000&signature=2484aa5dba52330c5eda79391dd90d1b3e039843f5fbf039d2cf0d530526d0c7 HTTP/1.1" 401 19188 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0"

401 means unauthorized, but I'm already logged in when I'm trying to upload...

hhanzo1 commented 1 month ago

I have the same issue with a fresh docker install.

Illuminate\Foundation\Application::abort:1389 
App\Http\Middleware\QueryStringFixer::handle:40 ; caused by

@Szparki did you find a solution?

ildyria commented 1 month ago

One of the solution is to revert to version 4 front-end temporarily (until v6 is out WIP but should fix this hopefully). edit your .env file with LIVEWIRE_ENABLED=false

hhanzo1 commented 1 month ago

One of the solution is to revert to version 4 front-end temporarily (until v6 is out WIP but should fix this hopefully). edit your .env file with LIVEWIRE_ENABLED=false

Thank you.