Apollon Standalone is the Standalone version of the Apollon Editor
There are two variants how you can use this editor:
- As web application which only runs in the users environment (modeling functionality).
- With an application server which enables some extra features, like sharing of diagrams.
It consists of following features:
Users can use all the features of Standalone without the necessity of creating an account. All you have to do is go to the URL and start drawing.
The user interface of Apollon is simple to use. It works just like any other office and drawing tool that most users are familiar with.
- Select the diagram type you want to draw by clicking on the
File > New
menu. This selection determines the availability of elements that the user can use while drawing their diagram, making it easier for users who are newly introduced to modeling. - Adding the element is as easy as dragging it from the elements menu and dropping it to the canvas. So is drawing the connection between them, simply drag and connect two or multiple elements.
- The layout of the connection is drawn automatically by the editor. If you want to manually layout it, use the existing waypoints features.
- Edit or style the text or change the colors of any elements by double-clicking on them. An easy-to-use menu will allow you to do so.
- Use keyboard shortcuts to copy, paste, delete and move the elements throughout the canvas.
- Change the theme of the editor by clicking on the dark/light mode switch.
Users can easily import the existing Apollon diagram to any editor that uses the Apollon library and continue editing.
Exporting the diagrams is as easy as importing them.
Click on File > Export
and select the format of the diagram to be exported as.
Currently, Apollon standalone supports five different formats: SVG
, PNG (White Background)
, PNG (Transparent Background)
, JSON
, and PDF
.
Users in Apollon Standalone can also create a diagram from a template if they do not want to draw a diagram from scratch.
To do that, all they have to do is click on File > Start from Template
and select one of the templates from the list of available templates.
Users can share the diagram in Apollon Standalone in four different types.
Edit
: In this mode of sharing, the user will be able to make changes to the shared diagram.Collaborate
: In this mode of sharing, users joining the collaboration session will be able to work on the diagram collaboratively with other users.Embed
: In this mode of sharing, the user embeds the diagram in a Git issue/pull request. The embedding displays the latest version of the diagram.Give Feedback
: In this mode of sharing, the user will not be able to make changes to the shared diagram, but can only provide feedback to it.See Feedback
: In this mode of sharing, the user can view feedback provided to the shared diagram.
Apollon Standalone can be used as a collaborative modeling canvas, where multiple users can work collaboratively. Any changes made by one user will be visible throughout the canvas of all other users that are in collaboration sessions in real-time. Active elements that are interacted with by users in a session are highlighted in the canvas.
# clone the repository
git clone https://github.com/ls1intum/Apollon_standalone
# install the dependencies
npm install
# set environment variable
export APPLICATION_SERVER_VERSION=0
# build the web application
npm run build:webapp
# the output can be found in build/webapp directory of the project root
The application can be hosted by any http server which can serve static files, e.g. nginx or aws s3. Simply point your URL to the index.html of the web application (build/webapp/index.html) and the single page application will be loaded.
There are two variants to set this up:
- Manual on a linux vm
- In a docker container
Important
Please make sure if there is any requirements regarding additional dependencies to build the node canvas package for your operating system! You can find instructions for installing these dependencies here: https://github.com/Automattic/node-canvas#compiling
# clone the repository
git clone https://github.com/ls1intum/Apollon_standalone
# install the dependencies
npm install
# set environment variable
export APPLICATION_SERVER_VERSION=1
export DEPLOYMENT_URL=https://apollon.ase.in.tum.de
# build the web application and the application server
npm run build
# the output can be found in build/webapp and build/server directory of the project root
Add a user for the application:
sudo useradd -r -s /bin/false apollon_standalone
# give ownage of files to application user
chown -R apollon_standalone path/to/application
Make a directory for the shared diagrams to be stored
# create directory where shared diagrams of users are stored
mkdir path/to/diagrams
# give ownage to application user
chown apollon_standalone path/to/diagrams
Add the path to the created directory to:
- the cronjob in delete-stale-diagrams.cronjob.txt
- in packages/server/src/main/constants.ts
Configure the apollon_standalone.service file so that the paths match the paths to your installation folder
# After adjusting the service file, copy the service file apollon_standalone.service
# into the /etc/systemd/system directory service apollon_standalone start
cp apollon_standalone.service /etc/systemd/system/
# make sure the server.js file is executable by application user
cd path/to/application/build/server
chmod +x server.js
# Start the service
sudo service apollon_standalone start
# Status of the service
service apollon_standalone status
Error codes on server start:
- (code=exited, status=217/USER) -> apollon_standalone user does not exist
- (code=exited, status=203/USER) -> script not executable
Install the cronjob for deleting stale files
# create a log file for the cron job
touch /var/log/cron.log
chmod 622 /var/log/cron.log
# adjust period after which stale diagrams should be deleted
# cronjob file: delete-stale-diagrams.cronjob.txt
# default: delete stale diagrams after 12 weeks
# installs cronjob with application user
crontab -u apollon_standalone delete-stale-diagrams.cronjob.txt
Remove cronjob
crontab -r -u apollon_standalone
Caveat: cronjob to clean the diagrams after 12 weeks is currently not running in the container
# clone the repository
git clone https://github.com/ls1intum/Apollon_standalone
# build docker container
docker build -t apollon_standalone .
run docker container
docker run -d --name apollon_standalone -p 8080:8080 apollon_standalone
# build the web application and the application server
npm run build
# the output can be found in build/webapp and build/server directory of the project root
useful command to debug:
# start bash in running docker container to look at internal files
docker run -it --entrypoint /bin/bash apollon_standalone
Alternative to a filesystem, the application server can use a Redis database to store the shared diagrams.
To use Redis, set the environment variable APOLLON_REDIS_URL
to the URL of the Redis database.
Important
Apollon Standalone requires the Redis JSON module to be enabled. Read the documents to learn how to enable the JSON module.
APOLLON_REDIS_URL=redis://[[username]:[password]@][host][:port]
For example:
export APOLLON_REDIS_URL=redis://alice:foobared@awesome.redis.server:6380
You can also set the APOLLON_REDIS_URL
to an empty string, in which case localhost:6379
will be used as the default.
export APOLLON_REDIS_URL=""
You can also set APOLLON_REDIS_DIAGRAM_TTL
environment variable to set the time-to-live for the shared diagrams in Redis. If not provided, shared diagrams will be stored indefinitely. The specified duration is parsed using the ms package, so you can use human-readable strings like 1d
, 2h
, 30m
, etc.
export APOLLON_REDIS_DIAGRAM_TTL="30d"
Apollon Standalone, using Redis as its storage, can be deployed using Docker. To do that, follow these steps:
git clone https://github.com/ls1intum/Apollon_standalone.git
Note
You can skip this step for local deployment.
Add a .env
file in the root folder of the code. Add the following variables:
# The URL of the server, e.g. the address at which
# Apollon Standalone would be accessible after deployment.
DEPLOYMENT_URL=https://my.server/apollon/
# The duration for which shared diagrams will be stored
# (they will be removed afterwards)
APOLLON_REDIS_DIAGRAM_TTL=30d
docker compose up -d
Apollon Standalone will be running on localhost:8080
, using a private network bridge to connect to Redis, and storing shared images on a specific Docker volume.
# installs dependencies
npm install
# build application
npm run build:local
# create diagrams folder
mkdir diagrams
# start webpack dev server
npm start
# accessible via localhost:8888 (webpack dev server with proxy to application server)
# accesible via localhost:8080 (application server with static files)
npm install -g npm-check-updates
npm run update
While developing the Standalone project, it is often required to make changes in the Apollon project. This can be achieved by executing the following workflow.
- In the Apollon project: Generate a symlink by executing
npm link
command. - In the Standalone project: Link the generated symlink of Apollon (from step 1) by executing
npm link "@ls1intum/apollon"
command.
For more information please refer to the documentation of npm.
Note: While making changes in the Apollon project, for the changes to get reflected in Standalone, execute the following workflow:
- Recompile the Apollon project by executing
npm run prepare
- Rebuild the Standalone project by executing
npm run build
To use Redis in development, you can use the following commands:
docker run -p 6379:6379 -it redis/redis-stack-server:latest
This runs the Redis stack, which also includes the Redis JSON module. You can now instruct
Apollon Standalone to use Redis by setting the APOLLON_REDIS_URL
environment variable.
APOLLON_REDIS_URL="" npm start