31 Commits
1.0.0 ... 1.0.1

Author SHA1 Message Date
4dfdc644ea Merge branch 'release/1.0.1' 2019-02-28 14:04:22 +01:00
769b80f812 Set Version to 1.0.1 2019-02-28 14:03:54 +01:00
acc58c0a2b #1 Fix calculation daily sum 2019-02-28 13:52:39 +01:00
e4e83a188c Merge branch 'master' into develop 2019-02-25 15:54:22 +01:00
55b50f302c add favicon 2019-02-25 15:52:58 +01:00
df5b99ed56 Update INSTALL.md 2019-02-25 10:04:56 +01:00
e043067b39 Update INSTALL.md 2019-02-25 10:01:06 +01:00
f58c238ef6 Update INSTALL.md 2019-02-25 09:47:52 +01:00
64eb0eb64e Update INSTALL.md 2019-02-25 09:34:15 +01:00
bb736468db Update INSTALL.md 2019-02-25 09:22:26 +01:00
Dennis Reinwald
46fc815479 Update INSTALL.md 2019-02-25 09:21:32 +01:00
a2968f3e47 Update INSTALL.md 2019-02-25 09:21:04 +01:00
2d6574807f Update INSTALL.md 2019-02-25 09:19:43 +01:00
Dennis Reinwald
9f2ef3c556 Update INSTALL.md 2019-02-23 23:25:46 +01:00
Dennis Reinwald
600c23c9a4 Update INSTALL.md 2019-02-23 23:21:44 +01:00
Dennis Reinwald
b4319bba5f Update INSTALL.md 2019-02-23 23:07:41 +01:00
Dennis Reinwald
56143c3436 Update INSTALL.md 2019-02-23 23:02:25 +01:00
Dennis Reinwald
80445ef2c2 Update INSTALL.md 2019-02-23 22:58:52 +01:00
Dennis Reinwald
b4d28a6f97 Update INSTALL.md 2019-02-23 22:46:08 +01:00
351ec5a090 Update INSTALL.md 2019-02-20 18:12:53 +01:00
d976d6b653 update installation instruction 2019-02-20 08:12:15 +01:00
0239368e69 Update INSTALL.md 2019-02-19 16:00:34 +01:00
fcf37fe0b3 Update INSTALL.md 2019-02-19 15:58:25 +01:00
94cc7787c9 update Install docu 2019-02-19 14:28:42 +01:00
34a4a0b9aa Update INSTALL.md 2019-02-19 14:22:59 +01:00
4e66551ac9 Update INSTALL.md 2019-02-19 14:20:18 +01:00
506d97ba5a Update INSTALL.md 2019-02-19 14:19:36 +01:00
40aa6efdcf Update INSTALL.md 2019-02-19 14:18:06 +01:00
303027434d Add installation information 2019-02-19 14:16:04 +01:00
d13bd0adb6 set version to 1.0.1-dev 2019-02-15 18:10:13 +01:00
3c1397a348 Merge tag '1.0.0' into develop
Tag as Version 1.0.0
2019-02-15 18:09:50 +01:00
5 changed files with 211 additions and 4 deletions

200
INSTALL.md Normal file
View File

@@ -0,0 +1,200 @@
# Preparing
- [ ] Install and configure Mailsystem (postfix) so it is possible to send mails
- [ ] Install python ```apt install python3 python3-pip python3-venv python3-virtualenv```
- [ ] Install uwsgi ```apt install uwsgi uwsgi-plugin-python3```
- [ ] Install and configure mariadb-server ```mysql_secure_installation```
- [ ] Install and configure nginx und let's encrypt or similar
- [ ] Install git ```apt install git```
# Installation
- [ ] Create databases for carom and carom-int
```
-- carom
CREATE DATABASE carom DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'carom'@'localhost' IDENTIFIED BY 'xxx';
GRANT ALL PRIVILEGES ON carom.* TO 'carom'@'localhost';
CREATE DATABASE `carom-int` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'carom-int'@'localhost' IDENTIFIED BY 'xxx';
GRANT ALL PRIVILEGES ON `carom-int`.* TO 'carom-int'@'localhost';
FLUSH PRIVILEGES;
```
Passphrases should be replaced by useful characters
- [ ] Create systemd unit file for uwsgi (/etc/systemd/system/uwsgi.service):
```
[Unit]
Description=uWSGI Emperor service
[Service]
ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown www-data:www-data /run/uwsgi'
ExecStart=/usr/bin/uwsgi --emperor /etc/uwsgi/apps-enabled
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all
[Install]
WantedBy=multi-user.target
```
- [ ] Reread systemd configs for uwsgi
```
systemctl daemon-reload
systemctl enable uwsgi.service
systemctl restart uwsgi.service
```
- [ ] Checkout carom
```
cd /srv
git clone http://git.einsle.de/carom/carom-server.git carom
git clone http://git.einsle.de/carom/carom-server.git carom-int
cd carom-int
git checkout develop
git pull
cd ..
```
- [ ] Install pipenv
```
pip3 install upgrade pipenv
```
- [ ] Install mysqlclient
```
apt install libmariadbclient-dev
```
In environments carom run
```
pipenv install mysqlclient
```
```
git checkout -- Pipfile Pipfile.lock
git status
```
- [ ] Create caromserver/local_settings.py for both environments:
```
cd caromserver
cp local_settings_example.py local_settings.py
vi local_settings.py
ALLOWED_HOSTS, ADMINS, DEBUG should be filled
SECRET_KEY use pwgen 50 1 to create content for
DATABASES settings
cd ..
mkdir .venv
pipenv install
pipenv run python manage.py migrate
pipenv run python manage.py collectstatic
```
Do it for /srv/carom and /srv/carom-int
- [ ] Create Superuser Accounts using:
```
pipenv run python manage.py createsuperuser
```
- [ ] Create config File for uwsgi/carom
```
# carom...ini file
[uwsgi]
plugin = python3
chdir = /srv/carom/
module = caromserver.wsgi:application
home = /srv/carom/.venv/
master = true
processes = 5
vacuum = true
uid = www-data
gid = www-data
workers = 2
socket = /run/uwsgi/carom.socket
chmod-socket = 660
log-date = true
```
Create it for /etc/uwsgi/apps-available/carom.ini and carom-int.ini and link it
to /etc/uwsgi/apps-enabled/
```
systemctl restart uwsgi.service
```
Show at syslog for errors and fix it.
- [ ] Create Config File for nginx/carom
```
upstream socket_carom {
server unix:///run/uwsgi/carom.socket;
}
server {
listen 80;
listen [::]:80;
server_name carom...;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name carom...;
ssl_certificate /etc/ssl/certs/xxx;
ssl_certificate_key /etc/ssl/private/xxx;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
charset utf-8;
client_max_body_size 75M; # adjust to taste
location /media {
alias /srv/carom/media;
}
location /static {
alias /srv/carom/staticfiles;
}
location / {
uwsgi_pass socket_carom;
include /etc/nginx/uwsgi_params;
}
}
```
Create it for /etc/ngin/sites-available/carom... and carom-int... and link it
to /etc/ngin/sites-enabled/
Path to certificates must be modified.
```
systemctl restart nginx
```
- [ ] Create update.sh in carom and carom-int root dir
```
pushd /srv/carom/
git pull
pipenv update
pipenv run python manage.py migrate
pipenv run python manage.py collectstatic --noinput
touch /etc/uwsgi/apps-enabled/carom.ini
popd
```
Path to uwsgi config file (in apps-enabled) musst be matching.

View File

@@ -1,4 +1,4 @@
from datetime import datetime, timedelta
from datetime import datetime, timedelta, date
from django import template
from django.db.models import Sum
@@ -10,8 +10,14 @@ register = template.Library()
@register.filter(is_safe=True)
def display_daily_sale(location):
start_date = datetime.now().replace(hour=5, minute=0, second=0, microsecond=0)
end_date = start_date + timedelta(days=1)
date = datetime.now().replace(hour=6, minute=0, second=0, microsecond=0)
now = datetime.now()
if now < date:
start_date = date - timedelta(days=1)
end_date = date
else:
start_date = date
end_date = date + timedelta(days=1)
prize__sum = Accounting.objects.filter(desk__client__location=location,
time_to__range=(start_date, end_date)).aggregate(Sum('prize'))
if prize__sum['prize__sum'] is None:

View File

@@ -163,7 +163,7 @@ EMAIL_PORT = 25
URL_LOCATION_PROCESSOR = 'http://127.0.0.1:8000/billard/process_locationdata'
PRODUCT_INFO = 'CAROM-DEV'
PRODUCT_VERSION = 'v 1.0.0'
PRODUCT_VERSION = 'v 1.0.1'
INTERNAL_IPS = ['127.0.0.1']

BIN
static/img/billiard.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -8,6 +8,7 @@
<meta name="description" content="carom billard management">
<meta name="author" content="Robert Einsle <robert@einsle.de>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" type="image/x-icon" href="{% static 'img/billiard.ico' %}">
{% block header %}
{% endblock %}
<!-- Bootstrap -->