SOLUTION:

The issue was - the ‘New UI’ docker image was automatically building for AMD64, but the Linux server is an ARM64/v8.

I had to add QEMU and multi-platform build commands to the docker-image.yml file (in Github Actions).

This creates an additional docker image for ARM64 machines, which loads and runs successfully.

This was discovered by manually building a docker container, and receiving the following message: WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

So if you get that message, you must build your docker image for the platform you are on (or multiple platforms).

** == ** == ** == ** == ** == ** == **

ORIGINAL ERROR:

THE SETUP and ERROR

  1. I made a fresh ansible install, on a fresh ubuntu 20.04 server - the Lemmy instance runs perfectly.
  2. I made a fresh fork of the 16.7 Lemmy-UI.
  3. I built a docker-image of that forked UI, and loaded it via docker-compose (here is my docker-image.yml build file ).

Now I am getting a “502 Bad Gateway - nginx” error (the site does not load).

NGINX error log shows:

connect() failed (111: Connection refused) while connecting to upstream, client: 75.222.232.212, server: ggg.com, request: "GET / HTTP/2.0", upstream: "http://0.0.0.0:15153/", host: "ggg.com"
  • Nginx config has not been modified (but here is the config anyway - ggg.conf)

  • Docker log is clean.

**

DIAGNOSIS

When I list docker containers, there is no PORT mapped to the ‘New-UI’ image container.

(However, when running the ‘default lemmy-UI’ image container, the PORT is successfully mapped to 127.0.0.1:15153->1234/tcp)

It seems I must create a new Container, using the ‘New-UI’ image, and map the PORT to 127.0.0.1:15153->1234/tcp (unless an Environment Variable can do it).

^ Now I must figure out that exact docker command. (because docker run -d -p 127.0.0.1:15153:1234 [ImageID] does not successfully create the container.)

**

Here are the Env Vars I’ve added (in various combinations/values):

  lemmy-ui:
    environment:
      - LEMMY_UI_HTTPS=true
      - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
      - LEMMY_UI_LEMMY_EXTERNAL_HOST=ggg.com
      - LEMMY_UI_DISABLE_CSP=true
      # - LEMMY_UI_LEMMY_WS_HOST=lemmy:8536
      # - LEMMY_UI_HOST=0.0.0.0:1234

here is the full docker-compose.yml (only changed Env Vars)

  • loathsome dongeater@lemmygrad.ml
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    Are you using nginx from a docker container too? I think it’s most likely that whatever port you set up for reverse proxying the UI is incorrect. To kind of test this, you can try changing the UI’s port. If the ports are mismatched you should get the bad gateway error again.

    • PicoBlaanketOP
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      2 years ago

      NGINX was setup by the ansible install (it is running directly on the VPS).

      The reverse-proxy ports were chosen by the ansible install. They work correctly when running the default lemmy-ui.

      I have not modified anything in the ‘Lemmy-UI fork’ code (only added the docker-image.yml build file on github).

      I have not modified anything on the VPS (other than the Environment Variables in docker-compose.yml, listed above).

    • PicoBlaanketOP
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      2 years ago

      When I list docker containers, there is no Port mapped to the ‘New-UI’ image container.

      However, when running the ‘default lemmy-UI’ image container, the Port is mapped to 127.0.0.1:15153->1234/tcp

      It seems I must create a new Container, using the ‘New-UI’ image, and map the Port to 127.0.0.1:15153->1234/tcp (unless an Environment Variable can do it)

      ^ Now I have to figure out that exact docker command. (because docker run -d -p 127.0.0.1:15153:1234 [ImageID] does not successfully create a mapped container.)

      • loathsome dongeater@lemmygrad.ml
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        That docker run command looks correct. What is the error message you are getting? My guess is that soemthing else is already occupying your system’s port 15153.

        • PicoBlaanketOP
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          2 years ago

          It’s fixed!

          The issue was - the ‘New UI’ docker image was automatically building for AMD64, but the Linux server is an ARM64/v8.

          I had to add QEMU and multi-platform build commands to the docker-image.yml file (in Github Actions).

          This creates an additional docker image for ARM64 machines, which loads successfully.

          This was discovered by manually building a docker container, and receiving the following message: WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

          Thank you very much for replying KSYNWA! It helped me target the right area to find the problem.

          I’m sure I’ll be back with another question, as I’m kinda wingin it over here.