11

Hi,

I've been trying to host my own lemmy instance for a while. i've almost got it working (i think). But my problem now is that whenever i try to post something with a picture i get an error SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data. In firefox i get a 502 bad gateway error pointing to https://lemmy.emphisia.nl/pictrs/image I don't really know why because everything seems to be working

you are viewing a single comment's thread
view the rest of the comments
[-] youpie_temp@reddthat.com 1 points 1 year ago* (last edited 1 year ago)

yeah I've already done that, I did sudo chown -r 991:991 volumes/pictrs. what details do you need about my setup? edit: I do know another program is already using port 8080 on my host machine, or does that not matter when it's running inside docker?

[-] poVoq@slrpnk.net 1 points 1 year ago* (last edited 1 year ago)

Depends. If it runs in a separated docker network then not. Pict-rs only needs to be reachable by the lemmy backend and have out-going internet access. But I would try changing the port as I think the official docker-compose script removed the internal network for some reason, not sure (I am using my own Podman based setup).

[-] youpie_temp@reddthat.com 0 points 1 year ago

it does appear to be in its own network (according to portainer) the error log in the lemmy container is

2023-07-23T13:58:44.850844Z  WARN lemmy_server::root_span_builder: Request error: error sending request for url (http://127.0.0.1:8080/image): error trying to connect: tcp connect error: Connection refused (os error 111)

Reqwest(reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(8080), path: "/image", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })) })

no errors appear when i look at the pictrs log. I don't know why it says password: None as i've set a password

[-] poVoq@slrpnk.net 1 points 1 year ago

Hmm not sure. The api-key ENV variable changed with pict-rs 0.4 to PICTRS__SERVER__API_KEY, maybe double-check that this is correctly updated and also the same as in your lemmy.hjson config file.

[-] youpie_temp@reddthat.com 1 points 1 year ago

PICTRS__SERVER__API_KEY

the config in docker compose looks like

  pictrs:
    image: asonix/pictrs:0.4.0
    # this needs to match the pictrs url in lemmy.hjson
    hostname: 127.0.0.1
    # we can set options to pictrs like this, here we set max. image size and forced format for conversion
    # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp
    environment:
      - PICTRS_OPENTELEMETRY_URL=http://otel:4137
      - PICTRS__SERVER__API_KEY=****
      - RUST_LOG=debug
      - RUST_BACKTRACE=full
      - PICTRS__MEDIA__VIDEO_CODEC=vp9
      - PICTRS__MEDIA__GIF__MAX_WIDTH=256
      - PICTRS__MEDIA__GIF__MAX_HEIGHT=256
      - PICTRS__MEDIA__GIF__MAX_AREA=65536
      - PICTRS__MEDIA__GIF__MAX_FRAME_COUNT=400
    user: 991:991

and in the config it is

  pictrs: {
    url: "http://127.0.0.1:8080/"
    api_key: "****"
  }

the password on both is the same so i don't see what is going wrong :(

[-] MangoPenguin@lemmy.blahaj.zone 1 points 1 year ago

I haven't done this setup myself, but the hostname being 127.0.0.1 is suspect, especially since it mentions a pictrs URL config in lemmy.

[-] youpie_temp@reddthat.com 1 points 1 year ago

yeah i changed that because i was testing. but i now realize that was dumb. ive change both the hostname and the url to pictrs. OMG that just worked..... i feel so dumb rn. it is strange tho because that wasnt working before. Thanks for all the help :)

[-] poVoq@slrpnk.net 1 points 1 year ago

Well, did you try changing the 8080 port to rule that out?

[-] youpie_temp@reddthat.com 1 points 1 year ago* (last edited 1 year ago)

hmm after looking i dont even see an option to change the port (in pictrs). it seems stuck at 8080, but since its running on its own network, i doubt it would matter.

[-] poVoq@slrpnk.net 1 points 1 year ago

just change the port the container exposes, like -p 8081:8080

this post was submitted on 23 Jul 2023
11 points (100.0% liked)

Self Hosted - Self-hosting your services.

11504 readers
2 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules

Important

Beginning of January 1st 2024 this rule WILL be enforced. Posts that are not tagged will be warned and if not fixed within 24h then removed!

Cross-posting

If you see a rule-breaker please DM the mods!

founded 3 years ago
MODERATORS