Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from fogninid fork #2

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c4e3741
add gitignore
fogninid Jul 21, 2019
65828df
add basic dependencies check
fogninid Jul 21, 2019
7322915
fix missing function return
fogninid Jul 23, 2019
d1b8d68
allow overriding configuration with environment variables
fogninid Jul 23, 2019
ebe0a4e
add dockerfile
fogninid Jul 23, 2019
f920131
fix typo
fogninid Jul 24, 2019
8948df7
run all ed_* apps with an nginx in the docker container
fogninid Jul 24, 2019
8f8ae75
add php availability
fogninid Jul 25, 2019
c85822b
remove unused resources
fogninid Jul 25, 2019
ba1316f
restructure repo folders
fogninid Jul 25, 2019
242e4ba
parse rc files and environment from php
fogninid Jul 25, 2019
bec5dc7
simplify logfiles
fogninid Jul 25, 2019
c0b99d1
add database schema
fogninid Jul 25, 2019
3349d24
fix rebase
fogninid Jul 25, 2019
a51abe6
move email scheme to the config
fogninid Jul 25, 2019
0389d1f
add more options to notify
fogninid Jul 26, 2019
12378e6
rename options to simplify env parsing
fogninid Jul 26, 2019
320a4d9
fix returning dangling reference due to auto hiding the copy
fogninid Jul 26, 2019
df08228
add small body margin
fogninid Jul 26, 2019
3c3bcd2
parametrize templates with config values
fogninid Jul 26, 2019
ff03abf
extend vmime exception logging as suggested by docu and examples
fogninid Jul 26, 2019
d973c9b
fix file ownerships
fogninid Jul 26, 2019
46619fd
configure utf8 in the DB instead of converting in the UI
fogninid Jul 26, 2019
7703b0d
set the name part in the from header of the emails
fogninid Jul 27, 2019
265e634
remove shift of the calendar period and extend dry run information
fogninid Jul 27, 2019
d78273d
move open/close dates to the db
fogninid Jul 27, 2019
4d3e845
render avail email using the deadline date from the db
fogninid Jul 27, 2019
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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/.git
/.*
Dockerfile
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*.o
*.lo
*.la
*.cppe

/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache/
/compile
/config.guess
/config.log
/config.status
/config.sub
/configure
/depcomp
/install-sh
/libtool
/ltmain.sh
/m4/
/missing
/src/.deps/
/src/.libs/
/src/Makefile
/src/Makefile.in
/src/ed_holidays
/src/ed_notify
/src/ed_presence
/src/ed_statistics
/src/ed_webapp
/src/notifier.he
58 changes: 58 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM debian:9.9 AS build

RUN apt-get update -y && apt-get install -y libboost-program-options-dev libboost-date-time-dev libwt-dev libcppdb-dev libtool autoconf-archive libvmime-dev libncurses5-dev automake g++ make

RUN mkdir /elpla
COPY elpla /elpla
WORKDIR /elpla

RUN ./autogen.sh && ./configure && make



FROM debian:9.9

RUN apt-get update -y && \
apt-get install -y \
libwt-common libcppdb-mysql0 libvmime0\
locales\
supervisor\
nginx-light\
php-fpm php-mysqli php-mbstring php-xml


RUN localedef -i de_DE -c -f UTF-8 -A /usr/share/locale/locale.alias de_DE.UTF-8
ENV LANG de_DE.utf8


RUN groupadd -r elpla && useradd --no-log-init -r -m -g elpla elpla
WORKDIR /home/elpla

COPY statics statics

RUN mkdir -p .elpla statics/resources/themes/bootstrap presence holidays statistics && chown -R elpla: .elpla *

COPY --chown=elpla configs/elpla/* .elpla/

RUN chmod 400 .elpla/elpla.rc

COPY --from=build /usr/share/Wt/resources statics/resources

COPY --from=build /elpla/src/ed_notify .
COPY --from=build /elpla/src/ed_holidays .
COPY --from=build /elpla/src/ed_presence .
COPY --from=build /elpla/src/ed_statistics .

COPY configs/php-fpm /etc/php/7.0/fpm/
RUN sed -e 's/^pid\s*=.*/;pid=none/' -i /etc/php/7.0/fpm/php-fpm.conf

COPY elpla/src/availability.php /var/www/availability.php

COPY configs/nginx/nginx.conf /etc/nginx/nginx.conf

EXPOSE 80


COPY configs/supervisord/supervisord.conf /etc/supervisord.conf

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
19 changes: 19 additions & 0 deletions configs/elpla/assign.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Liebe $Name_Mutter, lieber $Name_Vater,


der aktuelle Elterndienstplan ist unter folgendem Link zu finden:

$SystemUrl/?PW=$Passwort

Dazu noch einige Erklärungen:
- Verpflichtende Elterndienste sind in gelber Farbe gekennzeichnet.
- Elterndienste vormittags sind von 09:00 bis 13:00 Uhr zu leisten.
- Elterndienste nachmittags sind montags bis donnerstags von 15:00 bis 17:30 Uhr zu leisten, freitags von 15:00 bis 16:00 Uhr.
- Im Anhang sind Kalendereinträge für alle eure Termine. Ihr könnt eure bevorzugte Kalendar App dazu benutzen.
- Falls ihr einen Elterndienst oder eine Bereitschaft nicht wahrnehmen könnt, sucht euch bitte selbst einen Tauschpartner, anderenfalls müsst ihr die Kosten für eine Aushilfe übernehmen. Informiert uns über den Tausch, wir werden dann die Liste nachpflegen.
- Wir bemühen uns, Elterndienste und Bereitschaften möglichst gerecht zu verteilen. Wenn euch also im aktuellen Elterndienstplan auffällt, dass ihr besonders viel oder besonders wenig gefordert werdet, dann werft zum Vergleich einen Blick in die Elterndienstpläne der Vormonate.
- Die Möglichkeit, Verfügbarkeiten zu bearbeiten, ist mit der Veröffentlichung des Elterndienstplans für den kommenden Monat ab sofort gesperrt.

Viele Grüße,

$SystemMainteners
23 changes: 23 additions & 0 deletions configs/elpla/avail.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Liebe $Name_Mutter, lieber $Name_Vater,


bitte tragt eure Verfügbarkeit für Elterndienste im kommenden Monat bis $OpenedDeadline ein. Dazu steht euch folgender Link zur Verfügung:

$SystemUrl/?PW=$Passwort

Dazu noch einige Erklärungen:
- Um alle Vormittage gut abdecken zu können, bitte mindesten 2 Vormittage pro Monat Verfügbarkeit angeben.
- Urlaube sind mit grau markiert. Um neue Urlaube einzutragen bzw editieren, bitte benutzen den Link $SystemUrl/holidays?PW=$Passwort
- Es ist ein Kalender zu sehen, in dem Verfügbarkeiten in grün und Abwesenheiten in rot dargestellt werden.
- Dabei stellt das obere Feld an einem Tag den Vormittag, das untere Feld den Nachmittag dar.
- Ihr seht die Verfügbarkeit aller Eltern, könnt aber nur eure eigene editieren.
- Zum Editieren klickt ihr einfach auf das grüne bzw. rote Feld in eurer Spalte, dieses wird daraufhin seinen Status ändern.
- Ganz oben auf der Seite findet ihr die Möglichkeit, innerhalb der freigegebenen Monate zu navigieren.
- Damit könnt ihr euch jederzeit auch schon für die kommenden Monate (derzeit bis Dezember 2018) eintragen.
- In Monaten, die für die Angabe von Verfügbarkeiten geschlossen sind, findet ihr den fertigen Elterndienstplan.

Für Anregungen und Rückfragen stehen wir euch natürlich gerne zur Verfügung.

Viele Grüße,

$SystemMainteners
18 changes: 18 additions & 0 deletions configs/elpla/elpla.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[system]
url=https://example.com
mainteners=Elterndienst

[database.mysql]
host=localhost
user=elpla
password=elpla
database=elpla

[notify.mail]
availability.body=avail.msg
assignment.body=assign.msg

[email protected]
smtp.server=smtps://smtp.example.com:465
smtp.user=user
smtp.password=password
45 changes: 45 additions & 0 deletions configs/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
daemon off;
user elpla;

error_log /dev/fd/2 info;

events {
}

http {
log_format stdout '[$time_local] $status "$request"';
access_log /dev/fd/1 stdout;

server_tokens off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

upstream php-fpm {
server unix:/run/php7.0-fpm.sock;
}

server {
listen 80;

root /home/elpla/statics;

location /holidays {
proxy_pass http://127.0.0.1:8080;
}
location /presence {
proxy_pass http://127.0.0.1:8081;
}
location /statistics {
proxy_pass http://127.0.0.1:8082;
}
location = / {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/availability.php;
fastcgi_pass php-fpm;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_read_timeout 30;
}
}
}
2 changes: 2 additions & 0 deletions configs/php-fpm/conf.d/99-env.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[PHP]
variables_order = "EGPCS"
12 changes: 12 additions & 0 deletions configs/php-fpm/pool.d/www.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[www]
user = www-data
group = www-data
listen = /run/php7.0-fpm.sock
listen.owner = elpla
listen.group = elpla
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
clear_env = no
46 changes: 46 additions & 0 deletions configs/supervisord/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[supervisord]
nodaemon=true

[program:ed_holidays]
command=/home/elpla/ed_holidays --approot holidays --docroot statics --http-address 127.0.0.1 --http-port 8080 --deploy-path /holidays
environment=HOME="/home/elpla",USER="elpla"
user=elpla
directory=/home/elpla
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=true

[program:ed_presence]
command=/home/elpla/ed_presence --approot presence --docroot statics --http-address 127.0.0.1 --http-port 8081 --deploy-path /presence
environment=HOME="/home/elpla",USER="elpla"
user=elpla
directory=/home/elpla
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=true

[program:ed_statistics]
command=/home/elpla/ed_statistics --approot statistics --docroot statics --http-address 127.0.0.1 --http-port 8082 --deploy-path /statistics
environment=HOME="/home/elpla",USER="elpla"
user=elpla
directory=/home/elpla
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=true

[program:php-fpm]
command=php-fpm7.0 -FO -g /run/php-fpm.pid
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=true

[program:nginx]
command=nginx
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=true
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions configure.ac → elpla/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ LT_INIT
AC_SUBST(LIBTOOL_DEPS)
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11(noext)
AC_LANG([C++])

AC_CHECK_HEADERS([Wt/WApplication], [], [AC_MSG_ERROR([Couldn't find wt include files])])
AC_CHECK_HEADERS([cppdb/frontend.h], [], [AC_MSG_ERROR([Couldn't find cppdb include files])])
PKG_CHECK_MODULES(vmime, [vmime = 0.9.1])


AC_CONFIG_FILES(Makefile
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am → elpla/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ed_presence_SOURCES = ed_presence.cpp

ed_statistics_SOURCES = ed_statistics.cpp

libed_la_SOURCES = eltern.cpp parent_list.cpp ed_config.cpp notifier.cpp shift.cpp shift_list.cpp befreiung.cpp waiver_list.cpp closing_day.cpp closing_days.cpp
libed_la_SOURCES = eltern.cpp parent_list.cpp ed_config.cpp notifier.cpp shift.cpp shift_list.cpp befreiung.cpp waiver_list.cpp closing_day.cpp closing_days.cpp ed_state.cpp

ed_notify_LDFLAGS = -pthread
ed_notify_LDADD = -lcppdb -lboost_program_options -lboost_date_time -lncurses -lvmime -lgsasl -lgnutls -lgsasl $(LIBED)
Expand Down
Loading