FastAPI implementation of the libreForms spec
Follow the steps below to install the system on your computer. Please note, you need to install Python3.10 (or higher) and Python3.10-Venv through your package manager. If you plan to use MongoDB and a relational database, you will need to install these, too. See your distribution's specific instructions for these steps or install using Docker to get started.
git clone https://github.com/signebedi/libreforms-fastapi.git
cd libreforms-fastapi
python3 -m venv venv
source venv/bin/activate
pip install -e .
uvicorn libreforms_fastapi.app:app --reload # this will run the development server
To run in production, you need to generate an app configuration and daemonize uvicorn. If this sounds too daunting, consider running the Docker container. If you're not dissuaded, you can use the CLI. After pip installing the package, you can use the libreformsctl
command to get the application running in production. Here's an example:
libreformsctl config production
libreformsctl uvicorn --environment production
libreformsctl nginx production # Optional if you want a reverse proxy
You may sometimes run into inexplicable runtime errors. These often result from permission issues on the filesystem. When in doubt, try running the following command as root.
chown -R fastapi:fastapi /opt/libreforms_fastapi
Follow the instructions below to run in docker. Creating a custom volume is optional but will give you control over the application configurations and, in the event you are using TinyDB and SQLite, you will also be able to access the database files.
git clone https://github.com/signebedi/libreforms-fastapi.git
cd libreforms-fastapi/
sudo docker build -t libreforms-fastapi . # Please note this can take several minutes
sudo docker volume create libreforms-volume # Create a volume for the instance directory
sudo docker run -d --name libreforms-instance -v libreforms-volume:/app/instance -p 8000:8000 libreforms-fastapi
You can create an admin account by running the following commands, being careful to replace <environment>
with the appropriate environment (when in doubt, use development
). Follow the instructions from the interface that pops up.
sudo docker exec -it libreforms-instance libreformsctl useradd --environment <environment> --site-admin
To stop your instance, you can run the following command.
docker kill libreforms-instance