Skip to content
Zdenek Kasner edited this page Nov 4, 2024 · 8 revisions

Setup

πŸ‘©β€πŸ”§ Installation

The recommended approach for installing factgenie is as an editable package:

  1. Make sure you have Python>=3.9 and pip.
  2. Clone the repository.
git clone https://github.com/ufal/factgenie
  1. Install factgenie as an editable Python package:
pip install -e .
  1. Start the local web server:
factgenie run --host=127.0.0.1 --port 8890
  1. Fire up the web interface: open http://127.0.0.1:8890 in your browser.

If everything worked as expected, you should be able to see the front page:

Main screen

🐍 Pip package

You can also install factgenie using:

pip install factgenie

This approach allows you to quickly try out factgenie functionalities.

However, note that this approach will not allow you to:

  • manually modify configuration files,
  • write your own data classes,
  • access generated files on your filesystem

(without accessing the folder of the installed package).

🚒 Using Docker

The Dockerfile included in the project will run factgenie using Python 3.10 exposing the app on port 80. You can run the server by executing

# Build the factgenie Docker image
docker build --tag 'factgenie' .
# Run the image in detached mode with in-container port 80 exposed as localhost:8080
docker run -p 8890:80 --detach 'factgenie'

You can then access the server by navigating to localhost:8080 in your browser.

The included docker-compose.yml file can be used to launch the server using docker compose up if you so desire. Simply drop docker-compose.yml one directory up from the root directory for the repository, navigate to that directory, and run the command. For example, if you haven't moved the file yet and you're in the root of the repo, you can run:

# Copy the folder one level up
cp docker-compose.yml ../.
# Navigate one level up
cd ..
# Run docker compose in detached mode
docker compose up -d

βš™οΈ Configuration file

The configuration of factgenie is stored in factgenie/config/config.yml. This file is loaded when factgenie is started.

Login

The login field contains the username and password needed for accessing the web interface. Having a password-protected app is necessary when running the human crowdsourcing campaign.

❗️ Make sure to change the default username and password before deploying the app.

You can disable the password protection if you do not plan to run a crowdsourcing campaign.

Host prefix

host_prefix contains a URL prefix that will be used by the frontend.

Most of the times, you can keep this value empty.

However, if your app is deployed behind a reverse proxy, you may need to manually set the subdirectory here.

Example: factgenie is deployed at https://public-server.com/demos/factgenie. In that case, you need to set the host_prefix to /demos/factgenie.

⚑️ Deployment

For deploying factgenie, you can use gunicorn:

gunicorn -b :8890 -w 1 --threads 8 factgenie.cli:create_app

If you are using nginx, we recommend you to set proxy_buffering to off (see this discussion) for the live updates to work.

Make sure you specify a sufficient number of threads (--threads) for servicing the web server and running the campaigns.

❗️ Do not use multiple Gunicorn workers: doing that may introduce race conditions and result in corrupted data.

Clone this wiki locally