Installation guide - WIP
We will using:
- A Ubuntu based distro
- Root access on the machine
- A domain
- Python 3.6
- nginx (you can use apache too)
1. Setting up the environement
Update your package list and system:
sudo apt update sudo apt upgrade
Older dristribution of ubuntu don't include python3.6 and we'll need it. Depending on your OS version you may need to install it.
Install the dev packages and necessary things for python to compile packages.
sudo apt install build-essential libssl-dev libffi-dev python3-dev
You'll need git and yarn to download and install dependencies.
sudo apt install git
To install yarn please read the instructions at their official webpage
redis-*- Used to queue tasks and as in-memory data store structure
imagemagick- Image related operations
ffmpeg- Conversion of videos to mp4
nodejs- Used for the streaming API
To install them use:
sudo apt install imagemagick ffmpeg nginx redis-server redis-tools postgresql postgresql-contrib python3-pip
Finally we'll need
pipenv a python utility to manage installed packages. To install
sudo pip3 install --user pipenv
If you don't have pipenv command use
sudo pip install -U pipenv
If you get the following error:
Traceback (most recent call last): File "/usr/bin/pip3", line 9, in <module> from pip import main ImportError: cannot import name 'main'
It's a known error
sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall
Set-up the project
Installing the core
First you need to clone the project. The
stable branch is master as others branchs contains changes that may break the instance.
git clone https://github.com/anforaProject/anfora.git
Once you have cloned the repository we need to install the dependencies
cd anfora pipenv install --python python3.6
This will create a virtual environement to work with python and automaticly it'll install all the packages needed.
Creating a settings file
Now we need to create the settings file (
An script to make easier this process will be included in future releases). To do this we need to create a
.yaml file with the necessary configuration:
Inside the folder
src/config you have two examples of configurations. You can create a new copy and just override the values.
cp src/config/dev.yaml src/config/my_config.yaml
Here you should pay attention to the http config and the storage config.
The media folder will contain all the media files and the
*_folder are subfolders with different objetives.
Once you have your configuration file ready we need to crate the settings file.
cd src pipenv run python commands.py -s --config config/my_config.yaml
This will change the configuration file at
Installing the web client
Now we need to add the web client. For this we will clone as follow
git clone https://github.com/anforaProject/client.git
Now we need to compile the client files. To do this just type
cd client yarn install yarn build
This will create a
dist folder that is the one needed by the core to render the html.
Creating the db
Anfora requires access to a PostgreSQL instance.
Create a user for a PostgreSQL instance:
su - postgres createuser -U postgres -s YOURUSERNAME exit
host all all 127.0.0.1/32 trust
We have changed
trust in the last column.
Note that we do not set up a password of any kind, this is because we will be using ident authentication. This allows local users to access the database without a password.
We'll need to sync the db. To do this just type
cd .. pipenv run python commands.py -d
Creating a new user
To create a user type
pipenv run python create_user.py
And follow the instructions
We need nginx to manage our conections with the world.
cd /etc/nginx/sites-available and then
nano anfora.conf (you can use your favorite editor).
Your configuration should be similar to:
Here you should change:
server_nameto match yours.
- Fix the paths in
- Change the certs in
We recomend certbot to manage your certs in production.
Save the changes and use
ln -s ../sites-available/anfora.conf
to create a symbolic link to the config file so nginx can read it.
Finally restart nginx using
sudo nginx -s reload.
The process that you need to start are:
- anfora server
- anfora node server
- huey consumer (tasks manager)
To continue I'll assume that you have an user called
anforaUser and that the root of the project is at
Start the redis server using
Start huey running:
cd src && pipenv run huey_consumer.py tasks.main.huey -m 1 -w 4
Start the server with
cd src && pipenv run python main.py