A mindmap type software
Go to file
2023-05-13 18:16:43 +02:00
persistence Added node weights for word cloud 2020-12-31 12:48:17 +01:00
.gitignore Added setup.py 2020-12-28 12:11:14 +01:00
COPYING Added COPYING 2020-12-20 01:34:01 +01:00
create_db.py Added create_db to seed database with first node 2020-12-29 15:54:49 +01:00
main.py Added node weights for word cloud 2020-12-31 12:48:17 +01:00
MANIFEST.in Added systemd config to README 2020-12-29 18:28:57 +01:00
README.md updates README 2023-05-13 18:16:43 +02:00
requirements.txt Added node weights for word cloud 2020-12-31 12:48:17 +01:00
setup.py Added node weights for word cloud 2020-12-31 12:48:17 +01:00
VERSION Added create_db to seed database with first node 2020-12-29 15:54:49 +01:00

Sphere backend

A mindmap type software

L'esfera has two parts.

The server. Written with the FastAPI python framework.
The frontend (this document). Written in Vuejs2 https://farga.exo.cat/buttle/sphere-frontend

Install the server

Get the source code

You can download a gzip'd tar file

cd /opt
wget https://farga.exo.cat/buttle/sphere-backend/archive/main.tar.gz
mkdir esfera-server
tar zxvf fastapi-server-master.tar.gz --strip-components=1 -C esfera-server

or clone the git repository

cd /opt
git clone https://farga.exo.cat/buttle/sphere-backend.git esfera-server

Install the source code

You may need to install

apt-get install python3-dev gcc make
cd /opt/esfera-server
python3 -m venv ./venv
source ./venv/bin/activate
pip install -e ./

Create the database

To seed the database you need to set the name of the first node manually.

What is the name of the first node? example: Our project

cd /opt/esfera-serve
source venv/bin/activate
python create_db.py "Our project"

Development

uvicorn main:app --reload --port 5050

Production

Test gunicorn

cd /opt/esfera-serve
source venv/bin/activate
gunicorn --bind 127.0.0.1:5050 -w 4 -k uvicorn.workers.UvicornWorker main:app

Create a service

Create a user esfera to run the esfera app

adduser --shell=/bin/false --no-create-home --disabled-password esfera
chown -R esfera.esfera /opt/esfera-server

Create and edit /etc/systemd/system/esfera.service

[Unit]
Description = L'esfera
After = network.target

[Service]
PermissionsStartOnly = true
PIDFile = /run/esfera/esfera.pid
User = esfera
Group = esfera
WorkingDirectory = /opt/esfera-server
ExecStartPre = /bin/mkdir /run/esfera
ExecStartPre = /bin/chown -R esfera:esfera /run/esfera
ExecStart = /opt/esfera-server/venv/bin/gunicorn main:app -b 127.0.0.1:5050  -w 4 -k uvicorn.workers.UvicornWorker --pid /run/esfera/esfera.pid
ExecReload = /bin/kill -s HUP $MAINPID
ExecStop = /bin/kill -s TERM $MAINPID
ExecStopPost = /bin/rm -rf /run/esfera
PrivateTmp = true

[Install]
WantedBy = multi-user.target
chmod 755 /etc/systemd/system/esfera.service
systemctl daemon-reload

Backups

L'esfera uses SQLite. The database is contained in one single file.

To backup the database, copy the file esfera.db to somewhere safe.