buildDocker.sh

CONTAINER=drawio
IMAGE=jgraph/drawio

docker stop $CONTAINER
docker rm $CONTAINER
DIR=`pwd -P`

docker run --name $CONTAINER \
-e DRAWIO_SERVER_URL=https://drawio.jmehan.com/ \
-e DRAWIO_BASE_URL=https://drawio.jmehan.com \
-e DRAWIO_GOOGLE_APP_ID=<GOOGLE_APP_ID> \
-e DRAWIO_GOOGLE_CLIENT_ID=<GOOGLE_CLIENT_ID> \
-e DRAWIO_GOOGLE_CLIENT_SECRET=<GOOGLE_CLIENT_SECRET> \
--restart=always \
-p 9080:8080 -p 9443:8443 \
-d $IMAGE

docker logs -f $CONTAINER

Google Drive

You will need to create a project at Google API Console and create Credentials of type "Create OAuth client ID" -> Web Application. This option will be disabled until you create "OAuth consent screen" from the link in warning message bar. In the "OAuth consent screen" configuration, enter the "Application name" and "Authorized domains". In the "Create OAuth client ID" configuration, enter the required information and note that "Authorized redirect URIs" is [your-draw.io-hostname]/google. For example, if you host draw.io at https://drawio.example.com, then "Authorized redirect URIs" whould be https://drawio.example.com/google and "Authorized JavaScript origins" would be https://drawio.example.com.

Set the values of the generated "Client ID" and "Client secret" into environment variables DRAWIO_GOOGLE_CLIENT_ID and DRAWIO_GOOGLE_CLIENT_SECRET. Also, set DRAWIO_GOOGLE_APP_ID environment variable to your Google App ID. APP ID is the number before the dash in the CLIENT ID. For example, if CLIENT ID is 123456789-abc..., then APP ID is 123456789

If you want to host a draw.io viewer also, you can create another client ID for the viewer. Viewer has read-only access to Drive files.

Set the values of the generated "Client ID" and "Client secret" into environment variables DRAWIO_GOOGLE_VIEWER_CLIENT_IDand DRAWIO_GOOGLE_VIEWER_CLIENT_SECRET. Also, set DRAWIO_GOOGLE_VIEWER_APP_ID environment variable to your Google App ID.



References


  • No labels