Lychee-Docker icon indicating copy to clipboard operation
Lychee-Docker copied to clipboard

Upgrading from v4 to v5 to v6

Open ironicbadger opened this issue 11 months ago • 15 comments

I attempted to upgrade yesterday from v4 to v5 but all the thumbnails dissapeared and no files would load in the new v5 interface - I didn't even try v6.

Could you provide some migration instructions from 4.13 -> +onwards please? Running via docker if it helps - compose.yaml.

Running instance is at https://gallery.ktz.cloud.

Thanks!

ironicbadger avatar Jan 02 '25 17:01 ironicbadger

Skip version 5 all together. Go directly to version 6.

I see that you are using traefik, you need to forward the proto. As follow is part of my docker compose:

    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.photography.rule=Host(`photography.viguier.nl`)"
      - "traefik.http.routers.photography.entrypoints=websecure"
      - "traefik.http.routers.photography.tls.certresolver=myresolver"
      - "traefik.http.middlewares.https-photography.headers.sslproxyheaders.X-Forwarded-Proto=https"
      - "traefik.http.routers.photography.middlewares=https-photography"

ildyria avatar Jan 02 '25 17:01 ildyria

BTW looking at your traefik setup:

This is bad practice:

      - /var/run/docker.sock:/var/run/docker.sock:ro

If traefik is compromised your all server is F***.

Here is some reading material : https://github.com/wollomatic/socket-proxy :)

ildyria avatar Jan 02 '25 17:01 ildyria

Also there is a change in the volumes. Here is some details (I think you can infer what needs changing):

    volumes:
      - ${PATH_TO_FILES:-.}/lychee/conf:/conf
      - ${PATH_TO_FILES:-.}/lychee/uploads:/uploads
      - ${PATH_TO_FILES:-.}/lychee/sym:/sym
      - ${PATH_TO_FILES:-.}/lychee/logs:/logs
      - ${PATH_TO_FILES:-.}/lychee/tmp:/lychee-tmp

ildyria avatar Jan 02 '25 17:01 ildyria

I would also suggest to use doozle https://dozzle.dev/ It is very very nice to get the logs of your container in real time.

ildyria avatar Jan 02 '25 17:01 ildyria

- "traefik.http.middlewares.https-photography.headers.sslproxyheaders.X-Forwarded-Proto=https"

traefik is my edge TLS termination so this is unnecessary?

so what you're saying about lychee is that it's a straight upgrade from 4.13 to 6 once the volumes have been finagled?

ironicbadger avatar Jan 02 '25 20:01 ironicbadger

traefik is my edge TLS termination so this is unnecessary?

This still necessary for Lychee to know which kind of prefix to use: http or https in the links.

so what you're saying about lychee is that it's a straight upgrade from 4.13 to 6 once the volumes have been finagled?

In theory yes.

ildyria avatar Jan 02 '25 20:01 ildyria

Unfortunately I see the same type of issue with a straight jump to v6. Logs appear to be happy the migrations were all conducted successfully, alas the gallery has no images anymore.

You can see what I mean here.

services:
...
  ktz-lychee:
    image: lycheeorg/lychee:v6.2.0
    container_name: ktz-lychee
    volumes:
      - "/opt/appdata/ktz-lychee/app/config:/conf"
      - "/opt/appdata/ktz-lychee/app/uploads:/uploads"
      - "/opt/appdata/ktz-lychee/app/sym:/sym"
      - "/opt/appdata/ktz-lychee/app/logs:/logs"
      - "/opt/appdata/ktz-lychee/app/tmp:/lychee-tmp"
    labels:
      - traefik.enable=true
      - traefik.http.routers.ktzlychee.rule=Host(`gallery.ktz.cloud`)
      - traefik.http.routers.ktzlychee.tls.certresolver=cloudflare
      - traefik.http.middlewares.ktzlychee.headers.sslproxyheaders.X-Forwarded-Proto=https
      - traefik.http.routers.ktzlychee.middlewares=ktzlychee
    environment:
      - "PHP_TZ=America/New_York"
      - DB_CONNECTION=mysql
      - DB_HOST=ktz-lychee-db
      - DB_PORT=3306
      - "DB_USERNAME=1234"
      - "DB_DATABASE=1234"
      - "DB_PASSWORD=1234"
    depends_on:
      - ktz-lychee-db
    restart: unless-stopped
  ktz-lychee-db:
    image: mariadb:10.5.5-focal
    container_name: ktz-lychee-db
    volumes:
      - "/opt/appdata/ktz-lychee/db:/var/lib/mysql"
    environment:
      - "MYSQL_ROOT_PASSWORD=1234"
      - "MYSQL_PASSWORD=1234"
      - "MYSQL_DATABASE=lychee"
      - "MYSQL_USER=lychee"
    restart: unless-stopped

ironicbadger avatar Jan 02 '25 21:01 ironicbadger

I see, go to your lychee .env file (in the config folder), look for the APP_URL and set to empty string: APP_URL= that will fix it. Or in your docker-compose:

    environment:
      APP_URL=gallery.ktz.cloud

And you should be back on track.

ildyria avatar Jan 02 '25 21:01 ildyria

Oh. Well there we are. Any need to supply https or not?

ironicbadger avatar Jan 02 '25 21:01 ironicbadger

I would supply it :)

PS: if you edit directly the .env file in config/ you do not need to redeploy, the changes are pretty much immediate.

ildyria avatar Jan 02 '25 21:01 ildyria

There is some kind of bug / weirdness with how that is parsed.

Errors
error
APP_URL (https://gall*********loud) does not match the current url (http://gall*********loud).
error
APP_URL (https://gall*********loud) does not match the current url (http://gall*********loud).

If I supply - "APP_URL=https://gallery.ktz.cloud" I get the error message above (but the images work). If I remove the https:// prefix, images break but the warning goes away.

The traefik middleware lines are unnecessary too.

ironicbadger avatar Jan 02 '25 21:01 ironicbadger

Yes, that is why the proto forwarding is needed. See here: https://github.com/LycheeOrg/Lychee-Docker/issues/214#issuecomment-2568119521 So that Lychee knows that you are using https.

They may be unnecessary for basic setup, but are necessary to enable WebAuthn.

ildyria avatar Jan 02 '25 21:01 ildyria

The built-in diagnostics state the same error regardless of whether I include those lines for traefik or not.

ironicbadger avatar Jan 02 '25 21:01 ironicbadger

Interesting. That should not be the case.

ildyria avatar Jan 02 '25 22:01 ildyria

I was able to solve this exact problem by adding TRUSTED_PROXY={CIDR_TRAEFIK_NETWORK}

No need to add custom headers as Traefik automatically adds these headers.

iodize6399 avatar Oct 19 '25 20:10 iodize6399