danoweb
danoweb copied to clipboard
Yet another distributed authoring environment built with deno
danoweb
distributed authoring environment built with deno for the web
how to use
- demo site: https://danoweb.digitalmuseum.jp
- docker image: arcatdmz/danoweb
- anyone can (collaboratively) edit any served text files by appending
?mode=edit
query parameter -- どのページも URL 末尾に?mode=edit
をつけると編集できます - those who know the authentication token (
USER_PASSWORD
) can save the edits to update the served files (ask me if interested) -- 編集結果をファイルに書き戻すにはUSER_PASSWORD
が必要です
concept
- what you see is what you can (collaboratively) edit
- built with Deno for Deno
- Deno allows to load TypeScript files on the web
- many put files on GitHub and load them through denopkg.com
- dano focuses on a more direct and casual way of sharing/editing code
- e.g.,
deno https://danoweb.digitalmuseum.jp/index.ts
-- the code can be edited at https://danoweb.digitalmuseum.jp/index.ts?mode=edit
backend
- for collaborative editing, Firebase Realtime Database is used
- for serving files and saving the edits, native file system is used
plans
- see GitHub issues for short-term goals
- Wiki-like links in the editor (currently, the code editor renders the code as-is, but there is much space for PX improvements)
- better collaborative editing experience (e.g., asking the user to login using GitHub etc. to show collaborators)
- TypeScript auto completion for all the Deno code on the web!
deploy
a) use pre-built Docker image
- docker hub: arcatdmz/danoweb
- regarding environment variables, see below.
docker run --name danoweb -p 8000:8000 \
-e API_KEY=... \
-e AUTH_DOMAIN=... \
-e DATABASE_URL=... \
-e PROJECT_ID=... \
-e STORAGE_BUCKET=bucket_id.appspot.com \
-e MESSAGING_SENDER_ID=... \
-e APP_ID=... \
-e DATABASE_PREFIX=prefix_ \
-e USER_PASSWORD=password \
arcatdmz/danoweb
b) build docker image and run
- git clone
- see "environment variables" section and put the
.env
file accordingly - docker build and run
git clone https://github.com/arcatdmz/danoweb.git
cd danoweb
vi ./server/.env
docker build . -t danoweb
docker build . --file Dockerfile.local -t danoweb:local
docker run --name danoweb -v ./public:/work/server/public -p 8000:8000 danoweb:local
c) deploy to Heroku
- git clone
- see "environment variables" section and put the
.env
file accordingly - create a Heroku project
- run
heroku config:push
to save.env
content as config vars -
git push
to make the project public
git clone https://github.com/arcatdmz/danoweb.git
cd danoweb
vi ./server/.env
heroku create <your app name>
heroku stack:set container
heroku config:push -f ./server/.env
git push heroku master
environment variables
- before starting the server, put
.env
file in./server/
-- all the values except forUSER_PASSWORD
are related to firebase cand can be retrieved from the website
API_KEY={YOUR_FIREBASE_API_KEY}
AUTH_DOMAIN={YOUR_FIREBASE_AUTH_DOMAIN}
DATABASE_URL={YOUR_FIREBASE_DATABASE_URL}
PROJECT_ID={YOUR_FIREBASE_PROJECT_ID}
STORAGE_BUCKET={YOUR_FIREBASE_STORAGE_BUCKET}
MESSAGING_SENDER_ID={YOUR_MESSAGING_SENDER_ID}
APP_ID={YOUR_APP_ID}
DATABASE_PREFIX={PATH_PREFIX_FOR_YOUR_DATABASE(optional)}
USER_PASSWORD={PASSWORD_FOR_AUTHENTICATION}
- optionally provide the following environment variables
- do NOT define these variables when the application runs in a Docker container (especially Heroku that provides a unique
PORT
for every deploy)
USER_DIR=./public
HOST=127.0.0.1
PORT=8000
develop
build
- install
deno
(tested withv1.7.1
) - build client-side code (requires
yarn
) -- this can be skipped since the built files are included in the repo
cd client/
yarn install
yarn build
start
start the server with deno run
(use deno
without run
for deno
below v0.4.0)
cd server/
deno run --allow-env --allow-net --allow-read --allow-write --unstable server.ts
or yarn
cd server/
yarn start
https://github.com/arcatdmz/danoweb