Compare commits
No commits in common. "master" and "release/v0.14.2-fork" have entirely different histories.
master
...
release/v0
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[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
|
21
LICENSE
21
LICENSE
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2023 Jingchao
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
106
Makefile
Normal file
106
Makefile
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
# 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.
|
||||||
|
MAJOR_VERSION = 0
|
||||||
|
MINOR_VERSION = 1
|
||||||
|
PATCH_VERSION = 0
|
||||||
|
BUILD_VERSION = $(COMMIT)
|
||||||
|
VERSION ?= v$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)-$(BUILD_VERSION)
|
||||||
|
|
||||||
|
# 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<target>\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) \
|
||||||
|
--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); \
|
||||||
|
$(SED) -i -E "s#image: $${image}:[^ ]+#image: $${image}:$(VERSION)#g" docker-compose.yaml; \
|
||||||
|
done; \
|
||||||
|
done
|
||||||
|
|
||||||
|
.PHONY: bump-version
|
||||||
|
previousVersion=$(shell head -n 1 ./VERSION)
|
||||||
|
bump-version: ensure-git-clean update-docker-compose-version ## Bump images version for docker-compose
|
||||||
|
echo $(VERSION) > ./VERSION
|
||||||
|
@echo "PLEASE using 'git commit -a' to commit image version changes"
|
92
README.md
92
README.md
@ -1,33 +1,50 @@
|
|||||||
# excalidraw-collaboration-xx
|
# excalidraw-collaboration
|
||||||
|
|
||||||
Demo:
|
One click to init an excalidraw with collaboration.
|
||||||
|
|
||||||
[demo](https://excalidraw-production-4d27.up.railway.app/) on [Railway](https://railway.app?referralCode=HM_ZCO)
|
|
||||||
|
|
||||||
One click to deploy your excalidraw with collaboration.
|
|
||||||
|
|
||||||
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/PjQnHs?referralCode=HM_ZCO)
|
|
||||||
|
|
||||||
Snapshot:
|
Snapshot:
|
||||||
|
|
||||||
![snapshot](./_assets/snapshot.png)
|
![snapshot](./_assets/snapshot.png)
|
||||||
|
|
||||||
|
Demo:
|
||||||
|
|
||||||
|
[Live Demo](https://draw2.dmitrysamoylenko.in/)
|
||||||
|
A live room sample here: [live room](https://draw2.dmitrysamoylenko.in/#room=f8671f3fdef3ada5128c,Dyn8aqg8RII9rzUVIl9i7w)
|
||||||
|
|
||||||
|
Thanks a lot to @samoylenkodmitry.
|
||||||
|
|
||||||
Related docs:
|
Related docs:
|
||||||
|
|
||||||
- [Self hosted online collaborative drawing platform Excalidraw | Log4D](https://en.blog.alswl.com/2022/10/self-hosted-excalidraw/)
|
- [Self hosted online collaborative drawing platform Excalidraw | Log4D](https://en.blog.alswl.com/2022/10/self-hosted-excalidraw/)
|
||||||
- [私有化在线协同画图平台 Excalidraw | Log4D](https://blog.alswl.com/2022/10/self-hosted-excalidraw/)
|
- [私有化在线协同画图平台 Excalidraw | Log4D]( https://blog.alswl.com/2022/10/self-hosted-excalidraw/ )
|
||||||
|
|
||||||
## Deploy
|
|
||||||
|
|
||||||
Clone, and run:
|
## Build and Run
|
||||||
|
|
||||||
|
Clone, patch, and build:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone git@github.com:alswl/excalidraw-collaboration.git
|
git clone --recursive git@github.com:alswl/excalidraw-collaboration.git
|
||||||
cd excalidraw-collaboration
|
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
|
docker-compose up # run the containers
|
||||||
|
|
||||||
open "http://localhost" # open browser, and you can using the collbration functions
|
open "http://localhost" # open browser, and you can using the Team work functions
|
||||||
|
```
|
||||||
|
|
||||||
|
Bump 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
|
||||||
```
|
```
|
||||||
|
|
||||||
Browse it:
|
Browse it:
|
||||||
@ -36,52 +53,9 @@ Browse it:
|
|||||||
- Click the `Live Collaboration` button, and you will see the collaboration page
|
- Click the `Live Collaboration` button, and you will see the collaboration page
|
||||||
- Now you can share the collaboration page with your friends, and you can draw together.
|
- Now you can share the collaboration page with your friends, and you can draw together.
|
||||||
|
|
||||||
|
|
||||||
About public network release:
|
About public network release:
|
||||||
|
|
||||||
if you want to release your own excalidraw in public network,
|
if you want to release your own excalidraw in public network,
|
||||||
you should modify the `docker-compose.yaml` file,
|
you should modify the `excalidraw.env.production` file,
|
||||||
Replace the `VITE_APP_HTTP_STORAGE_BACKEND_URL` and `VITE_APP_WS_SERVER_URL` with your own domain.
|
Replace the `REACT_APP_HTTP_STORAGE_BACKEND_URL` and `REACT_APP_WS_SERVER_URL` with your own domain.
|
||||||
|
|
||||||
## Roadmap
|
|
||||||
|
|
||||||
- [x] self-host
|
|
||||||
- [x] collaboration feature works
|
|
||||||
- [x] docker-compose support
|
|
||||||
- [x] no pre-build image, dynamic env
|
|
||||||
- [x] upload Docker Hub image
|
|
||||||
- [ ] S3 storage support
|
|
||||||
- [ ] SSO support
|
|
||||||
- [x] HTTPS Demo and
|
|
||||||
- [x] HTTPS docs
|
|
||||||
- [ ] Helm support
|
|
||||||
- [x] online demo
|
|
||||||
- [x] one click to deploy Railway
|
|
||||||
|
|
||||||
## Upgrade Guide
|
|
||||||
|
|
||||||
- v0.15.0 -> v0.16.1
|
|
||||||
- replace `REACT_APP_` env with `VITE_APP_`
|
|
||||||
|
|
||||||
## 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 `VITE_APP_HTTP_STORAGE_BACKEND_URL` is for the Load Balancer URL(HTTPS) for storage,
|
|
||||||
and the `VITE_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.
|
|
||||||
|
@ -2,21 +2,12 @@
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
image: alswl/excalidraw:v0.17.3-fork-b1
|
image: excalidraw:v0.1.0-20de6c4
|
||||||
environment:
|
|
||||||
- VITE_APP_BACKEND_V2_GET_URL=http://127.0.0.1:8081/api/v2/scenes/
|
|
||||||
- VITE_APP_BACKEND_V2_POST_URL=http://127.0.0.1:8081/api/v2/scenes/
|
|
||||||
- VITE_APP_WS_SERVER_URL=http://git.sambruk.se: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://git.sambruk.se:8081/api/v2
|
|
||||||
- VITE_APP_STORAGE_BACKEND=http
|
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
image: alswl/excalidraw-storage-backend:v2023.11.11
|
image: excalidraw-storage-backend:v0.1.0-20de6c4
|
||||||
restart: always
|
restart: always
|
||||||
environment: # docs https://github.com/alswl/excalidraw-storage-backend#environement-variables
|
environment: # docs https://github.com/alswl/excalidraw-storage-backend#environement-variables
|
||||||
- PORT=8081
|
- PORT=8081
|
||||||
@ -24,6 +15,6 @@ services:
|
|||||||
- 8081:8081
|
- 8081:8081
|
||||||
|
|
||||||
room:
|
room:
|
||||||
image: excalidraw/excalidraw-room:sha-49bf529
|
image: excalidraw-room:v0.1.0-20de6c4
|
||||||
ports:
|
ports:
|
||||||
- 8082:80
|
- 8082:80
|
1
excalidraw
Submodule
1
excalidraw
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit a3ff46741c9ce9156739243cd0c6f2547b190dd3
|
1
excalidraw-room
Submodule
1
excalidraw-room
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c0bf0ba76c270920427554e8a61511da666bcd5a
|
1
excalidraw-storage-backend
Submodule
1
excalidraw-storage-backend
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 2e1412b67177d40385fce360d16d211b2dba3432
|
11
excalidraw.dockerignore
Normal file
11
excalidraw.dockerignore
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
*
|
||||||
|
!.env
|
||||||
|
!.env.production
|
||||||
|
!.eslintrc.json
|
||||||
|
!.npmrc
|
||||||
|
!.prettierrc
|
||||||
|
!package.json
|
||||||
|
!public/
|
||||||
|
!src/
|
||||||
|
!tsconfig.json
|
||||||
|
!yarn.lock
|
21
excalidraw.env.production
Normal file
21
excalidraw.env.production
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user