LycheeOrg / Lychee-Docker

Docker image for Lychee
https://lycheeorg.github.io/
167 stars 55 forks source link

The API documentation in the Lychee instance is inaccessible #161

Closed ttionya closed 1 year ago

ttionya commented 1 year ago

Detailed description of the problem [REQUIRED]

Update

I attempted to use the devtools tag and set the environment variables APP_ENV=development, APP_DEBUG=true and DEBUGBAR_ENABLED=true to recreate the Lychee instance, but I still cannot access /docs/api.

Dev Mode 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. Warning: Default timezone not properly set; you might experience strange results when importing photos without explicit EXIF timezone Warning: git (software) is not available. Foreign key: access_permissions.user_id → users.id : CASCADE Foreign key: albums.parent_id → albums.id : NO ACTION Foreign key: albums.id → base_albums.id : NO ACTION Foreign key: albums.cover_id → photos.id : CASCADE Foreign key: base_albums.owner_id → users.id : NO ACTION Foreign key: jobs_history.owner_id → users.id : NO ACTION Foreign key: photos.album_id → albums.id : NO ACTION Foreign key: photos.owner_id → users.id : NO ACTION Foreign key: size_variants.photo_id → photos.id : NO ACTION Foreign key: sym_links.size_variant_id → size_variants.id : NO ACTION Foreign key: tag_albums.id → base_albums.id : NO ACTION System Information ------------------ Lychee Version (git): master (f1fc1a4) -- 1 commits behind 6191172 (25 seconds ago) DB Version: 4.10.0 composer install: --no-dev APP_ENV: development APP_DEBUG: true System: Linux PHP Version: 8.2.7 PHP User agent: Lychee/4 (https://lycheeorg.github.io/) Timezone: UTC Max uploaded file size: 100M Max post size: 100M Max execution time: 3600 MySQL Version: 8.0.33 exec() Available: yes Imagick Available: 1 Imagick Enabled: 1 Imagick Version: 1691 GD Version: 2.3.3 Number of foreign key: 11 found. Config Information ------------------ version: 041000 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 layout: 1 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 site_owner: John Smith landing_title: John Smith landing_subtitle: Cats, Dogs & Humans Photography sm_facebook_url: https://www.facebook.com/JohnSmith sm_flickr_url: https://www.flickr.com/JohnSmith sm_twitter_url: https://www.twitter.com/JohnSmith sm_instagram_url: https://instagram.com/JohnSmith sm_youtube_url: https://www.youtube.com/JohnSmith landing_background: dist/cat.webp site_title: Lychee v4 footer_show_copyright: 1 site_copyright_begin: 2019 site_copyright_end: 2019 footer_additional_text: footer_show_social_media: 0 public_search: 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 public_photos_hidden: 1 new_photos_notification: 0 legacy_id_redirection: 1 zip_deflate_level: 6 SA_enabled: 1 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 ffmpeg_path: /usr/bin/ffmpeg ffprobe_path: /usr/bin/ffprobe

I am running a Lychee instance using Docker Compose. But the API documentation in the Lychee instance is inaccessible (get 404).

This is how the official documentation describes it:

As of version 4.8.1, the api documentation is moved directly inside your own Lychee instance. It is accessible at the url https://yourLycheeInstance.org/docs/api.

I've reviewed the PR LycheeOrg/Lychee#1827 with the changes, and it requires web_admin access to view. I'm certain that I've logged in with the admin credentials because I can access addresses like /Permissions, which are only accessible to web_admin. However, when I attempt to access /docs/api, it returns a 404 error.

Due to privacy concerns, I'm unable to provide an online accessible link. Please refer to the screenshot for reference.

Here is my docker-compose.yaml:

services:
  lychee:
    image: lycheeorg/lychee:v4.10.0
    container_name: lychee
    restart: unless-stopped
    ports:
      - '172.17.0.1:12390:80'
    environment:
      - PHP_TZ=UTC
      - TIMEZONE=UTC
      - DB_CONNECTION=mysql
      - DB_HOST=host.docker.internal
      - DB_PORT=3306
      - DB_DATABASE=lychee
      - DB_USERNAME=lychee
      - DB_PASSWORD=password
      - STARTUP_DELAY=0
    volumes:
      - ./data/conf:/conf
      - ./data/uploads:/uploads
      - ./data/sym:/sym
      - ./logs:/logs
    extra_hosts:
      - 'host.docker.internal:host-gateway'

Steps to reproduce the issue

  1. Launch the Lychee instance using Docker Compose.
  2. Access https://example.com/docs/api.

Screenshots

I can access the /Permissions page:

image

However, accessing /docs/api returns a 404 error:

image

Docker compose log:

image

Output of the diagnostics [REQUIRED]

Diagnostics Diagnostics ----------- Warning: Dropbox import not working. dropbox_key is empty. Warning: Default timezone not properly set; you might experience strange results when importing photos without explicit EXIF timezone Warning: git (software) is not available. Foreign key: access_permissions.user_id → users.id : CASCADE Foreign key: albums.parent_id → albums.id : NO ACTION Foreign key: albums.id → base_albums.id : NO ACTION Foreign key: albums.cover_id → photos.id : CASCADE Foreign key: base_albums.owner_id → users.id : NO ACTION Foreign key: jobs_history.owner_id → users.id : NO ACTION Foreign key: photos.album_id → albums.id : NO ACTION Foreign key: photos.owner_id → users.id : NO ACTION Foreign key: size_variants.photo_id → photos.id : NO ACTION Foreign key: sym_links.size_variant_id → size_variants.id : NO ACTION Foreign key: tag_albums.id → base_albums.id : NO ACTION System Information ------------------ Lychee Version (git): ?? (dcd9bc1) -- Could not compare. DB Version: 4.10.0 composer install: --no-dev APP_ENV: production APP_DEBUG: false System: Linux PHP Version: 8.2.7 PHP User agent: Lychee/4 (https://lycheeorg.github.io/) Timezone: UTC Max uploaded file size: 100M Max post size: 100M Max execution time: 3600 MySQL Version: 8.0.34 exec() Available: yes Imagick Available: 1 Imagick Enabled: 1 Imagick Version: 1691 GD Version: 2.3.3 Number of foreign key: 11 found. Config Information ------------------ version: 041000 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: zh_CN layout: 1 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: 0 small_2x: 0 medium_2x: 0 landing_page_enable: 0 site_owner: ttionya landing_title: ttionya landing_subtitle: Cats, Dogs & Humans Photography sm_facebook_url: sm_flickr_url: sm_twitter_url: sm_instagram_url: sm_youtube_url: landing_background: dist/cat.webp site_title: Album footer_show_copyright: 0 site_copyright_begin: 2014 site_copyright_end: 2023 footer_additional_text: footer_show_social_media: 0 public_search: 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: 0 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 public_photos_hidden: 1 new_photos_notification: 0 legacy_id_redirection: 1 zip_deflate_level: 6 SA_enabled: 1 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
ildyria commented 1 year ago

That's because it is only accessible in dev mode. The lychee docker deploy is a production environment. If you want to have access to those on your lychee instance, you need to switch to the devtools tag.

I do agree this is not clear and could be improved in the documentation.

ildyria commented 1 year ago

I can access the /Permissions page:

Note that this is more of a debugging page to list all the permissions allowed for a certain user with regard to albums. Nothing related to rights to see logs etc.

ttionya commented 1 year ago

Thank you for your prompt response.

ttionya commented 1 year ago

@ildyria

I have re-created a lychee-dev instance, but even after logging in with the web_admin account, I still cannot access /docs/api. I've attempted this with both the devtools and dev tags.

Here is my docker-compose.yaml:

services:
  lychee:
    image: lycheeorg/lychee:dev
    container_name: lychee-dev
    restart: unless-stopped
    ports:
      - 12392:80
      - '172.17.0.1:12393:80'
    environment:
      - PHP_TZ=UTC
      - TIMEZONE=UTC
      - APP_ENV=development
      - APP_DEBUG=true
      - DEBUGBAR_ENABLED=true
      - DB_CONNECTION=mysql
      - DB_HOST=host.docker.internal
      - DB_PORT=3306
      - DB_DATABASE=lychee-dev
      - DB_USERNAME=lychee-dev
      - DB_PASSWORD=password
      - STARTUP_DELAY=0
    volumes:
      - ./data/conf:/conf
      - ./data/uploads:/uploads
      - ./data/sym:/sym
      - ./data/logs:/logs
    extra_hosts:
      - 'host.docker.internal:host-gateway'
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. Warning: Default timezone not properly set; you might experience strange results when importing photos without explicit EXIF timezone Warning: git (software) is not available. Foreign key: access_permissions.user_id → users.id : CASCADE Foreign key: albums.parent_id → albums.id : NO ACTION Foreign key: albums.id → base_albums.id : NO ACTION Foreign key: albums.cover_id → photos.id : CASCADE Foreign key: base_albums.owner_id → users.id : NO ACTION Foreign key: jobs_history.owner_id → users.id : NO ACTION Foreign key: photos.album_id → albums.id : NO ACTION Foreign key: photos.owner_id → users.id : NO ACTION Foreign key: size_variants.photo_id → photos.id : NO ACTION Foreign key: sym_links.size_variant_id → size_variants.id : NO ACTION Foreign key: tag_albums.id → base_albums.id : NO ACTION System Information ------------------ Lychee Version (git): master (f1fc1a4) -- 1 commits behind 6191172 (4 minutes ago) DB Version: 4.10.0 composer install: --no-dev APP_ENV: development APP_DEBUG: true System: Linux PHP Version: 8.2.7 PHP User agent: Lychee/4 (https://lycheeorg.github.io/) Timezone: UTC Max uploaded file size: 100M Max post size: 100M Max execution time: 3600 MySQL Version: 8.0.33 exec() Available: yes Imagick Available: 1 Imagick Enabled: 1 Imagick Version: 1691 GD Version: 2.3.3 Number of foreign key: 11 found. Config Information ------------------ version: 041000 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 layout: 1 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 site_owner: John Smith landing_title: John Smith landing_subtitle: Cats, Dogs & Humans Photography sm_facebook_url: https://www.facebook.com/JohnSmith sm_flickr_url: https://www.flickr.com/JohnSmith sm_twitter_url: https://www.twitter.com/JohnSmith sm_instagram_url: https://instagram.com/JohnSmith sm_youtube_url: https://www.youtube.com/JohnSmith landing_background: dist/cat.webp site_title: Lychee v4 footer_show_copyright: 1 site_copyright_begin: 2019 site_copyright_end: 2019 footer_additional_text: footer_show_social_media: 0 public_search: 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 public_photos_hidden: 1 new_photos_notification: 0 legacy_id_redirection: 1 zip_deflate_level: 6 SA_enabled: 1 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 ffmpeg_path: /usr/bin/ffmpeg ffprobe_path: /usr/bin/ffprobe

Am I doing something wrong?

ildyria commented 1 year ago

image: lycheeorg/lychee:devtools should be the tag you want. Weird that this is not working. @d7415 ?

ttionya commented 1 year ago

Yes, indeed. When the tag is devtools, accessing /docs/api still results in a 404 error.

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. Warning: Default timezone not properly set; you might experience strange results when importing photos without explicit EXIF timezone Warning: git (software) is not available. Foreign key: access_permissions.user_id → users.id : CASCADE Foreign key: albums.parent_id → albums.id : NO ACTION Foreign key: albums.id → base_albums.id : NO ACTION Foreign key: albums.cover_id → photos.id : CASCADE Foreign key: base_albums.owner_id → users.id : NO ACTION Foreign key: jobs_history.owner_id → users.id : NO ACTION Foreign key: photos.album_id → albums.id : NO ACTION Foreign key: photos.owner_id → users.id : NO ACTION Foreign key: size_variants.photo_id → photos.id : NO ACTION Foreign key: sym_links.size_variant_id → size_variants.id : NO ACTION Foreign key: tag_albums.id → base_albums.id : NO ACTION System Information ------------------ Lychee Version (git): master (f1fc1a4) -- 1 commits behind 6191172 (14 seconds ago) DB Version: 4.10.0 composer install: --no-dev APP_ENV: development APP_DEBUG: true System: Linux PHP Version: 8.2.7 PHP User agent: Lychee/4 (https://lycheeorg.github.io/) Timezone: UTC Max uploaded file size: 100M Max post size: 100M Max execution time: 3600 MySQL Version: 8.0.33 exec() Available: yes Imagick Available: 1 Imagick Enabled: 1 Imagick Version: 1691 GD Version: 2.3.3 Number of foreign key: 11 found. Config Information ------------------ version: 041000 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 layout: 1 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 site_owner: John Smith landing_title: John Smith landing_subtitle: Cats, Dogs & Humans Photography sm_facebook_url: https://www.facebook.com/JohnSmith sm_flickr_url: https://www.flickr.com/JohnSmith sm_twitter_url: https://www.twitter.com/JohnSmith sm_instagram_url: https://instagram.com/JohnSmith sm_youtube_url: https://www.youtube.com/JohnSmith landing_background: dist/cat.webp site_title: Lychee v4 footer_show_copyright: 1 site_copyright_begin: 2019 site_copyright_end: 2019 footer_additional_text: footer_show_social_media: 0 public_search: 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 public_photos_hidden: 1 new_photos_notification: 0 legacy_id_redirection: 1 zip_deflate_level: 6 SA_enabled: 1 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 ffmpeg_path: /usr/bin/ffmpeg ffprobe_path: /usr/bin/ffprobe
d7415 commented 1 year ago

Should be fixed now. Images are rebuilding, so probably around 1000 UTC.

ttionya commented 1 year ago

@d7415 ,

Hello, LycheeOrg/Lychee-Docker#162 removing --no-dev directly result in a larger Docker image size for the production environment? Shouldn't we consider checking COMPOSER_NO_DEV to decide whether to include the --no-dev flag?

d7415 commented 1 year ago

COMPOSER_NO_DEV replaces the flag. I just did an incomplete job last time.