Server for the Dakara project.
To install Dakara completely, you have to get all the parts of the project. Installation guidelines are provided here:
- Dakara web client (you may not require it, see below);
- Dakara player VLC;
- Dakara feeder.
Repository of the server is here:
- Python3, to make everything up and running (supported versions: see above).
Linux, Mac and Windows are supported.
It is strongly recommended to run the Dakara server in a virtual environment.
python -m virtualenv venv
source venv/bin/activateHaving a recent enough versio of pip is required to install some dependencies properly:
pip install --upgrade pipInstall dependencies, at the root level of the repo (in the virtual environment):
pip install -r requirements.txtFor production, you will need some extra dependencies:
pip install -r requirements_prod.txtThe project provides settings presets:
- "development": for development purpose only. Uses a SQLite database, has debug mode enabled, an in-terminal pseudo mail backend, and security features turned off. Do not use this preset for production!
- "test": for test purpose only. Uses an in-memory SQLite database, and has security features turned off. Do not use this preset for production!
- "production": for use in the provided Docker image.
By default, the development preset is used.
You can create your own settings preset by duplicating the production file.
To select a preset, set the DJANGO_SETTINGS_MODULE environment variable accordingly, by instance for production:
export DJANGO_SETTINGS_MODULE="dakara_server.settings.production"Running the server in development requires some preliminary steps.
Let's create the server database, after loading the virtual environment, do:
dakara_server/manage.py migrateYou should be asked to create a super user. Do it. Otherwise:
dakara_server/manage.py createsuperuserYou're almost done! To start the server app, in the right virtual environment, do:
dakara_server/manage.py runserverIn a separate terminal, also run the scheduler. This is currently only required for the kara stop time feature (which stops the karaoke at a certain time):
dakara_server/manage.py runapschedulerThe server part is now set up correctly.
Now setup the web client, feeder and player according to their respective documentations. The feeder can authenticate to the server using a token or a couple login/password of a playlist manager account. The player can authenticate using a special token that only a playlist manager can generate. Both tokens can be obtained from the web interface.
After all of this is setup, just grab some friends and have fun!
For production, it is recommended to use the provided Docker image, which provides an execution environment: Gunicorn for serving the API, Daphne for serving the Websockets, and Nginx for serving static files and doing the routing. Note that neither a database server, nor a cache server are included in the image, however! You should consider Docker compose to have those services included (see below).
You can pull the image from Docker hub:
docker pull dakaraproject/dakaraserver:latestAlternatively, you can also build the image locally with:
sudo docker build . -t dakaraproject/dakaraserver:latestRun the container with:
sudo docker run \
-d \
-v path/to/persistent/data:/data \
-e DAKARA_DATABASE_URL="mysql://user:password@mysql/dakara" \
-e DAKARA_REDIS_URL="redis://redis:6379" \
-e DAKARA_ALLOWED_HOSTS="localhost,example.com" \
-e DAKARA_HOST_URL="http://example.com" \
-e DAKARA_CSRF_TRUSTED_ORIGINS: "http://example.com" \
-e DAKARA_SECRET_KEY="your-secret-key" \
-e DAKARA_SUPERUSER_PASSWORD: "admin-password" \
-e DAKARA_EMAIL_ENABLED=<true or false> \
-e DAKARA_EMAIL_URL="smtp://user:password@postfix:25" \
-e DAKARA_SENDER_EMAIL="no-reply@example.com" \
-e DAKARA_LOG_TO_CONSOLE: false \
-p 80:80 \
dakaraproject/dakaraserver \
<command>with <command> being either run_websocket_daphne.sh, run_api_gunicorn.sh, run_scheduler_apscheduler.sh, or run_web_nginx.sh (for which only -p 80:80 should be passed).
You need to have all of them running to have a workable instance of the server.
Running the container for the different services manually like this should be reserved for debugging or testing.
For production, it is advised to use Docker compose.
Docker compose is the preffered way to run an instance of the server, especially for production, not only with Dakara server and front, but also with a database server and a cache server.
A sample docker-compose.yaml file, using MariaDB and Redis, is given in deployment/docker-compose/docker-compose.yaml.
cp deployment/docker-compose/docker-compose.yaml ./
# edit it as you like
# then start it
sudo docker compose up -dFinally, use your browser to acces the web client:
xdg-open http://localhostGrab some friends again and have fun!
Please read the developers documentation.