Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • lupa/compose.libre.sh
  • libre.sh/compose.libre.sh
  • ecobytes/compose.libre.sh
  • jordan.mitchell/compose.libre.sh
  • timothee/compose.libre.sh
5 results
Show changes
Showing
with 0 additions and 945 deletions
#!/bin/bash -eux
###
# Check Pre Install
###
if [ -f /var/www/owncloud/config/config.php ]
then
echo ">> owncloud already configured - skipping initialization"
## Update Database if this is run after an update
echo ">> update database if necessary"
cd /var/www/owncloud
chmod o+x occ
/opt/mysql-check.sh
sudo -u www-data ./occ upgrade || (( $? == 3 ))
cd -
exit 0
fi
if [ ! -z ${OWNCLOUD_DO_NOT_INITIALIZE+x} ]
then
echo ">> OWNCLOUD_DO_NOT_INITIALIZE set - skipping initialization"
exit 0
fi
source /etc/environment
###
# Variables
###
if [ -z ${OWNCLOUD_IMAP_HOST+x} ]
then
OWNCLOUD_IMAP_HOST=mail
fi
if [ -z ${DB_PORT+x} ]
then
DB_PORT=3306
fi
if [ -z ${DB_NAME+x} ]
then
DB_NAME=owncloud
fi
if [ -z ${EMAIL+x} ]
then
EMAIL="admin"
echo ">> owncloud admin user: $EMAIL"
fi
if [ -z ${ADMIN_PASSWORD+x} ]
then
ADMIN_PASSWORD=`perl -e 'my @chars = ("A".."Z", "a".."z"); my $string; $string .= $chars[rand @chars] for 1..10; print $string;'`
echo ">> generated owncloud admin password: $ADMIN_PASSWORD"
fi
###
# Pre Install
###
if [ ! -z ${OWNCLOUD_HSTS_HEADERS_ENABLE+x} ]
then
echo ">> HSTS Headers enabled"
sed -i 's/#add_header Strict-Transport-Security/add_header Strict-Transport-Security/g' /etc/nginx/conf.d/nginx-owncloud.conf
if [ ! -z ${OWNCLOUD_HSTS_HEADERS_ENABLE_NO_SUBDOMAINS+x} ]
then
echo ">> HSTS Headers configured without includeSubdomains"
sed -i 's/; includeSubdomains//g' /etc/nginx/conf.d/nginx-owncloud.conf
fi
else
echo ">> HSTS Headers disabled"
fi
###
# Headless initialization
###
echo ">> copy apps into apps folder."
cp -R /owncloud-apps/* /var/www/owncloud/apps/
echo ">>Setting Permissions:"
ocpath='/var/www/owncloud'
htuser='www-data'
chown -R root:${htuser} ${ocpath}/
chown -R ${htuser}:${htuser} ${ocpath}/apps/
chown -R ${htuser}:${htuser} ${ocpath}/config/
chown -R ${htuser}:${htuser} ${ocpath}/data/
echo ">> initialization"
echo ">> starting nginx to configure owncloud"
sleep 1
nginx > /tmp/nginx.log 2> /tmp/nginx.log &
sleep 1
## Create OwnCloud Installation
echo ">> init owncloud installation"
DATA_DIR=/var/www/owncloud/data
/opt/mysql-check.sh
if [ -z ${DB_USER+x} ] || [ -z ${DB_PASS+x} ]
then
echo "We need user and password for database"
exit 1
else
echo ">> using mysql DB"
DB_TYPE="mysql"
POST=`echo "install=true&adminlogin=$EMAIL&adminpass=$ADMIN_PASSWORD&adminpass-clone=$ADMIN_PASSWORD&directory=$DATA_DIR&dbtype=$DB_TYPE&dbuser=$DB_USER&dbpass=$DB_PASS&dbpass-clone=$DB_PASS&dbname=$DB_NAME&dbhost=$DB_HOST:$DB_PORT"`
fi
echo ">> using curl to post data to owncloud"
echo "POST = $POST"
curl -d "$POST" http://${URL}/index.php
echo ">> killing nginx - done with configuration"
sleep 1
killall nginx
echo ">> finished initialization"
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/"
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;
}
}
#!/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
FROM indiepaas/apache
# Download latest version of Wordpress into /app
RUN curl -L https://wordpress.org/latest.tar.gz | tar xz && \
mv wordpress/* app && \
mv /app/wp-content /wp-content && \
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
chmod +x wp-cli.phar && \
mv wp-cli.phar /usr/local/bin/wp
ADD wp-config.php /app/wp-config.php
# Add script to create 'wordpress' DB
ADD run-wordpress.sh /run-wordpress.sh
RUN chmod 755 /run-wordpress.sh
# Expose environment variables
ENV DB_HOST **LinkMe**
ENV DB_PORT **LinkMe**
ENV DB_NAME wordpress
ENV DB_USER admin
ENV DB_PASS **ChangeMe**
EXPOSE 80
VOLUME ["/app/wp-content", "/app/.htaccess"]
CMD ["/run-wordpress.sh"]
/app/wp-content
#!/bin/bash
if [ ! "$(ls -A /app/wp-content)" ]; then
cp -av /wp-content/* /app/wp-content/
fi
DB_HOST=${DB_PORT_3306_TCP_ADDR:-${DB_HOST}}
DB_HOST=${DB_1_PORT_3306_TCP_ADDR:-${DB_HOST}}
DB_PORT=${DB_PORT_3306_TCP_PORT:-${DB_PORT}}
DB_PORT=${DB_1_PORT_3306_TCP_PORT:-${DB_PORT}}
if [ "$DB_PASS" = "**ChangeMe**" ] && [ -n "$DB_1_ENV_MYSQL_PASS" ]; then
DB_PASS="$DB_1_ENV_MYSQL_PASS"
fi
echo "=> Trying to connect to MySQL/MariaDB using:"
echo "========================================================================"
echo " Database Host Address: $DB_HOST"
echo " Database Port number: $DB_PORT"
echo " Database Name: $DB_NAME"
echo " Database Username: $DB_USER"
echo " Database Password: $DB_PASS"
echo "========================================================================"
for ((i=0;i<10;i++))
do
DB_CONNECTABLE=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e 'status' >/dev/null 2>&1; echo "$?")
if [[ DB_CONNECTABLE -eq 0 ]]; then
break
fi
sleep 5
done
if [[ $DB_CONNECTABLE -eq 0 ]]; then
DB_EXISTS=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e "SHOW DATABASES LIKE '"$DB_NAME"';" 2>&1 |grep "$DB_NAME" > /dev/null ; echo "$?")
if [[ DB_EXISTS -eq 1 ]]; then
echo "=> Creating database $DB_NAME"
RET=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e "CREATE DATABASE $DB_NAME")
if [[ RET -ne 0 ]]; then
echo "Cannot create database for wordpress"
exit RET
fi
if [ -f /initial_db.sql ]; then
echo "=> Loading initial database data to $DB_NAME"
RET=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT $DB_NAME < /initial_db.sql)
if [[ RET -ne 0 ]]; then
echo "Cannot load initial database data for wordpress"
exit RET
fi
fi
echo "=> Done!"
echo "=> Installation of Wordpress"
PASS=`openssl rand -base64 15`
cd /app
wp --allow-root core install --url=https://${URL} --title=${URL} --admin_user=${EMAIL} --admin_password=${PASS} --admin_email=${EMAIL}
wp --allow-root plugin install wordpress-https
wp --allow-root plugin activate wordpress-https
echo "=> Done!"
echo "============================================="
echo "to connect ${EMAIL}:${PASS}"
echo "============================================="
else
echo "=> Skipped creation of database $DB_NAME – it already exists."
fi
else
echo "Cannot connect to Mysql"
exit $DB_CONNECTABLE
fi
chown -R root:www-data /app
chmod -R 650 /app
chmod -R 770 /app/wp-content/
chmod -R 660 /app/.htaccess
exec /run.sh
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
* installation. You don't have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/
define('FORCE_SSL_ADMIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
$_SERVER["SERVER_PORT"]='443';
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', getenv('DB_NAME'));
/** MySQL database username */
define('DB_USER', getenv('DB_USER'));
/** MySQL database password */
define('DB_PASSWORD', getenv('DB_PASS'));
/** MySQL hostname */
define('DB_HOST', getenv('DB_HOST').":".getenv('DB_PORT'));
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', '--w,=nO-t>g:EOH>e-ZXs!7x(: W4:}1A2$E?Sn9P>TW-[=:u[nc-eQ<vIi<6|wh');
define('SECURE_AUTH_KEY', 'PlM~WQ/9-~V:-3&be`nxuaghz@JyN!]SzVr_]lAM2b?QH(d(|`.z_;1jIE4kY&f+');
define('LOGGED_IN_KEY', 'K]6*uCb-m~>zj5C1krtu:>2VT(WlI/Jl5T~Pov2-`r+Zb5s3i6&aIN$*/+k/~sLN');
define('NONCE_KEY', '~; xvP`h^{Pl9zaD#/!f@M21BAk0#sKg>*P+=1LV+FY+;HNE)%Y`4(Xq|&})fCj^');
define('AUTH_SALT', 'A2|G[jvSLB+z dy S/ S>(lLyzxDvJ8(ps1(F%~x]eRD`UHv(h*IDjye+SYV-a;O');
define('SECURE_AUTH_SALT', '9cv/Hy~a;qr]4)i*udy-/$non@_:CU0SIdm-L[WH^k_}s:Jq[)HV,Wu8na<_;ef3');
define('LOGGED_IN_SALT', '{d*4OCrk9x`|cb-4EBK7=ewJ3D]y%z,7mSEd:8?=eP![zD.O`<Uubt-u%@TA+x T');
define('NONCE_SALT', 'z6G5thFC]JIW]|ZQIBgZ?zBb^!N#3-Un=)`!Xb/,Yd8[2&}.W{ITu?=PE0oZ,<8^');
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
* language support.
*/
define('WPLANG', '');
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
/** change permisssions for plugin installation */
define("FS_METHOD","direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);
# How do we compare to other PaaS
(Work in progress)
## IndieBox
## Michiel docker bash
And all the one from docker:
https://github.com/weihanwang/docker-ecosystem-survey
upload the key
gpg --import .gnupg/secring.gpg
source /etc/environment
domain=example.org
docker run -it --rm --name test -h backup.container -v /root:/root -v /data/domains/$domain:/backup indiepaas/duplicity sftp://${BACKUP_DESTINATION}/$domain /backup
systemctl start service
docker run -it --rm --name mysqlinport -v /data/domains/nao-ao-ttip.pt/mysql/dump.sql:/tmp/dump.sql --link mysql-nao-ao-ttip.pt:db indiepaas/mysql /bin/bash
mysql -u admin -p -h db < /tmp/dump.sql
#!/bin/bash -eux
URL=${PWD##*/}
db_container_name=`echo ${URL}_db_1 | sed "s/\.//"`; \
docker exec $db_container_name mongodump
#!/bin/bash -eux
/opt/bin/docker-compose kill || :
/opt/bin/docker-compose rm -f || :
/opt/bin/docker-compose up
#!/bin/bash -eux
/opt/bin/docker-compose stop
db:
image: mongo
volumes:
- data/runtime/db:/data/db
- data/dump:/dump
command: mongod --smallfiles
web:
image: mateorapp
environment:
- MONGO_URL=mongodb://db:27017/meteor
- ROOT_URL=https://meteorapp.test
links:
- db:db
volumes:
- logs:/home/app/logs
ports:
- 80
START
docker pull pierreozoux/haproxy
docker pull pierreozoux/confd
docker pull pierreozoux/email-forwarder
docker pull pierreozoux/nginx
docker pull pierreozoux/mysql
docker pull pierreozoux/wordpress
docker pull pierreozoux/known
mv /data/indiehosters /data/indiehosters.old
git clone https://github.com/pierreozoux/IndiePaaS.git /data/indiehosters
cp /data/indiehosters/unit-files/* /etc/systemd/system && systemctl daemon-reload
systemctl disable postfix
systemctl disable haproxy-confd
systemctl enable email-forwarder
systemctl enable confd
reboot
STOP
ROLLBACK START
mv /data/indiehosters /data/indiehosters.new
mv /data/indiehosters.old /data/indiehosters
cp /data/indiehosters/unit-files/* /etc/systemd/system && systemctl daemon-reload
systemctl enable postfix
systemctl enable haproxy-confd
systemctl disable email-forwarder
systemctl disable confd
reboot
ROLLBACK STOP
CLEAN START
rm /etc/systemd/system/postfix.service
rm /etc/systemd/system/haproxy-confd.service
rm -rf /data/indiehosters.old
CLEAN STOP
domains=( domain1 domain2 )
# START
echo "APPLICATION=wordpress" > /tmp/wordpress_env
echo "VOLUME=/app/wp-content" >> /tmp/wordpress_env
echo "EMAIL=test@test.org" >> /tmp/wordpress_env
docker pull ibuildthecloud/systemd-docker
for domain in "${domains[@]}"
do
cp /tmp/wordpress_env /data/domains/$domain/.env
systemctl stop wordpress@$domain
systemctl disable wordpress@$domain
mv /data/domains/$domain/wordpress/wp-content /data/domains/$domain/wordpress/data
done
cd /data/indiehosters
git pull
cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload
docker pull pierreozoux/wordpress
for domain in "${domains[@]}"
do
systemctl start lamp@$domain
systemctl enable lamp@$domain
done
docker pull pierreozoux/known
# put the right email in each folder
# STOP
# ROLLBACK START
cd /data/indiehosters
git checkout 2c71084d502c05be220dd2de00acfd0c333bc7ff
cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload
cd dockerfiles/services/wordpress/
docker build -t pierreozoux/wordpress .
for domain in "${domains[@]}"
do
mv /data/domains/$domain/wordpress/data /data/domains/$domain/wordpress/wp-content
systemctl start wordpress@$domain
systemctl enable wordpress@$domain
done
# ROLLBACK STOP
# CLEAN START
rm /etc/systemd/system/static-*
rm /etc/systemd/system/wordpress*
rm /etc/systemd/system/known*
rm /etc/systemd/system/mysql-importer@.service
# CLEAN STOP
domains=( domain1 domain2 )
# START
for domain in "${domains[@]}"
do
cp -R /data/runtime/domains/$domain/static-git /data/domains/$domain/static
systemctl stop static-git@$domain
systemctl start static@$domain
systemctl list-units | grep $domain | grep failed
done
# STOP
# ROLLBACK START
for domain in "${domains[@]}"
do
systemctl stop static@$domain
systemctl start static-git@$domain
done
# ROLLBACK STOP
# CLEAN START
for domain in "${domains[@]}"
do
systemctl disable static-git@$domain
systemctl enable static@$domain
rm -rf /data/domains/$domain/static-git
done
# CLEAN STOP
# START
docker pull pierreozoux/duplicity
gpg --gen-key
gpg --list-keys
echo ENCRYPT_KEY="" >> /etc/environment
echo BACKUP_DESTINATION="backup@backup" >> /etc/environment
cd /data/indiehosters
git pull
cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload
for domain in "${domains[@]}"
do
systemctl start backup@$domain
systemctl status backup@$domain
done
# STOP
# CLEAN START
rm -rf /data/import
rm /data/BACKUP_DESTINATION
su backup
cd
mkdir old_backups
mv ./* old_backups
# CLEAN STOP
static_domains=( domain1 domain2 )
wordpress_domains=( domain1 domain2 )
# START
cd /data/indiehosters
git pull
cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload
docker pull pierreozoux/wordpress
for domain in "${static_domains[@]}"
do
folder=/data/domains/${domain}
echo "EMAIL=test@test.org" > ${folder}/.env
echo "APPLICATION=nginx" >> ${folder}/.env
echo DOCKER_ARGUMENTS="-v ${folder}/static/www-content:/app" >> ${folder}/.env
systemctl restart static@$domain
systemctl status static@$domain
systemctl status web@$domain
done
for domain in "${wordpress_domains[@]}"
do
folder=/data/domains/${domain}
echo "EMAIL=test@test.org" > ${folder}/.env
echo "APPLICATION=wordpress" >> ${folder}/.env
echo DOCKER_ARGUMENTS="--link mysql-${domain}:db \
-v /data/domains/${domain}/wordpress/data:/app/wp-content \
-v /data/domains/${domain}/wordpress/.htaccess:/app/.htaccess \
--env-file /data/domains/${domain}/wordpress/.env" >> ${folder}/.env
systemctl restart lamp@$domain
systemctl status lamp@$domain
systemctl status web@$domain
done
# STOP
# ROLLBACK START
cd /data/indiehosters
git checkout 65d6486005e3d96e3ad9d5ab17f99d8910cc5e70
cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload
cd dockerfiles/services/wordpress/
docker build -t pierreozoux/wordpress .
for domain in "${wordpress_domains[@]}"
do
systemctl restart lamp@$domain
done
for domain in "${static_domains[@]}"
do
systemctl restart static@$domain
done
# ROLLBACK STOP
# CLEAN START
# CLEAN STOP
START
cd /data/indiehosters
git pull
docker pull pierreozoux/rsyslog
docker pull pierreozoux/haproxy
docker pull pierreozoux/confd
docker pull pierreozoux/postfix
docker pull pierreozoux/nginx
docker pull pierreozoux/mysql
docker pull pierreozoux/wordpress
docker pull pierreozoux/known
docker pull pierreozoux/piwik
docker pull pierreozoux/owncloud
systemctl enable rsyslog
systemctl start rsyslog
systemctl enable postfix
systemctl disable email-forwarder
cp /data/indiehosters/unit-files/* /etc/systemd/system
reboot
STOP