alswl / excalidraw-collaboration

excalidraw with collaboration feature, self-hosting, and only one-click deploy
MIT License
377 stars 67 forks source link

Couldn't save to backend database, backend storage cant be accessed. #30

Closed rogerc66 closed 8 months ago

rogerc66 commented 1 year ago

Screenshot 2023-09-29 at 10 50 08 AM

Image 9-29-23 at 10 51 AM

Screenshot 2023-09-29 at 10 57 12 AM

Screenshot 2023-09-29 at 11 01 53 AM

Screenshot 2023-09-29 at 11 00 42 AM

Screenshot 2023-09-29 at 11 28 06 AM

Screenshot 2023-09-29 at 11 00 33 AM

I have managed to get collaboration room working, but I cant have backend storage up there, I got 404 error when trying to access the backend in browser.

I have read past issues and did all tricks but have no luck, I have reverse proxy of 3 ports (https:8006->http:8000, 8007->8001, 8008->8002) on my NAS to use https, still not working, I have noticed there is no redis container in my docker ps, could that be the problem?

rogerc66 commented 1 year ago

I have make images again and now it works, however, the collaboration is not really realtime though, I have to refresh the share link for peer to see what has changed in drawing. is this normal?

Does it suppose to update the canvas in heartbeat? anywhere shoud I look into?

rogerc66 commented 1 year ago

Now I have everything works well except save to sharing link, the realtime team work works flawlessly.

I have read others sharing link troubleshoots but non works for me.

https://mydomain:8007/api/v2/post/ returns 404, /api/v2/post not found, any idea?

yinhuihe commented 1 year ago

28

rogerc66 commented 1 year ago

28

This doesnt do the magic for me

from console, "/usr/share/nginx/html/api/v2/scenes/ failed open, no such file or directory, what path suppose to be correct one?

I'm hosting on my NAS and expose the service to WAN, so that my friends can playing with it, collaboration room works like charm, but save to sharing link it not work, although it is not a big matter, but I still wondering why.

I'm using 8006 as gate port, am I suppose to set https://myowndomain:8006/**api/v2/scenes/** ? I tried setting and after remake image, it's still not working, looks like the path it mirrored is not correct, but I dont know how to identify the correct one.

Edit: I have checked the docker folder, there is indeed no api folder inside /usr/share/nginx/html/ , any idea how to solve it?

WenThing commented 1 year ago

Hi =)

Seeing the error "/usr/share/nginx/html/api/v2/scenes/", I assume an nginx is used to proxy pass the https url to different port, so I attach my nginx conf file below just to help:

# this is nginx application conf that should be in conf.d
server{
    listen 80;
    server_name <domain-name>;

    location / {
       return 301 https://$host$request_uri;
    }
}

server{
    listen 443 ssl;

    server_name <domain-name>;

    <ssl cert configuration is here, removed for the sake of clean reading>

    location /socket.io {
        proxy_pass http://**excalidraw-room**:<your port>;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
    }

    location /api/v2 {
        proxy_set_header Host $host;
        proxy_pass http://**excalidraw-storage-backend**:<your port>;
    }

    location / {
       proxy_set_header Host $host;
       proxy_pass http://**excalidraw**:<your port>;
    }
}

p/s: just to clarify, http://excalidraw-room <--- this excalidraw-room is the docker container name that runs the excalidraw room, do change it accordingly.

Additional notes: 1) ALL of the environment URLs (BACKEND_V2_GET_URL etc.) are in my excalidraw.env.production file, I didn't list them as environment in my docker-compose.yml file.

2) I removed ports from all the environment URLs, example:

REACT_APP_BACKEND_V2_GET_URL=https://test.com/api/v2/scenes/
REACT_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/scenes/
REACT_APP_HTTP_STORAGE_BACKEND_URL=https://test.com/api/v2
REACT_APP_PORTAL_URL=https://test.com
REACT_APP_WS_SERVER_URL=https://test.com
REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com

3) I also received same error "Couldn't save to the backend" till I checked & confirmed the confidential to login redis/mysql is correct, changed the environment urls to https without port numbers, changed the nginx conf file, and repackage the project (make image / make patch image). After repackage, docker compose up, everything work~

Hope these will help to set it running =)

rogerc66 commented 1 year ago

Hi =)

Seeing the error "/usr/share/nginx/html/api/v2/scenes/", I assume an nginx is used to proxy pass the https url to different port, so I attach my nginx conf file below just to help:

# this is nginx application conf that should be in conf.d
server{
    listen 80;
    server_name <domain-name>;

    location / {
       return 301 https://$host$request_uri;
    }
}

server{
    listen 443 ssl;

    server_name <domain-name>;

    <ssl cert configuration is here, removed for the sake of clean reading>

    location /socket.io {
        proxy_pass http://**excalidraw-room**:<your port>;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
    }

    location /api/v2 {
        proxy_set_header Host $host;
        proxy_pass http://**excalidraw-storage-backend**:<your port>;
    }

    location / {
       proxy_set_header Host $host;
       proxy_pass http://**excalidraw**:<your port>;
    }
}

p/s: just to clarify, http://excalidraw-room <--- this excalidraw-room is the docker container name that runs the excalidraw room, do change it accordingly.

Additional notes:

  1. ALL of the environment URLs (BACKEND_V2_GET_URL etc.) are in my excalidraw.env.production file, I didn't list them as environment in my docker-compose.yml file.
  2. I removed ports from all the environment URLs, example:
REACT_APP_BACKEND_V2_GET_URL=https://test.com/api/v2/scenes/
REACT_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/scenes/
REACT_APP_HTTP_STORAGE_BACKEND_URL=https://test.com/api/v2
REACT_APP_PORTAL_URL=https://test.com
REACT_APP_WS_SERVER_URL=https://test.com
REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com
  1. I also received same error "Couldn't save to the backend" till I checked & confirmed the confidential to login redis/mysql is correct, changed the environment urls to https without port numbers, changed the nginx conf file, and repackage the project (make image / make patch image). After repackage, docker compose up, everything work~

Hope these will help to set it running =)

Thank you for your input.

Are you using nginx inside or outside of the docker?

WenThing commented 1 year ago

Nginx is deployed as docker container and connected with the excalidraw containers via docker bridge network.

Since all containers are in a same bridge network, no ports exposed in docker compose, and I can proxy pass from the nginx to the excalidraw containers by calling the name of the excalidraw containers.

On Tue, 3 Oct 2023, 22:07 rogerc66, @.***> wrote:

Hi =)

Seeing the error "/usr/share/nginx/html/api/v2/scenes/", I assume an nginx is used to proxy pass the https url to different port, so I attach my nginx conf file below just to help:

this is nginx application conf that should be in conf.d

server{ listen 80; server_name ;

location / {
   return 301 https://$host$request_uri;
}

}

server{ listen 443 ssl;

server_name <domain-name>;

<ssl cert configuration is here, removed for the sake of clean reading>

location /socket.io {
    proxy_pass http://**excalidraw-room**:<your port>;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
}

location /api/v2 {
    proxy_set_header Host $host;
    proxy_pass http://**excalidraw-storage-backend**:<your port>;
}

location / {
   proxy_set_header Host $host;
   proxy_pass http://**excalidraw**:<your port>;
}

}

p/s: just to clarify, http://excalidraw-room <--- this excalidraw-room is the docker container name that runs the excalidraw room, do change it accordingly.

Additional notes:

  1. ALL of the environment URLs (BACKEND_V2_GET_URL etc.) are in my excalidraw.env.production file, I didn't list them as environment in my docker-compose.yml file.
  2. I removed ports from all the environment URLs, example:

REACT_APP_BACKEND_V2_GET_URL=https://test.com/api/v2/scenes/ REACT_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/scenes/ REACT_APP_HTTP_STORAGE_BACKEND_URL=https://test.com/api/v2 REACT_APP_PORTAL_URL=https://test.com https://test.com/api/v2/scenes/REACT_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/scenes/REACT_APP_HTTP_STORAGE_BACKEND_URL=https://test.com/api/v2REACT_APP_PORTAL_URL=https://test.com REACT_APP_WS_SERVER_URL=https://test.com REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com

  1. I also received same error "Couldn't save to the backend" till I checked & confirmed the confidential to login redis/mysql is correct, changed the environment urls to https without port numbers, changed the nginx conf file, and repackage the project (make image / make patch image). After repackage, docker compose up, everything work~

Hope these will help to set it running =)

Thank you for your input.

Are you using nginx inside or outside of the docker?

— Reply to this email directly, view it on GitHub https://github.com/alswl/excalidraw-collaboration/issues/30#issuecomment-1745055480, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT5UFF3MZYNIROTPT3LVD3LX5QL35AVCNFSM6AAAAAA5L3GDRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBVGA2TKNBYGA . You are receiving this because you commented.Message ID: @.***>

rogerc66 commented 1 year ago

Nginx is deployed as docker container and connected with the excalidraw containers via docker bridge network. Since all containers are in a same bridge network, no ports exposed in docker compose, and I can proxy pass from the nginx to the excalidraw containers by calling the name of the excalidraw containers. On Tue, 3 Oct 2023, 22:07 rogerc66, @.> wrote: Hi =) Seeing the error "/usr/share/nginx/html/api/v2/scenes/", I assume an nginx is used to proxy pass the https url to different port, so I attach my nginx conf file below just to help: # this is nginx application conf that should be in conf.d server{ listen 80; server_name ; location / { return 301 https://$host$request_uri; } } server{ listen 443 ssl; server_name ; <ssl cert configuration is here, removed for the sake of clean reading> location /socket.io { proxy_pass http://**excalidraw-room:; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; } location /api/v2 { proxy_set_header Host $host; proxy_pass http://excalidraw-storage-backend:; } location / { proxy_set_header Host $host; proxy_pass http://excalidraw**:; } } p/s: just to clarify, http://excalidraw-room <--- this excalidraw-room is the docker container name that runs the excalidraw room, do change it accordingly. Additional notes: 1. ALL of the environment URLs (BACKEND_V2_GET_URL etc.) are in my excalidraw.env.production file, I didn't list them as environment in my docker-compose.yml file. 2. I removed ports from all the environment URLs, example: REACT_APP_BACKEND_V2_GET_URL=https://test.com/api/v2/scenes/ REACT_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/scenes/ REACT_APP_HTTP_STORAGE_BACKEND_URL=https://test.com/api/v2 REACT_APP_PORTAL_URL=https://test.com https://test.com/api/v2/scenes/REACT_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/scenes/REACT_APP_HTTP_STORAGE_BACKEND_URL=https://test.com/api/v2REACT_APP_PORTAL_URL=https://test.com REACT_APP_WS_SERVER_URL=https://test.com REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com 1. I also received same error "Couldn't save to the backend" till I checked & confirmed the confidential to login redis/mysql is correct, changed the environment urls to https without port numbers, changed the nginx conf file, and repackage the project (make image / make patch image). After repackage, docker compose up, everything work~ Hope these will help to set it running =) Thank you for your input. Are you using nginx inside or outside of the docker? — Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT5UFF3MZYNIROTPT3LVD3LX5QL35AVCNFSM6AAAAAA5L3GDRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBVGA2TKNBYGA . You are receiving this because you commented.Message ID: @.>

Understood, I use nginx to hosting other projects in a contrainer, I will launch another nginx contrainer try the setup, could you confirm that inside excalidraw frontend contrainer, inside /usr/share/nginx/html/ folder, is there /api folder? I have used docker container cp excalidraw:/usr/share/nginx/html /root/.excalidraw/ to copy the contents of the folder and there is no api folder actually inside.

WenThing commented 1 year ago

Hi, I was away past few days.

To your question, no, there is no /api folder in the /usr/share/nginx/html folder. My understanding is any url request for /api will be routed to the 'excalidraw-storage-backend' container, please refer to my nginx conf above (location /api/v2 part).

I also use nginx hosting different projects. I use server name (https://test.com) to catch any requests to excalidraw, and proxy-pass to different docker containers based on the url requests, for example the https://test.com/api is proxy-pass to excalidraw-storage-backend.

rogerc66 commented 1 year ago

Hi, I was away past few days.

To your question, no, there is no /api folder in the /usr/share/nginx/html folder. My understanding is any url request for /api will be routed to the 'excalidraw-storage-backend' container, please refer to my nginx conf above (location /api/v2 part).

I also use nginx hosting different projects. I use server name (https://test.com) to catch any requests to excalidraw, and proxy-pass to different docker containers based on the url requests, for example the https://test.com/api is proxy-pass to excalidraw-storage-backend.

Thank you for your clarification, I will try when I got time

alswl commented 10 months ago

Maybe you can try the latest version, the setup will be easier.

alswl commented 8 months ago

Closed for time out.