Install and deploy
Fractal Server is the core ingredient of the Fractal framework, which includes several other Fractal components (e.g. a web client) and also relies on external resources being available (e.g. a PostgreSQL database and a SLURM cluster).
This page describes the basic procedure to setup and maintain a local fractal-server deployment, which is useful for testing and development, but a full-fledged deployment involves many more aspects. Some examples of deployment setups are available as container-based demos at https://github.com/fractal-analytics-platform/fractal-containers/tree/main/examples.
Prerequisites¶
The following will assume that:
- You are using a Python version greater or equal than 3.11
-
You are working within an isolated Python environment, for example a virtual environment created through
venvas inpython3 -m venv venv ./venv/bin/activate -
You have configured the required environment variables (see configuration page).
-
If you choose to declare the environment variables using the
.fractal_server.envfile, that file must be placed in the current working directory; -
You have access to a dedicated PostgreSQL database (see the database page).
-
A few common UNIX tools are available, including
du,find,cut,cat,wc,bash,ls,tar,sshandunzip.
Install¶
Fractal Server is hosted on PyPI, and can be installed with pip:
pip install fractal-server
Fractal Server is also available as a Conda package, but the PyPI version is the recommended one.
For details on how to install Fractal Server in a development environment see the Development page.
How to deploy¶
Installing fractal-server will automatically install fractalctl, its companion command-line utility that provides the basic commands for deploying Fractal Server.
Set up database schemas¶
Use the command
fractalctl set-db
POSTGRES_DB.
Note: the corresponding PostgreSQL database must already exist, since it won't be created by
fractalctl set-db. You can often create it directly throughcreatedb.
Initialize database data¶
With the command
fractalctl init-db-data
fractalctl init-db-data documentation), and it can optionally
- create the default user group (if
FRACTAL_DEFAULT_GROUP_NAME=All); - create the first admin user, by providing the
--admin-*flags; - create the first resource/profile pair and associate users to them, providing
--resourceand--profile.
Start fractal-server¶
Use the command
fractalctl start
To verify that the server is up, you can use the /api/alive/ endpoint - as in
curl http://localhost:8000/api/alive/
{"alive":true,"version":"2.17.0"}
Upgrade fractal-server¶
The high-level procedure for upgrading fractal-server on an existing instance is as follows:
- Stop the running
fractal-serverprocess. - Create a backup dump of the current database data (see database page).
- Review the CHANGELOG, and check whether this version upgrade requires any special procedure.
- Upgrade
fractal-server(e.g. as inpip install fractal-server==1.2.3). - Update the database schemas (as in
fractalctl set-db). - If the CHANGELOG requires it, run the data-migration command (
fractalctl update-db-data). Depending on the specific upgrade, this may require additional actions or information. - Restart the
fractal-serverprocess.