Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,203 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dakara server

Docker Image Version Docker Image Size Python versions License Tests status Codecov coverage analysis Code style: black Imports: isort

Server for the Dakara project.

Local installation

To install Dakara completely, you have to get all the parts of the project. Installation guidelines are provided here:

Repository of the server is here:

System requirements

  • Python3, to make everything up and running (supported versions: see above).

Linux, Mac and Windows are supported.

Virtual environment

It is strongly recommended to run the Dakara server in a virtual environment.

python -m virtualenv venv
source venv/bin/activate

Dependencies

Having a recent enough versio of pip is required to install some dependencies properly:

pip install --upgrade pip

Install dependencies, at the root level of the repo (in the virtual environment):

pip install -r requirements.txt

For production, you will need some extra dependencies:

pip install -r requirements_prod.txt

Setup

Settings presets

The 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"

Preparation of the server

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 migrate

You should be asked to create a super user. Do it. Otherwise:

dakara_server/manage.py createsuperuser

Start the server

You're almost done! To start the server app, in the right virtual environment, do:

dakara_server/manage.py runserver

In 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 runapscheduler

The server part is now set up correctly.

Web client, feeder and player

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!

Docker image

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).

How to get it

You can pull the image from Docker hub:

docker pull dakaraproject/dakaraserver:latest

Alternatively, you can also build the image locally with:

sudo docker build . -t dakaraproject/dakaraserver:latest

Run manually

Run 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.

Run with 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 -d

Finally, use your browser to acces the web client:

xdg-open http://localhost

Grab some friends again and have fun!

Development

Please read the developers documentation.

About

Server for the Dakara Project

Resources

Contributing

Stars

8 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages