Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
523f1dc
Apply good ideas from #170
Neraste Dec 27, 2025
4d09e46
Create Docker configuration
Neraste Dec 28, 2025
c599a48
Better custom configuration management
Neraste Dec 30, 2025
1f2adf9
Harmonize log formats
Neraste Dec 30, 2025
338bd46
Manage APScheduler
Neraste Dec 30, 2025
61bc88f
Increase number of workers
Neraste Dec 30, 2025
6b7b956
Add Redis and docker-compose
Neraste Dec 30, 2025
2823dd1
Fixes for docker compose
Neraste Dec 30, 2025
9945c77
Secure execution order
Neraste Jan 3, 2026
9e131f1
Update documentation
Neraste Jan 3, 2026
a511a53
Put development Sqlite file in the project directory
Neraste Jan 3, 2026
e200980
Remove coverage by default
Neraste Jan 3, 2026
783df8e
Set working directory in deployment scritps
Neraste Jan 3, 2026
878c8f7
Remove Player migration scheme as it is not stored in the database
Neraste Jan 3, 2026
843c05a
Clean old jobs execution everyday
Neraste Jan 3, 2026
28d329b
Use environment variables for superuser creation
Neraste Jan 3, 2026
e9933f7
Add LOG_TO_CONSOLE configuration variable to production configuration
odrling Mar 8, 2026
71c7562
revert changes in development setup in previous commit
odrling Mar 8, 2026
8bcbf4e
Merge branch 'develop' into feature/docker
Neraste Apr 5, 2026
26db25f
Use multiple containers of one Docker image instead of supervisor
Neraste Apr 5, 2026
f35081d
Fix typo
Neraste Apr 5, 2026
ef49ad4
Separate sample config and actual config
Neraste Apr 6, 2026
152b987
Add config check version mechanism
Neraste Apr 6, 2026
901a660
Use dj_email_url
Neraste Apr 6, 2026
fd9dba4
Remove supervisor dependency
Neraste Apr 6, 2026
5581386
Update sample docker-compose
Neraste Apr 6, 2026
9c18ff3
Update docker-compose for logs
Neraste Apr 6, 2026
a43c88d
Simplify settings
Neraste Apr 6, 2026
23e5ee1
Fix style
Neraste Apr 6, 2026
9c0af00
Merge branch 'develop' into feature/docker
Neraste Apr 6, 2026
eb65be8
Allow to use custom front archive
Neraste Apr 6, 2026
02f396d
Improve docker-compose documentation and force to set superuser password
Neraste Apr 6, 2026
fc1df6a
Fix staticfiles problem
Neraste Apr 6, 2026
c9c0089
Fix CSRF problem
Neraste Apr 6, 2026
6a25ca7
Merge branch 'develop' into feature/docker
Neraste Apr 6, 2026
135c594
Improve docker-compose sample file
Neraste Apr 6, 2026
aad6e38
Fix coverage in CI
Neraste Apr 7, 2026
561e787
Fix serving of static files in dev operation
Neraste Apr 12, 2026
3d05e15
Simplify use of local front archive in Dockerfile
Neraste Apr 12, 2026
6518f3f
Rename scripts
Neraste Apr 12, 2026
fa31763
Document more settings in docker-compose file
Neraste Apr 12, 2026
4c632d8
Simplify use of local front archive
Neraste Apr 12, 2026
e14648e
Update dockerignore
Neraste Apr 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
*.pot

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Sphinx documentation
docs/_build/

# Database
*.sqlite3*

# Backups
*~

# Vim
*.sw[po]
*.vim

# Decouple config files
.env
settings.ini

# Template and static files
**/static

# Pyenv config
.python-version

/docker-compose.yaml

*_cache
.git
.github
.venv
venv

Dockerfile
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: pip install -r requirements.txt -r requirements_dev.txt

- name: Run tests
run: python -m pytest -v
run: python -m pytest -v --cov dakara_server

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ settings.ini

# Pyenv config
.python-version

/docker-compose.yaml
68 changes: 68 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
FROM alpine:3.23

# the front archive name must be in the format "dakara-client-web_<FRONT_VERSION>.zip"
# any front archive in the current build directory will be directly copied in
# the image, and will be used if the version number corresponds to the one
# requested below
# otherwise, the front archive will be downloaded
ARG FRONT_VERSION="1.9.2"

# optimizations for Python and pip
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

RUN apk add --no-cache \
nginx \
py3-pip \
python3 \
unzip \
wget

COPY requirements.txt requirements_prod.txt /app/

# install dependencies
RUN pip install \
--no-cache-dir \
--root-user-action ignore \
--break-system-packages \
-r /app/requirements.txt \
-r /app/requirements_prod.txt

COPY . /app

# get the front archive
RUN FRONT_ARCHIVE="dakara-client-web_$FRONT_VERSION.zip" && \
if [ -f "/app/$FRONT_ARCHIVE" ]; \
then \
echo "Using provided dev front archive" && \
mv "/app/$FRONT_ARCHIVE" "/tmp/$FRONT_ARCHIVE"; \
else \
echo "Downloading front archive v$FRONT_VERSION" && \
wget \
-P /tmp \
"https://github.com/DakaraProject/dakara-client-web/releases/download/$FRONT_VERSION/$FRONT_ARCHIVE"; \
fi && \
unzip \
"/tmp/$FRONT_ARCHIVE" \
-d /app && \
rm \
-f \
"/tmp/$FRONT_ARCHIVE" && \
find \
/app \
-name "dakara-client-web_*" \
-delete

COPY deployment/etc/nginx/nginx.conf /etc/nginx/nginx.conf

EXPOSE 80
VOLUME /data

# django settings
ENV DJANGO_SETTINGS_MODULE="dakara_server.settings.production"

# path
ENV PATH="$PATH:/app/deployment/bin"

WORKDIR /
104 changes: 97 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
# Dakara server

<!-- Badges are displayed for the develop branch -->
[![Python versions](https://img.shields.io/badge/python-3.10%20|%203.11%20|%203.12%20|%203.13-blue)](https://github.com/DakaraProject/dakara-server)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/DakaraProject/dakara-server?tab=MIT-1-ov-file#readme)
[![Tests status](https://github.com/DakaraProject/dakara-server/actions/workflows/ci.yml/badge.svg)](https://github.com/DakaraProject/dakara-server/actions/workflows/ci.yml)
[![Codecov coverage analysis](https://codecov.io/gh/DakaraProject/dakara-server/branch/develop/graph/badge.svg)](https://codecov.io/gh/DakaraProject/dakara-server)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)

Server for the Dakara project.

## Installation
## Local installation

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

* [Dakara web client](https://github.com/DakaraProject/dakara-client-web/);
* [Dakara player VLC](https://github.com/DakaraProject/dakara-player-vlc/);
* [Dakara feeder](https://github.com/DakaraProject/dakara-feeder).

### System requirements

* Python3, to make everything up and running (supported versions: 3.10, 3.11, 3.12, and 3.13).
* 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.

```sh
python -m virtualenv venv
source venv/bin/activate
```

### Dependencies

Having a recent enough versio of `pip` is required to install some dependencies properly:
Expand All @@ -41,7 +48,36 @@ Install dependencies, at the root level of the repo (in the virtual environment)
pip install -r requirements.txt
```

### Setting up the server
For production, you will need some extra dependencies:

```sh
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:


```sh
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:

Expand All @@ -65,17 +101,71 @@ You're almost done! To start the server app, in the right virtual environment, d
dakara_server/manage.py runserver
```

In a separate terminal, also run the scheduler.
This is currently only required for the kara date stop feature (which stops the karaoke at a certain date):

```sh
dakara_server/manage.py runapscheduler
```

The server part is now set up correctly.

### Web client, Feeder and player
### Web client, feeder and player

Now setup the [web client](https://github.com/DakaraProject/dakara-client-web), [feeder](https://github.com/DakaraProject/dakara-feeder) and [player](https://github.com/DakaraProject/dakara-player-vlc) 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 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 token can be obtained from the web interface.
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 takes care of all the aspects of the execution.

You can build the local Docker image with:

```sh
sudo docker build . -t dakara-server
```

Then, run the container with:

```sh
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_SECRET_KEY="your-secret-key" \
-e DAKARA_LANGUAGE_CODE="en-us" \
-e DAKARA_TIME_ZONE="UTC" \
-e DAKARA_LOG_LEVEL="INFO" \
-e DAKARA_EMAIL_ENABLED=<true or false> \
-e DAKARA_EMAIL_HOST="postfix" \
-e DAKARA_EMAIL_HOST_USER="user" \
-e DAKARA_EMAIL_HOST_PASSWORD="password" \
-e DAKARA_SENDER_EMAIL="no-reply@example.com" \
-p 80:80 \
dakara-server
```

A `docker-compose.yaml` file is given as an example in `deployment/docker-compose/docker-compose.yaml`.

```sh
cp deployment/docker-compose/docker-compose.yaml ./
# edit it as you like
sudo docker compose up -d
```

Then, use your browser to acces the web page:

```sh
xdg-open http://localhost
```

## Development

Please read the [developers documentation](CONTRIBUTING.md).
Loading
Loading