mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-13 05:02:20 +01:00
Compare commits
3 Commits
ffb7c02bc8
...
marietje-z
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f698315dc | |||
| 4bc3f38f69 | |||
| 6d545dddcc |
@ -1,4 +0,0 @@
|
|||||||
marietje/db.sqlite3
|
|
||||||
marietje/static
|
|
||||||
docker-compose.yml.example
|
|
||||||
docker-compose.yml
|
|
||||||
26
Dockerfile
26
Dockerfile
@ -1,26 +0,0 @@
|
|||||||
FROM python:3.11
|
|
||||||
MAINTAINER Tartarus Technicie
|
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
|
||||||
ENV DJANGO_SETTINGS_MODULE marietje.settings.production
|
|
||||||
ENV PATH /root/.poetry/bin:${PATH}
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
||||||
|
|
||||||
WORKDIR /marietje/src
|
|
||||||
COPY resources/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
||||||
COPY poetry.lock pyproject.toml /marietje/src/
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
mkdir --parents /marietje/src/ && \
|
|
||||||
mkdir --parents /marietje/log/ && \
|
|
||||||
mkdir --parents /marietje/static/ && \
|
|
||||||
chmod +x /usr/local/bin/entrypoint.sh && \
|
|
||||||
\
|
|
||||||
curl -sSL https://install.python-poetry.org | python3 - && \
|
|
||||||
export PATH="/root/.local/bin:$PATH" && \
|
|
||||||
poetry config --no-interaction --no-ansi virtualenvs.create false && \
|
|
||||||
poetry install --no-interaction --no-ansi --no-dev
|
|
||||||
|
|
||||||
|
|
||||||
COPY marietje /marietje/src/website/
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
services:
|
|
||||||
reverse-proxy:
|
|
||||||
container_name: 'marietje-reverse-proxy'
|
|
||||||
image: nginx:latest
|
|
||||||
restart: 'always'
|
|
||||||
depends_on:
|
|
||||||
- backend
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
||||||
volumes:
|
|
||||||
- ./data/shared/media/:/marietje/media/
|
|
||||||
- ./data/shared/static/:/marietje/static/
|
|
||||||
- ./data/reverse-proxy/conf.d/:/etc/nginx/conf.d/
|
|
||||||
- ./data/reverse-proxy/nginx.conf:/etc/nginx/nginx.conf
|
|
||||||
networks:
|
|
||||||
- marietje-network
|
|
||||||
|
|
||||||
backend:
|
|
||||||
build: "."
|
|
||||||
restart: 'always'
|
|
||||||
container_name: 'marietje-backend'
|
|
||||||
volumes:
|
|
||||||
- ./data/shared/static/:/marietje/src/website/static/
|
|
||||||
- ./data/shared/media/:/marietje/src/website/media/
|
|
||||||
- ./data/backend/log/:/marietje/log/
|
|
||||||
environment:
|
|
||||||
DJANGO_SECRET_KEY: '[Django Secret key]'
|
|
||||||
VIRTUAL_HOST: '[Marietje hostname]'
|
|
||||||
VIRTUAL_PROTO: 'uwsgi'
|
|
||||||
DJANGO_ALLOWED_HOST: 'marietje-zuid.nl'
|
|
||||||
DJANGO_MYSQL_NAME: 'marietje'
|
|
||||||
DJANGO_MYSQL_USER: 'marietje'
|
|
||||||
DJANGO_MYSQL_PASSWORD: '[Marietje zuid database password]'
|
|
||||||
DJANGO_MYSQL_HOST: 'localhost'
|
|
||||||
DJANGO_MYSQL_PORT: '3306'
|
|
||||||
DJANGO_BERTHA_HOST: 'bach.science.ru.nl'
|
|
||||||
DJANGO_BERTHA_PORT: '1234'
|
|
||||||
networks:
|
|
||||||
- marietje-network
|
|
||||||
|
|
||||||
networks:
|
|
||||||
marietje-network:
|
|
||||||
driver: bridge
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
from .base import *
|
|
||||||
|
|
||||||
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY")
|
|
||||||
|
|
||||||
DEBUG = False
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = [os.environ.get("DJANGO_ALLOWED_HOST")]
|
|
||||||
|
|
||||||
SESSION_COOKIE_SECURE = True
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
|
||||||
'NAME': os.environ.get("DJANGO_MYSQL_NAME"),
|
|
||||||
'USER': os.environ.get("DJANGO_MYSQL_USER"),
|
|
||||||
'PASSWORD': os.environ.get("DJANGO_MYSQL_PASSWORD"),
|
|
||||||
'HOST': os.environ.get("DJANGO_MYSQL_HOST"),
|
|
||||||
'PORT': os.environ.get("DJANGO_MYSQL_PORT"),
|
|
||||||
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Logging
|
|
||||||
# https://docs.djangoproject.com/en/3.2/topics/logging/
|
|
||||||
|
|
||||||
LOGGING = {
|
|
||||||
"version": 1,
|
|
||||||
"disable_existing_loggers": False,
|
|
||||||
"handlers": {
|
|
||||||
"file": {
|
|
||||||
"level": "INFO",
|
|
||||||
"class": "logging.FileHandler",
|
|
||||||
"filename": "/marietje/log/django.log",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"loggers": {
|
|
||||||
"": {
|
|
||||||
"handlers": ["file"],
|
|
||||||
"level": "DEBUG",
|
|
||||||
"propagate": True,
|
|
||||||
}, # noqa
|
|
||||||
}, # noqa
|
|
||||||
}
|
|
||||||
|
|
||||||
BASE_URL = 'https://marietje-zuid.science.ru.nl'
|
|
||||||
|
|
||||||
BERTHA_HOST = (os.environ.get("DJANGO_BERTHA_HOST"), os.environ.get("DJANGO_BERTHA_PORT"))
|
|
||||||
23
marietje/marietje/settings/production.py.example
Normal file
23
marietje/marietje/settings/production.py.example
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
from .base import *
|
||||||
|
|
||||||
|
SECRET_KEY = '******'
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = ['marietje-zuid.nl']
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
'NAME': 'marietje',
|
||||||
|
'USER': 'marietje',
|
||||||
|
'PASSWORD': '******',
|
||||||
|
'HOST': 'localhost',
|
||||||
|
'PORT': '3306',
|
||||||
|
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_URL = 'https://marietje-zuid.science.ru.nl'
|
||||||
|
|
||||||
|
BERTHA_HOST = ('bach.science.ru.nl', 1234)
|
||||||
@ -117,6 +117,11 @@ footer {
|
|||||||
color: red !important;
|
color: red !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
/* Bootstrap 3 doesn't support equal height columns, hack via <https://medium.com/wdstack/bootstrap-equal-height-columns-d07bc934eb27#892f> */
|
/* Bootstrap 3 doesn't support equal height columns, hack via <https://medium.com/wdstack/bootstrap-equal-height-columns-d07bc934eb27#892f> */
|
||||||
.row.display-flex {
|
.row.display-flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -221,7 +221,7 @@
|
|||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
<template v-for="(song, index) in songs">
|
<template v-for="(song, index) in songs">
|
||||||
<tr>
|
<tr v-bind:class="{disabled: is_in_queue(song)}">
|
||||||
<td>
|
<td>
|
||||||
${ song.artist }$
|
${ song.artist }$
|
||||||
</td>
|
</td>
|
||||||
@ -240,7 +240,7 @@
|
|||||||
${ song.duration.secondsToMMSS() }$
|
${ song.duration.secondsToMMSS() }$
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button v-on:click="report_song(song.id);" class="btn btn-link p-0">
|
<button v-on:click="report_song(song.id);" class="btn btn-link p-0" style="pointer-events: auto">
|
||||||
⚑
|
⚑
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@ -585,6 +585,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
is_in_queue(song) {
|
||||||
|
return queue_vue.queue.filter(queuesong => Boolean(queuesong.user)
|
||||||
|
).map((queuesong) => queuesong.song.hash).includes(song.hash);
|
||||||
|
},
|
||||||
|
|
||||||
request_song(song_id) {
|
request_song(song_id) {
|
||||||
fetch('/api/v1/queues/current/request/', {
|
fetch('/api/v1/queues/current/request/', {
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
touch -a /marietje/log/uwsgi.log
|
|
||||||
touch -a /marietje/log/django.log
|
|
||||||
|
|
||||||
cd /marietje/src/website
|
|
||||||
|
|
||||||
./manage.py migrate --no-input
|
|
||||||
./manage.py collectstatic --no-input
|
|
||||||
|
|
||||||
chown --recursive www-data:www-data /marietje/
|
|
||||||
|
|
||||||
echo "Starting uwsgi server."
|
|
||||||
uwsgi --chdir=/marietje/src/website \
|
|
||||||
--module=marietje.wsgi:application \
|
|
||||||
--master --pidfile=/tmp/project-master.pid \
|
|
||||||
--socket=:8000 \
|
|
||||||
--processes=5 \
|
|
||||||
--uid=www-data --gid=www-data \
|
|
||||||
--harakiri=20 \
|
|
||||||
--post-buffering=16384 \
|
|
||||||
--max-requests=5000 \
|
|
||||||
--thunder-lock \
|
|
||||||
--vacuum \
|
|
||||||
--logfile-chown \
|
|
||||||
--logto2=/marietje/log/uwsgi.log \
|
|
||||||
--ignore-sigpipe \
|
|
||||||
--ignore-write-errors \
|
|
||||||
--disable-write-exception
|
|
||||||
Reference in New Issue
Block a user