cinnyapp / cinny

Yet another matrix client
https://cinny.in
GNU Affero General Public License v3.0
1.78k stars 229 forks source link

cinny doesnt go further than "Heating up" #1757

Open licentiapoetica opened 1 month ago

licentiapoetica commented 1 month ago

Describe the bug

After pulling the latest changes and building the docker image I was greeted by "Heating up" 20240602_205901

It doesn't go further than this.

In my nginx log I found this:

172.17.0.1 - - [02/Jun/2024:18:57:55 +0000] "GET /home/olm.wasm HTTP/1.1" 404 153 "http://localhost:8080/home/" "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0" "-"
2024/06/02 18:57:55 [error] 30#30: *1 open() "/usr/share/nginx/html/home/olm.wasm" failed (2: No such file or directory), client: 172.17.0.1, server: localhost, request: "GET /home/olm.wasm HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/home/"
2024/06/02 18:57:55 [error] 30#30: *1 open() "/usr/share/nginx/html/home/olm.wasm" failed (2: No such file or directory), client: 172.17.0.1, server: localhost, request: "GET /home/olm.wasm HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/home/"
172.17.0.1 - - [02/Jun/2024:18:57:55 +0000] "GET /home/olm.wasm HTTP/1.1" 404 153 "http://localhost:8080/home/" "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0" "-"

Reproduction

pull the latest repo version follow the steps in the documentation to build the docker image run it go to localhost:8080 and log in wait indefinetly for the heat up

Expected behavior

Login works and I can see cinny chat

Platform and versions

Docker version 20.10.24+dfsg1, build 297e128
Debian 12 Bookworm
Firefox 126.0.1

Additional context

No response

licentiapoetica commented 1 month ago

The issue is because the olm.wasm is expected to be found on /home/olm.wasm but is only being served on /olm.wasm with a custom nginx config this can be fixed by doing something dirty like this

       location /home/olm.wasm {
            proxy_pass http://localhost:8080/olm.wasm;
        }
RoblKyogre commented 1 month ago

the proposed workaround didn't work for me, but I tried another method that did fix it for me, though it does also redirect any */olm.wasm to the wasm file (which appears to be correct based on the netlify.toml file) In the container's /etc/nginx/conf.d/default, I added the following:

        location ~ ^/(.*)/olm.wasm {
                try_files $uri /olm.wasm;
                alias /app;
        }
compuguy commented 4 days ago

the proposed workaround didn't work for me, but I tried another method that did fix it for me, though it does also redirect any */olm.wasm to the wasm file (which appears to be correct based on the netlify.toml file) In the container's /etc/nginx/conf.d/default, I added the following:

        location ~ ^/(.*)/olm.wasm {
                try_files $uri /olm.wasm;
                alias /app;
        }

Yeah what I did is add is a new nginx file based on the cinny/contrib/nginx/cinny.domain.tld.conf file:

server {
    listen 80;
    listen [::]:80;

    location / {
        root /usr/share/nginx/html;
        index index.html;
    }
    location /home {
        rewrite ^/home?$ /index.html break;
    }
    location ~* ^\/(login|register) {
        try_files $uri $uri/ /index.html;
    }
    # See https://github.com/cinnyapp/cinny/issues/1757#issuecomment-2149010847
        location ~ ^/(.*)/olm.wasm {
        try_files $uri /olm.wasm;
        alias /app;
    }
}

Then modify the dockerfile to put this in the place of default/default.conf:

## Builder
FROM node:20.12.2-alpine3.18 AS builder

WORKDIR /src

COPY .npmrc package.json package-lock.json /src/
RUN npm ci
COPY . /src/
ENV NODE_OPTIONS=--max_old_space_size=4096
RUN npm run build
COPY /contrib/nginx/cinny-docker.conf /src/

## App
FROM nginx:1.27.0-alpine

RUN apk --no-cache -U upgrade

COPY --from=builder /src/dist /app
COPY --from=builder /src/cinny-docker.conf /etc/nginx/conf.d/default.conf

RUN rm -rf /usr/share/nginx/html \
  && ln -s /app /usr/share/nginx/html