Compare commits

...

29 Commits

Author SHA1 Message Date
c2b573a385 Update docker-compose.yaml
Adjusted VITE_APP_HTTP_STORAGE_BACKEND_URL and VITE_APP_WS_SERVER_URL
2024-08-22 16:39:15 +00:00
ddfe1948b0 Merge pull request 'Update README.md' (#1) from thomaswennersten-patch-1 into master
Reviewed-on: Sambruk/excalidraw-swe#1
Reviewed-by: SuperUser <thomas.wennersten@sambruk.se>
2024-06-18 14:48:44 +00:00
3df0ca9d1b Update README.md 2024-06-18 14:36:33 +00:00
Jingchao Di
dc38a6a489
Merge pull request #58 from alswl/feat/v0.17.3-fork-b1
feat: new excalidraw image
2024-03-16 17:02:31 +08:00
Jingchao Di
58d47735e0 feat: new excalidraw image 2024-03-16 16:53:51 +08:00
Jingchao Di
3f0e252212
Merge pull request #56 from alswl/hotfix/load-image-in-shareable-link
feat: use new excalidraw image and fix scenes url
2024-03-12 00:46:01 +08:00
Jingchao Di
9cf1a086b9 feat: use new excalidraw image and fix scenes url 2024-03-12 00:44:01 +08:00
Jingchao
c2fd843282
Merge pull request #40 from alswl/feat/doc-demo-railway
doc: add railway demo link
2023-12-02 10:40:15 +08:00
Jingchao Di
f03f572f2d doc: add railway demo link 2023-12-02 10:39:33 +08:00
Jingchao
8c9623e808
Merge pull request #39 from alswl/feat/railway
feat: add railway support
2023-11-27 00:18:26 +08:00
Jingchao Di
8a3635f0fa feat: add railway support 2023-11-27 00:17:39 +08:00
Jingchao
de50baa3e6
Merge pull request #37 from alswl/feat/v0.17.0-fork-b1
feat: upgrade to excalidraw v0.17.0
2023-11-23 07:29:40 +08:00
Jingchao Di
6971c3262c feat: upgrade to excalidraw v0.17.0 2023-11-23 07:29:04 +08:00
Jingchao
bd8d9ce6ca
Merge pull request #36 from alswl/feat/v0.16.1-fork-b2
feat: upgrade v0.16.1-b2, build for zeabur
2023-11-23 07:28:47 +08:00
Jingchao Di
367d08f4b2 feat: upgrade v0.16.1-b2, build for zeabur 2023-11-23 06:31:39 +08:00
Jingchao Di
4d150634e7 docs: upgdate docker-compose 2023-11-22 08:42:42 +08:00
Jingchao Di
51d4660f80 docs: upgrade roadmap 2023-11-22 08:40:53 +08:00
Jingchao
f0ecfbd639
feat: upgrade to v0.16.1 (#34) 2023-11-22 07:59:47 +08:00
Jingchao
090283e37d
Using dynamic env launcher instead of pre build image (#33)
* feat: using fork official image, no self build

* feat: dockernized without pre build

* docs: remove make image section

* feat: use docker hub image with dynmaic env launcher
2023-11-12 07:07:24 +08:00
Jingchao
310944b76d
feat: upstream version as main version (#31) 2023-10-07 22:43:52 +08:00
Jingchao
b35a2c3932 chore: bump docker compose version 2023-07-31 08:38:24 +08:00
Jingchao
94d3682623
Merge pull request #20 from alswl/feat/mirror
feat: enable mirror arg when build
2023-07-31 08:27:51 +08:00
Jingchao
9a7ea39cc7 feat: enable mirror arg when build 2023-07-31 01:34:36 +08:00
Jingchao
b8432ef602
fix: bump dep https://github.com/alswl/excalidraw-storage-backend/pull/4 (#19) 2023-07-31 01:31:40 +08:00
Jingchao
6c3da92c54
docs: Create LICENSE fix #16 2023-06-28 09:40:24 +08:00
Jingchao
c303948cbb feat: upgrade to release/v0.15.0-fork-b1 2023-04-29 09:57:56 +08:00
Jingchao
a533b2c33c feat: upgrade excalidraw-starting-backend 2023-02-24 03:52:31 +00:00
Jingchao
5d7faf16e0 chore: bump with master commits 2023-02-02 00:58:42 +08:00
Jingchao
33314581b8 Merge branch 'release/v0.14.2-fork' 2023-02-02 00:57:30 +08:00
11 changed files with 93 additions and 188 deletions

9
.gitmodules vendored
View File

@ -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

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
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
View File

@ -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.
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"

View File

@ -1,50 +1,33 @@
# excalidraw-collaboration
# excalidraw-collaboration-xx
One click to init an excalidraw with collaboration.
Demo:
[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](./_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:
- [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
## Build and Run
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:
```
# 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:
@ -53,9 +36,52 @@ Browse it:
- 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.
About public network release:
if you want to release your own excalidraw in public network,
you should modify the `excalidraw.env.production` file,
Replace the `REACT_APP_HTTP_STORAGE_BACKEND_URL` and `REACT_APP_WS_SERVER_URL` with your own domain.
you should modify the `docker-compose.yaml` file,
Replace the `VITE_APP_HTTP_STORAGE_BACKEND_URL` and `VITE_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.

View File

@ -1 +0,0 @@
v0.1.0-20de6c4

View File

@ -2,12 +2,21 @@
services:
frontend:
image: excalidraw:v0.1.0-20de6c4
image: alswl/excalidraw:v0.17.3-fork-b1
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:
- 80:80
storage:
image: excalidraw-storage-backend:v0.1.0-20de6c4
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 +24,6 @@ services:
- 8081:8081
room:
image: excalidraw-room:v0.1.0-20de6c4
image: excalidraw/excalidraw-room:sha-49bf529
ports:
- 8082:80

@ -1 +0,0 @@
Subproject commit a3ff46741c9ce9156739243cd0c6f2547b190dd3

@ -1 +0,0 @@
Subproject commit c0bf0ba76c270920427554e8a61511da666bcd5a

@ -1 +0,0 @@
Subproject commit 2e1412b67177d40385fce360d16d211b2dba3432

View File

@ -1,11 +0,0 @@
*
!.env
!.env.production
!.eslintrc.json
!.npmrc
!.prettierrc
!package.json
!public/
!src/
!tsconfig.json
!yarn.lock

View File

@ -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