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 #38

Open Anilo1990 opened 11 months ago

Anilo1990 commented 11 months ago

I always get this Error in collab mode. This is my docker-compose which I deploy in Portainer

services:
  frontend:
    image: alswl/excalidraw:v0.17.0-fork-b1
    environment:
      - PORT=8081
      - VITE_APP_BACKEND_V2_GET_URL=https://test.com/api/v2/
      - VITE_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/post/
      - VITE_APP_WS_SERVER_URL=http://127.0.0.1:8082
      - VITE_APP_FIREBASE_CONFIG={}
      # alswl'fork env
      # forked excalidraw can use env https://github.com/alswl/excalidraw/pull/5
      - VITE_APP_HTTP_STORAGE_BACKEND_URL=http://127.0.0.1:8081/api/v2
      - VITE_APP_STORAGE_BACKEND=http
    ports:
      - 18912:80
    networks:
     - excalidraw

  storage:
    image: alswl/excalidraw-storage-backend:v2023.11.11
    restart: always
    environment: # docs https://github.com/alswl/excalidraw-storage-backend#environement-variables
      - PORT=8081
    ports:
      - 8081:8081
    networks:
     - excalidraw

  room:
    image: excalidraw/excalidraw-room:sha-49bf529
    ports:
     - 8082:80
    networks:
     - excalidraw

networks:
 excalidraw:
  name: excalidraw
  external: true

When I check the log for StorageBackend there is a warning

WARN [StorageService] STORAGE_URI is undefined, will use non persistant in memory storage

I tried serveral things to integrate the STORAGE_URI into the docker-compose but it's not working. Here someone had the same issue and he has redis in his docker-compose. I tried this but it's not working for me or I did something wrong.

Any idea how I can solve this?

alswl commented 11 months ago
services:
  frontend:
    image: alswl/excalidraw:v0.17.0-fork-b1
    environment:
      - PORT=8081
      - VITE_APP_BACKEND_V2_GET_URL=https://test.com/api/v2/
      - VITE_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/post/
      - VITE_APP_WS_SERVER_URL=http://127.0.0.1:8082
      - VITE_APP_FIREBASE_CONFIG={}
      # alswl'fork env
      # forked excalidraw can use env https://github.com/alswl/excalidraw/pull/5
      - VITE_APP_HTTP_STORAGE_BACKEND_URL=http://127.0.0.1:8081/api/v2
      - VITE_APP_STORAGE_BACKEND=http
    ports:
      - 18912:80

  storage:
    image: alswl/excalidraw-storage-backend:v2023.11.11
    restart: always
    environment: # docs https://github.com/alswl/excalidraw-storage-backend#environement-variables
      - PORT=8081
    ports:
      - 8081:8081

  room:
    image: excalidraw/excalidraw-room:sha-49bf529
    ports:
     - 8082:80

This configurations works, maybe you should check your network policy.

Anilo1990 commented 11 months ago

@alswl nope the standard configuration doesn't work for me either :-( I've no special network policy. All other containers are running fine without any issue.

Any idea what I could check further?

`> excalidraw-storage-backend@0.0.1 start:prod

node dist/main [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [NestFactory] Starting Nest application... [Nest] 17 - 11/23/2023, 2:12:05 PM WARN [StorageService] STORAGE_URI is undefined, will use non persistant in memory storage [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [InstanceLoader] AppModule dependencies initialized +6ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RoutesResolver] ScenesController {/api/v2/scenes}: +12ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/scenes/:id, GET} route +4ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/scenes, POST} route +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RoutesResolver] RoomsController {/api/v2/rooms}: +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/rooms/:id, GET} route +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/rooms/:id, PUT} route +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RoutesResolver] FilesController {/api/v2/files}: +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/files/:id, GET} route +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/files/:id, PUT} route +0ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [NestApplication] Nest application successfully started +4ms`

alswl commented 11 months ago

Your OS and version. Docker version. Docker compose version.

Anilo1990 @.***>于2023年11月23日 周四22:17写道:

@alswl https://github.com/alswl nope the standard configuration doesn't work for me either :-( I've no special network policy. All other containers are running fine without any issue.

Any idea what I could check further?

`> @.*** start:prod

node dist/main [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [NestFactory] Starting Nest application... [Nest] 17 - 11/23/2023, 2:12:05 PM WARN [StorageService] STORAGE_URI is undefined, will use non persistant in memory storage [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [InstanceLoader] AppModule dependencies initialized +6ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RoutesResolver] ScenesController {/api/v2/scenes}: +12ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/scenes/:id, GET} route +4ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/scenes, POST} route +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RoutesResolver] RoomsController {/api/v2/rooms}: +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/rooms/:id, GET} route +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/rooms/:id, PUT} route +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RoutesResolver] FilesController {/api/v2/files}: +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/files/:id, GET} route +1ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [RouterExplorer] Mapped {/api/v2/files/:id, PUT} route +0ms [Nest] 17 - 11/23/2023, 2:12:05 PM LOG [NestApplication] Nest application successfully started +4ms`

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

Anilo1990 commented 11 months ago

@alswl DSM 720+ DSM 7.2.1-69057 Update 2

Docker Version (Container Manager) 20.10.23-1437 Docker Compose version 20.10.23, build 876964a

alswl commented 11 months ago

@Anilo1990 try to upgrade to latest docker / docker-compose version.

My version:

Docker version 24.0.6, build ed223bc Docker Compose version v2.23.0-desktop.1

Anilo1990 commented 11 months ago

@alswl I think thats not possible. I followed this guide https://www.smarthomebeginner.com/synology-docker-media-server/ but it's not possible to update to 2.23.3 because Synology is using a application called "Container Manager" to run Docker. I executed the command but it still stays on Docker version 20.10.23

alswl commented 11 months ago

Which URL did you open?

If you not run containers in your current desktop, you cannot access the "127.0.0.1" website.

So the VITE_APP_WS_SERVER_URL and VITE_APP_HTTP_STORAGE_BACKEND_URL in your configuration is wrong.

You can check your Web Dev Tools, I think the HTTP request is failed, and even you change the two env by the intranet IP, you will still get error. Because the two url is not HTTPS protocol.

You must register a HTTP SSL cert or sign by you self (with CA cert install).

Anilo1990 commented 11 months ago

@alswl I have a signed certificate with Let‘s Encrypt. It looks like this https://excalidraw.mydomain.de

alswl commented 11 months ago

@Anilo1990 you should three domains (frontend / room / storage) or sign one domain but use a Load Balancer(like nginx).

Anilo1990 commented 11 months ago

@alswl I can assign subdomains for frontend / room / storage. Can you tell me how I need to modify the docker-compose for that?

alswl commented 11 months ago

modify the docker-compose

It will be a little complicated, user need known the basis of infrastructure management(A.K.A. DevOps).

Maybe I will provide a guide later.

Anilo1990 commented 11 months ago

@alswl I thought I only had to add the subdomains somewhere in the docker-compose. I did not know that it is so complicated that I need an extra guide for it

Anilo1990 commented 11 months ago

@alswl you had time to write down a guide for my issue so I can solve it?

kschimpanski commented 11 months ago

@Anilo1990 Is the port that you set for the storage service open (8081)? I get the same error in collab mode on a local VM with docker when the port is not open. However the storage log also tells me: WARN [StorageService] STORAGE_URI is undefined, will use non persistant in memory storage

Anilo1990 commented 11 months ago

@kschimpanski I have already tried the following:

The warning message still appears in collab mode.

grafik

Anilo1990 commented 11 months ago

any idea for a solution @alswl @kschimpanski

inquam commented 8 months ago

You are not using something in front (I use authelia and traefik for instance) that could be setting a CORS-policy that is blocking you?

Anilo1990 commented 5 months ago

Nope at that time I wasn't using anything infront of excalidraw.