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

Wie aufsetzen? #5

Open
niccokunzmann opened this issue Sep 17, 2019 · 1 comment
Open

Wie aufsetzen? #5

niccokunzmann opened this issue Sep 17, 2019 · 1 comment

Comments

@niccokunzmann
Copy link
Member

Es gibt hier nur Scripts und keine README. Wenn ich das verbessern möchte, hätte ich gerne eine kleine Beschreibung, wie ich das aufsetze. Das macht es mir dann leichter.

niccokunzmann added a commit to Freifunk-Wolfen/ffp-monitor that referenced this issue Sep 17, 2019
@seth0r
Copy link
Member

seth0r commented Oct 1, 2019

Die scripte werden via mod_wsgi beim apache eingebunden, hier unsere configs:

HTTP:

<VirtualHost *:80>
    ServerName monitor.freifunk-potsdam.de

    ServerAdmin [email protected]

    KeepAlive Off
    SSLProxyEngine On


    RewriteEngine on
    RewriteRule "^/\.well-known/acme-challenge/.*" "-" [END]
    RewriteRule "^/fff" "/ff/feed" [PT]
    RewriteRule "^/ffp-collect" "https://monitor.freifunk-potsdam.de/ffp-collect" [P]
    RewriteRule "^/ff/feed" "-" [S=1]
    RewriteRule "(.*)" "https://%{HTTP_HOST}%{REQUEST_URI}" [R=303,L]

    Alias /.well-known/acme-challenge/ /var/www/acme-challenges/

    <Directory /var/www/acme-challenges/> 
        AllowOverride None 
        Require all granted 
    </Directory>

    RewriteEngine On

    WSGIDaemonProcess fffeed python-path=/var/www/monitor.freifunk-potsdam.de/wsgi/ff threads=64 processes=1

    WSGIScriptAlias /ff /var/www/monitor.freifunk-potsdam.de/wsgi/ff/fffeed.wsgi
    <Location /ff>
            WSGIProcessGroup fffeed
    </Location>

    WSGIApplicationGroup %{GLOBAL}


    ErrorLog /var/log/apache2/monitor.freifunk-potsdam.de_error.log

    <IfModule log_config_module>
            TransferLog /var/log/apache2/monitor.freifunk-potsdam.de_access.log
    </IfModule>

    <IfModule mpm_peruser_module>
            ServerEnvironment apache apache
    </IfModule>
</VirtualHost>

HTTPS:

<VirtualHost *:443>
    ServerName monitor.freifunk-potsdam.de

    ServerAdmin [email protected]
    DocumentRoot "/var/www/monitor.freifunk-potsdam.de/htdocs"

    <Directory "/var/www/monitor.freifunk-potsdam.de/htdocs">
            Options Indexes FollowSymLinks ExecCGI

            AllowOverride All

            Require all granted
    </Directory>

    #RemoteIPHeader X-Forwarded-For

    RedirectMatch 302 ^/$ /grafana/

    WSGIDaemonProcess ff python-path=/var/www/monitor.freifunk-potsdam.de/wsgi/ff threads=64 processes=1
    WSGIDaemonProcess lora python-path=/var/www/monitor.freifunk-potsdam.de/wsgi/ff threads=4 processes=1

    WSGIScriptAlias /ff /var/www/monitor.freifunk-potsdam.de/wsgi/ff/ff.wsgi
    <Location /ff>
            WSGIProcessGroup ff
    </Location>

    WSGIScriptAlias /lora /var/www/monitor.freifunk-potsdam.de/wsgi/ff/lora.wsgi
    <Location /lora>
            WSGIProcessGroup lora
    </Location>

    WSGIApplicationGroup %{GLOBAL}

    <Directory /var/www/monitor.freifunk-potsdam.de/wsgi>
        Require all granted
    </Directory>

    RequestHeader unset Authorization
    ProxyPass /grafana http://localhost:3000

    <FilesMatch "\.(cgi|shtml|phtml|php|py)$">
            SSLOptions +StdEnvVars
    </FilesMatch>

    SSLEngine on
    SSLCertificateFile /etc/ssl/letsencrypt/monitor.freifunk-potsdam.de.pem
    SSLCertificateKeyFile /etc/ssl/letsencrypt/monitor.freifunk-potsdam.de.key
    Header always set Strict-Transport-Security "max-age=15552000; includeSubdomains; preload"

    <IfModule setenvif_module>
            BrowserMatch ".*MSIE.*" \
                    nokeepalive ssl-unclean-shutdown \
                    downgrade-1.0 force-response-1.0
    </IfModule>

    ErrorLog /var/log/apache2/monitor.freifunk-potsdam.de_ssl_error.log

    <IfModule log_config_module>
            TransferLog /var/log/apache2/monitor.freifunk-potsdam.de_ssl_access.log
    </IfModule>

</VirtualHost>

Dazu kommen dann noch reichlich Cronjobs:

MAILTO="admin@server"
#bekommt die ausgaben der cronjobs
# parsing
# 0,5,10,...
*/5  *  * * *   www-data    /var/www/monitor.freifunk-potsdam.de/wsgi/ff/parseff1.py /var/ffdata/ >> /var/ffdata/ffdata.log
# 4,9,14,...
4-59/5 * * * *  www-data    /var/www/monitor.freifunk-potsdam.de/wsgi/ff/parseff2.py
59   *  * * *   root        cat /var/ffdata/ffdata.log && rm /var/ffdata/ffdata.log
1    *  * * *   www-data    find /var/ffdata/mv/ -type f -ctime +1 -delete
0    7  * * *   www-data    find /var/ffdata/err/ -size -100c -delete
2    7  * * *   www-data    ionice -c idle mv /var/ffdata/err/* /var/ffdata/

*/15 *  * * *   www-data    /var/www/monitor.freifunk-potsdam.de/wsgi/ff/lperf.py
8    *  * * *   www-data    /var/www/monitor.freifunk-potsdam.de/wsgi/ff/routes.py > /dev/null
#*    *  * * *   www-data    /var/www/monitor.freifunk-potsdam.de/wsgi/ff/sendmsg.py
*    *  * * *   www-data    /var/www/monitor.freifunk-potsdam.de/wsgi/ff/sendtweet.py routermsg
0    8  * * *   www-data    /var/www/monitor.freifunk-potsdam.de/wsgi/ff/sendtweet.py netstate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants