From 2549a8ba9edb9a0116991d657e900d4e413013e0 Mon Sep 17 00:00:00 2001 From: pierreozoux <pierre@ozoux.net> Date: Thu, 24 Sep 2015 11:23:43 +0100 Subject: [PATCH] Moved to its own repo --- dockerfiles/services/piwik/Dockerfile | 32 --- dockerfiles/services/piwik/nginx-piwik.conf | 51 ---- dockerfiles/services/piwik/startup-piwik.sh | 253 -------------------- 3 files changed, 336 deletions(-) delete mode 100644 dockerfiles/services/piwik/Dockerfile delete mode 100644 dockerfiles/services/piwik/nginx-piwik.conf delete mode 100644 dockerfiles/services/piwik/startup-piwik.sh diff --git a/dockerfiles/services/piwik/Dockerfile b/dockerfiles/services/piwik/Dockerfile deleted file mode 100644 index 93ca815..0000000 --- a/dockerfiles/services/piwik/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM indiepaas/nginx-php - -RUN apt-get update && apt-get install -y \ - php5-gd \ - php5-geoip \ - php5-cli \ - zip \ - php-apc && \ - rm -rf /var/lib/apt/lists/* && \ - curl -O "http://builds.piwik.org/piwik.zip" && \ - unzip piwik.zip && \ - mv /piwik/config /piwik-config && \ - sed -i 's/;always_populate_raw_post_data = -1/always_populate_raw_post_data=-1/g' /etc/php5/fpm/php.ini && \ - cd /piwik/misc/ && \ - curl http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz > GeoLiteCity.dat.gz && \ - gunzip GeoLiteCity.dat.gz && \ - mv GeoLiteCity.dat GeoIPCity.dat && \ - sed -i 's/# exec CMD/# exec CMD\n\/opt\/startup-piwik.sh/g' /opt/entrypoint.sh - -# install nginx piwik config -ADD nginx-piwik.conf /etc/nginx/conf.d/nginx-piwik.conf - -# add startup.sh -ADD startup-piwik.sh /opt/startup-piwik.sh -RUN chmod a+x /opt/startup-piwik.sh - -# Expose environment variables -ENV DB_NAME piwik -ENV DB_USER admin - -VOLUME "/piwik/config/" - diff --git a/dockerfiles/services/piwik/nginx-piwik.conf b/dockerfiles/services/piwik/nginx-piwik.conf deleted file mode 100644 index 37aece9..0000000 --- a/dockerfiles/services/piwik/nginx-piwik.conf +++ /dev/null @@ -1,51 +0,0 @@ -server { - listen 80; - - root /usr/share/nginx/html; - index index.php index.html index.htm; - - location / { - try_files $uri $uri/ =404; - } - - error_page 404 /404.html; - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php5-fpm.sock; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } -} - -server { - listen 80; - - root /usr/share/nginx/html; - index index.php index.html index.htm; - - location / { - try_files $uri $uri/ =404; - } - - error_page 404 /404.html; - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php5-fpm.sock; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } -} diff --git a/dockerfiles/services/piwik/startup-piwik.sh b/dockerfiles/services/piwik/startup-piwik.sh deleted file mode 100644 index 1b1e3eb..0000000 --- a/dockerfiles/services/piwik/startup-piwik.sh +++ /dev/null @@ -1,253 +0,0 @@ -#!/bin/bash -eux - -source /etc/environment - -echo ">> adding softlink from /piwik to /" -rm -rf /usr/share/nginx/html -ln -s /piwik /usr/share/nginx/html - -if [ -z ${DB_PASS+x} ] || [ -z ${DB_USER+x} ] -then - echo ">> piwik started, initial setup needs to be done in browser!" - echo ">> be fast! - anyone with access to your server can configure it!" - exit 0 -fi - -echo -echo ">> #####################" -echo ">> init piwik" -echo ">> #####################" -echo - -nginx 2> /tmp/nginx.log > /tmp/nginx.log & - -/opt/mysql-check.sh - -if [ `echo "SHOW TABLES FROM $DB_NAME;" | mysql -h $DB_HOST -P $DB_PORT -u $DB_USER -p$DB_PASS | grep "piwik_" | wc -l` -lt 1 ] -then - echo ">> no DB installed, MYSQL User or Password specified - seems like the first start" - - #cat /config.ini.php | sed "s/PIWIK_MYSQL_PORT/$DB_PORT/g" | sed "s/PIWIK_MYSQL_USER/$DB_USER/g" | sed "s/PIWIK_MYSQL_PASSWORD/$DB_PASS/g" | sed "s/PIWIK_MYSQL_DBNAME/$DB_NAME/g" > /piwik/config/config.ini.php - - cp -R /piwik-config/* /piwik/config/ - chown -R www-data:www-data /usr/share/nginx/html/ - - echo ">> init Piwik" - if [ -z ${EMAIL+x} ] - then - PIWIK_ADMIN="admin" - echo ">> piwik admin user: $EMAIL" - fi - - if [ -z ${PIWIK_ADMIN_PASSWORD+x} ] - then - PIWIK_ADMIN_PASSWORD=`perl -e 'my @chars = ("A".."Z", "a".."z"); my $string; $string .= $chars[rand @chars] for 1..10; print $string;'` - echo ">> generated piwik admin password: $PIWIK_ADMIN_PASSWORD" - fi - - if [ -z ${PIWIK_SUBSCRIBE_NEWSLETTER+x} ] - then - PIWIK_SUBSCRIBE_NEWSLETTER=0 - fi - - if [ -z ${PIWIK_SUBSCRIBE_PRO_NEWSLETTER+x} ] - then - PIWIK_SUBSCRIBE_PRO_NEWSLETTER=0 - fi - - if [ -z ${EMAIL+x} ] - then - EMAIL="no@no.tld" - PIWIK_SUBSCRIBE_NEWSLETTER=0 - PIWIK_SUBSCRIBE_PRO_NEWSLETTER=0 - fi - - if [ -z ${SITE_NAME+x} ] - then - SITE_NAME="My local Website" - fi - - if [ -z ${SITE_URL+x} ] - then - PRIMARY_DOMAIN=`echo $URL | cut -d. -f2,3` - SITE_URL="http://${PRIMARY_DOMAIN}" - fi - - if [ -z ${SITE_TIMEZONE+x} ] - then - SITE_TIMEZONE="Europe/Paris" - fi - - if [ -z ${SITE_ECOMMERCE+x} ] - then - SITE_ECOMMERCE=0 - fi - - if [ -z ${ANONYMISE_IP+x} ] - then - ANONYMISE_IP=1 - fi - - if [ -z ${DO_NOT_TRACK+x} ] - then - DO_NOT_TRACK=1 - fi - - echo ">> piwik wizard: #1 open installer" - - curl "http://${URL}/" \ - -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \ - 2> /dev/null | grep " % Done" - - sleep 5 - - echo ">> piwik wizard: #2 open system check" - - curl "http://${URL}/index.php?action=systemCheck&trackerStatus=0" \ - -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://${URL}/' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \ - 2> /dev/null | grep " % Done" - - sleep 5 - - echo ">> piwik wizard: #3 open database settings" - - curl "http://${URL}/index.php?action=databaseSetup&trackerStatus=0" \ - -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://${URL}/index.php?action=systemCheck&trackerStatus=0' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \ - 2> /dev/null | grep " % Done" - - sleep 5 - - echo ">> piwik wizard: #4 store database settings" - - curl "http://${URL}/index.php?action=databaseSetup&trackerStatus=0" \ - -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Origin: http://${URL}/' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: http://${URL}/index.php?action=databaseSetup&trackerStatus=0' -H 'Connection: keep-alive' --compressed \ - --data-urlencode host="$DB_HOST:$DB_PORT" \ - --data-urlencode username="$DB_USER" \ - --data-urlencode password="$DB_PASS" \ - --data-urlencode dbname="$DB_NAME" \ - --data-urlencode tables_prefix="piwik_" \ - --data 'adapter=PDO%5CMYSQL&submit=Next+%C2%BB' \ - 2> /dev/null - - curl "http://${URL}/index.php?action=tablesCreation&trackerStatus=0&module=Installation" \ - -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://${URL}/index.php?action=databaseSetup&trackerStatus=0' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' --compressed \ - 2> /dev/null | grep " % Done" - - sleep 5 - - echo ">> piwik wizard: #5 open piwik settings" - - curl "http://${URL}/index.php?action=setupSuperUser&trackerStatus=0&module=Installation" \ - -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://${URL}/index.php?action=tablesCreation&trackerStatus=0&module=Installation' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \ - 2> /dev/null | grep " % Done" - - sleep 5 - - echo ">> piwik wizard: #6 store piwik settings" - - curl "http://${URL}/index.php?action=setupSuperUser&trackerStatus=0&module=Installation" \ - -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Origin: http://${URL}' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: http://${URL}/index.php?action=setupSuperUser&trackerStatus=0&module=Installation' -H 'Connection: keep-alive' --compressed \ - --data-urlencode login="$EMAIL" \ - --data-urlencode password="$PIWIK_ADMIN_PASSWORD" \ - --data-urlencode password_bis="$PIWIK_ADMIN_PASSWORD" \ - --data-urlencode email="$EMAIL" \ - --data-urlencode subscribe_newsletter_piwikorg="$PIWIK_SUBSCRIBE_NEWSLETTER" \ - --data-urlencode subscribe_newsletter_piwikpro="$PIWIK_SUBSCRIBE_PRO_NEWSLETTER" \ - --data 'submit=Next+%C2%BB' \ - 2> /dev/null - - curl "http://${URL}/index.php?action=firstWebsiteSetup&trackerStatus=0&module=Installation" \ - -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://${URL}/index.php?action=setupSuperUser&trackerStatus=0&module=Installation' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' --compressed \ - 2> /dev/null | grep " % Done" - - sleep 5 - - echo ">> piwik wizard: #7 store piwik site settings" - - curl "http://${URL}/index.php?action=firstWebsiteSetup&trackerStatus=0&module=Installation" \ - -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Origin: http://${URL}' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: http://${URL}/index.php?action=firstWebsiteSetup&trackerStatus=0&module=Installation' -H 'Connection: keep-alive' --compressed \ - --data-urlencode siteName="$SITE_NAME" \ - --data-urlencode url="$SITE_URL" \ - --data-urlencode timezone="$SITE_TIMEZONE" \ - --data-urlencode ecommerce="$SITE_ECOMMERCE" \ - --data 'submit=Next+%C2%BB' \ - 2> /dev/null - - curl "http://${URL}/index.php?action=trackingCode&trackerStatus=0&module=Installation&site_idSite=1&site_name=default" \ - -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://${URL}/index.php?action=firstWebsiteSetup&trackerStatus=0&module=Installation' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' --compressed \ - 2> /dev/null | grep " % Done" - - sleep 5 - - echo ">> piwik wizard: #8 skip js page" - - curl "http://${URL}/index.php?action=finished&trackerStatus=0&module=Installation&site_idSite=1&site_name=default" \ - -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://${URL}/index.php?action=trackingCode&trackerStatus=0&module=Installation&site_idSite=1&site_name=justabot' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \ - 2> /dev/null | grep " % Done" - - sleep 5 - - echo ">> piwik wizard: #9 final settings" - - curl "http://${URL}/index.php?action=finished&trackerStatus=0&module=Installation&site_idSite=1&site_name=default" \ - -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Origin: http://${URL}/' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: http://${URL}/index.php?action=finished&trackerStatus=0&module=Installation&site_idSite=1&site_name=justabot' -H 'Connection: keep-alive' --compressed \ - --data-urlencode do_not_track="$DO_NOT_TRACK" \ - --data-urlencode anonymise_ip="$ANONYMISE_IP" \ - --data 'submit=Continue+to+Piwik+%C2%BB' \ - 2> /dev/null - - curl "http://${URL}/index.php" \ - -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://${URL}/index.php?action=finished&trackerStatus=0&module=Installation&site_idSite=1&site_name=justabot' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' --compressed \ - 2> /dev/null - - sleep 5 - -fi - -/piwik/console core:update --yes - -chown -R www-data:www-data /piwik -chmod -R 755 /piwik/tmp - -echo ">> update CorePlugins" -curl "http://${URL}/index.php?updateCorePlugins=1" \ - 2> /dev/null - -sleep 2 - -killall nginx - -cat <<EOF -Add the following JS-Code to your Site -> don't forget to change the URLs ;) - -<!-- Piwik --> -<script type="text/javascript"> - var _paq = _paq || []; - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); - (function() { - var u="//!!!YOUR-URL!!!/"; - _paq.push(['setTrackerUrl', u+'piwik.php']); - _paq.push(['setSiteId', 1]); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); - })(); -</script> -<noscript><p><img src="//!!!YOUR-URL!!!/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript> -<!-- End Piwik Code --> -EOF - -# Put the right MySQL adapter -if ! grep -q adapter /piwik/config/config.ini.php; then - sed -i '/\[database\]/a adapter=MYSQLI' /piwik/config/config.ini.php -fi - -# Fix IP behind proxy -if ! grep -q proxy_client_headers /piwik/config/config.ini.php; then - sed -i '/\[General\]/a proxy_client_headers[] = HTTP_X_FORWARDED_FOR' /piwik/config/config.ini.php -fi - -if ! grep -q proxy_host_headers /piwik/config/config.ini.php; then - sed -i '/\[General\]/a proxy_host_headers[] = HTTP_X_FORWARDED_HOST' /piwik/config/config.ini.php -fi - -- GitLab