diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 81c2a54..0000000 --- a/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "excalidraw-storage-backend"] - path = excalidraw-storage-backend - url = https://github.com/alswl/excalidraw-storage-backend.git -[submodule "excalidraw-room"] - path = excalidraw-room - url = https://github.com/excalidraw/excalidraw-room.git -[submodule "excalidraw"] - path = excalidraw - url = https://github.com/alswl/excalidraw.git diff --git a/Makefile b/Makefile deleted file mode 100644 index b36ace8..0000000 --- a/Makefile +++ /dev/null @@ -1,106 +0,0 @@ -# The old school Makefile, following are required targets. The Makefile is written -# to allow building multiple binaries. You are free to add more targets or change -# existing implementations, as long as the semantics are preserved. -# -# make - default to 'build' target -# make test - run unit test -# make build - build local binary targets -# make container - build containers -# make push - push containers -# make clean - clean up targets -# -# The makefile is also responsible to populate project version information. - - -# Tweak the variables based on your project. -# -SHELL := /bin/bash -NOW_SHORT := $(shell date +%Y%m%d%H%M) - -PROJECT := excalidraw-collaboration -# Target binaries. You can build multiple binaries for a single project. -TARGETS := excalidraw excalidraw-room excalidraw-storage-backend - -# Container registries. -REGISTRIES ?= "" - -# Container image prefix and suffix added to targets. -# The final built images are: -# $[REGISTRY]$[IMAGE_PREFIX]$[TARGET]$[IMAGE_SUFFIX]:$[VERSION] -# $[REGISTRY] is an item from $[REGISTRIES], $[TARGET] is an item from $[TARGETS]. -IMAGE_PREFIX ?= $(strip ) -IMAGE_SUFFIX ?= $(strip ) - -# This repo's root import path (under GOPATH). -ROOT := github.com/alswl/excalidraw-collaboration - -# Git commit sha. -COMMIT := $(strip $(shell git rev-parse --short HEAD 2>/dev/null)) -COMMIT := $(COMMIT)$(shell git diff-files --quiet || echo '-dirty') -COMMIT := $(if $(COMMIT),$(COMMIT),"Unknown") - -# Current version of the project. -UPSTREAM_VERSION = $(shell cat UPSTREAM_VERSION | grep -E '^excalidraw:' | cut -d: -f2 | tr -d '[:space:]') -BUILD_VERSION = $(COMMIT) -VERSION ?= $(UPSTREAM_VERSION)-$(BUILD_VERSION) - -CHINA_MIRROR ?= false - -# Support gsed on OSX (installed via brew), falling back to sed. On Linux -# systems gsed won't be installed, so will use sed as expected. -SED ?= $(shell which gsed 2>/dev/null || which sed) - -.PHONY: help -help: ## Display this help - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - -.PHONY: patch -patch: ## Patch endpoints - @echo "# you can edit excalidraw.env.production to change endpoints" - cp excalidraw.env.production excalidraw/.env.production - cp excalidraw.dockerignore excalidraw/.dockerignore - -.PHONY: images -images: ## Build docker images - @for target in $(TARGETS); do \ - for registry in $(REGISTRIES); do \ - image=$${registry}$(IMAGE_PREFIX)$${target}$(IMAGE_SUFFIX):$(VERSION); \ - docker build \ - -t $${image} \ - --build-arg COMMIT=$(COMMIT) \ - --build-arg CHINA_MIRROR=$(CHINA_MIRROR) \ - --progress=plain \ - -f ./$${target}/Dockerfile $${target}; \ - done; \ - done - -.PHONY: push-images -push-images: ## Push docker images - @for target in $(TARGETS); do \ - for registry in $(REGISTRIES); do \ - image=$${registry}$(IMAGE_PREFIX)$${target}$(IMAGE_SUFFIX):$(VERSION); \ - docker push $$image; \ - done; \ - done - - -.PHONY: ensure-git-clean -ensure-git-clean: ## Ensure git is clean - @if [ -n "$$(git status --porcelain)" ]; then \ - echo "# git is not clean, please commit or stash your changes first"; \ - exit 1; \ - fi - -.PHONY: update-docker-compose-version -update-docker-compose-version: ## Update images version for docker-compose - @for target in $(TARGETS); do \ - for registry in $(REGISTRIES); do \ - image=$${registry}$(IMAGE_PREFIX)$${target}$(IMAGE_SUFFIX); \ - version=$$(cat UPSTREAM_VERSION | grep -E "^$${target}:" | cut -d: -f2 | tr -d '[:space:]')-$(COMMIT); \ - $(SED) -i -E "s#image: $${image}:[^ ]+#image: $${image}:$${version}#g" docker-compose.yaml; \ - done; \ - done - -.PHONY: bump-version -bump-version: ensure-git-clean update-docker-compose-version ## Bump images version for docker-compose - @echo "PLEASE using 'git commit -a' to commit image version changes" diff --git a/README.md b/README.md index 70239bc..5e952ee 100644 --- a/README.md +++ b/README.md @@ -19,34 +19,17 @@ Related docs: - [私有化在线协同画图平台 Excalidraw | Log4D]( https://blog.alswl.com/2022/10/self-hosted-excalidraw/ ) -## Build and Run +## Deploy -Clone, patch, and build: +Clone, and run: ``` -git clone --recursive git@github.com:alswl/excalidraw-collaboration.git +git clone git@github.com:alswl/excalidraw-collaboration.git cd excalidraw-collaboration -git config submodule.excalidraw.ignore all # ignore submodule changes, we will patch them -# $EDITOR excalidraw.env.production # (optional) edit service endpoint - -make patch images # patch to configurations and build the container image -make update-docker-compose-version # update images version for docker-compose docker-compose up # run the containers -open "http://localhost" # open browser, and you can using the Team work functions -``` - -Bump version: - -excalidraw-collaboration always follow the excalidraw version, so you can only bump the appendix version. - -``` -# make sure all changes are commited -make images # build new image without dirty - -make bump-version # bump version if your configuration changes(the changes will build into -git commit -a -m 'feat: bump with my local config' # save your changes +open "http://localhost" # open browser, and you can using the collbration functions ``` Browse it: @@ -59,5 +42,31 @@ Browse it: About public network release: if you want to release your own excalidraw in public network, -you should modify the `excalidraw.env.production` file, +you should modify the `docker-compose.yaml` file, Replace the `REACT_APP_HTTP_STORAGE_BACKEND_URL` and `REACT_APP_WS_SERVER_URL` with your own domain. + +## Q & A + +### How to deploy on the cloud(aws etc) + +The `docker-compose.yaml` file is for local deploy, if you want to deploy on the cloud, +you should prepare 2 Load Balancer(with HTTPS cert), one for websocket server, one for storage server. + +The `REACT_APP_HTTP_STORAGE_BACKEND_URL` is for the Load Balancer URL(HTTPS) for storage, +and the `REACT_APP_WS_SERVER_URL` is for the Load Balancer URL(HTTPS) for websocket. + +Here is a conversation about how to deploy on the aws: https://github.com/alswl/excalidraw-collaboration/issues/22 + +### generateKey problem + +Error message: + +``` +TypeError: Cannot read properties of undefined (reading 'generateKey') +``` + +Why: The excalidraw is using crypto module of Javascript, the HTTPS is required. + +How to solve: use HTTPS to access the page, or use http://localhost instead. + + diff --git a/UPSTREAM_VERSION b/UPSTREAM_VERSION deleted file mode 100644 index 8054e17..0000000 --- a/UPSTREAM_VERSION +++ /dev/null @@ -1,3 +0,0 @@ -excalidraw:v0.15.0 -excalidraw-room:c0bf0ba -excalidraw-storage-backend:e321930 diff --git a/docker-compose.yaml b/docker-compose.yaml index 048d786..727d3c2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,12 +2,22 @@ services: frontend: - image: excalidraw:v0.1.0-94d3682 + image: alswl/excalidraw:v0.15.0-fork-b3 + environment: + - PORT=8081 + - REACT_APP_BACKEND_V2_GET_URL=https://test.com/api/v2/ + - REACT_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/post/ + - REACT_APP_WS_SERVER_URL=http://127.0.0.1:8082 + - REACT_APP_FIREBASE_CONFIG={} + # alswl'fork env + # forked excalidraw can use env https://github.com/alswl/excalidraw/pull/5 + - REACT_APP_HTTP_STORAGE_BACKEND_URL=http://127.0.0.1:8081/api/v2 + - REACT_APP_STORAGE_BACKEND=http ports: - 80:80 storage: - image: excalidraw-storage-backend:v0.1.0-94d3682 + image: alswl/excalidraw-storage-backend:v2023.11.11 restart: always environment: # docs https://github.com/alswl/excalidraw-storage-backend#environement-variables - PORT=8081 @@ -15,6 +25,6 @@ services: - 8081:8081 room: - image: excalidraw-room:v0.1.0-94d3682 + image: excalidraw/excalidraw-room:sha-49bf529 ports: - 8082:80 diff --git a/excalidraw b/excalidraw deleted file mode 160000 index bf5cf82..0000000 --- a/excalidraw +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bf5cf820ed8cf0eff73fcdcf93f7d35737fe6662 diff --git a/excalidraw-room b/excalidraw-room deleted file mode 160000 index c0bf0ba..0000000 --- a/excalidraw-room +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c0bf0ba76c270920427554e8a61511da666bcd5a diff --git a/excalidraw-storage-backend b/excalidraw-storage-backend deleted file mode 160000 index e321930..0000000 --- a/excalidraw-storage-backend +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e3219306d1ef8db6981e4918d73a3c957c025340 diff --git a/excalidraw.dockerignore b/excalidraw.dockerignore deleted file mode 100644 index 5e3baf7..0000000 --- a/excalidraw.dockerignore +++ /dev/null @@ -1,11 +0,0 @@ -* -!.env -!.env.production -!.eslintrc.json -!.npmrc -!.prettierrc -!package.json -!public/ -!src/ -!tsconfig.json -!yarn.lock diff --git a/excalidraw.env.production b/excalidraw.env.production deleted file mode 100644 index a13ca1f..0000000 --- a/excalidraw.env.production +++ /dev/null @@ -1,21 +0,0 @@ -REACT_APP_BACKEND_V2_GET_URL=https://test.com/api/v2/ -REACT_APP_BACKEND_V2_POST_URL=https://test.com/api/v2/post/ - -REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com -REACT_APP_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries - -REACT_APP_HTTP_STORAGE_BACKEND_URL=http://127.0.0.1:8081/api/v2 -REACT_APP_STORAGE_BACKEND=http - -REACT_APP_PORTAL_URL= -# Fill to set socket server URL used for collaboration. -# Meant for forks only: excalidraw.com uses custom REACT_APP_PORTAL_URL flow -REACT_APP_WS_SERVER_URL=http://127.0.0.1:8082 - -REACT_APP_FIREBASE_CONFIG='{}' - -# production-only vars -REACT_APP_GOOGLE_ANALYTICS_ID=foo - -REACT_APP_PLUS_APP=https://app.excalidraw.com -