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 194 additions and 939 deletions
FROM indiepaas/nginx-php
# install owncloud
RUN echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list && \
curl -L http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key | apt-key add - && \
apt-get update && apt-get install -y \
owncloud \
sudo \
php5-imap && \
apt-get install -y --no-install-recommends \
libreoffice && \
rm -rf /var/lib/apt/lists/* && \
php5enmod imap && \
mv /var/www/owncloud/apps /owncloud-apps && \
sed -i 's/^post_max_size =.*/post_max_size = 0/g' /etc/php5/fpm/php.ini && \
sed -i 's/^upload_max_filesize =.*/upload_max_filesize = 25G/g' /etc/php5/fpm/php.ini && \
sed -i 's/^max_file_uploads =.*/max_file_uploads = 100/g' /etc/php5/fpm/php.ini && \
sed -i 's/;env[PATH]/env\[PATH\]/g' /etc/php5/fpm/pool.d/www.conf && \
sed -i 's/# exec CMD/# exec CMD\n\/opt\/startup-owncloud.sh/g' /opt/entrypoint.sh
# install nginx owncloud config
ADD nginx-owncloud.conf /etc/nginx/conf.d/nginx-owncloud.conf
# add startup.sh
ADD startup-owncloud.sh /opt/startup-owncloud.sh
RUN chmod a+x /opt/startup-owncloud.sh
# Expose environment variables
ENV DB_NAME owncloud
ENV DB_USER admin
server {
listen 80;
root /var/www/owncloud;
index index.php index.html index.htm;
client_max_body_size 0; # 0=unlimited - set max upload size
fastcgi_buffers 64 4K;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
index index.php;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
deny all;
}
location / {
# The following 2 rules are only needed with webfinger
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ index.php;
}
location ~ ^(.+?\.php)(/.*)?$ {
try_files $1 =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$1;
fastcgi_param PATH_INFO $2;
fastcgi_param HTTPS on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
# Optional: set long EXPIRES header on static assets
location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don't log access to assets
access_log off;
}
}
#!/bin/bash -eux
echo ">> copy apps into apps folder."
cp -R --remove-destination /owncloud-apps/* /var/www/owncloud/apps/
### configure email
sed -i s/##MAIL_HOST##/${MAIL_HOST}/ /etc/ssmtp/ssmtp.conf
sed -i s/##MAIL_PORT##/${MAIL_PORT}/ /etc/ssmtp/ssmtp.conf
sed -i s/##MAIL_USER##/${MAIL_USER}/ /etc/ssmtp/ssmtp.conf
sed -i s/##MAIL_PASS##/${MAIL_PASS}/ /etc/ssmtp/ssmtp.conf
###
# 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 ">>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
# 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/$domain/mysql/dump.sql:/tmp/dump.sql --link mysql-$domain:db indiepaas/mysql /bin/bash
mysql -u admin -p -h db < /tmp/dump.sql
```
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
docker pull indiepaas/wordpress
cd /data/domains
for domain in `ls .`
do
if cat $domain/.env|grep APPLICATION=wordpress
then
systemctl restart web@$domain
/opt/bin/docker-enter $domain wp --allow-root core update-db --path=/app
fi
done
#!/bin/bash
#This script is tested on Debian 12
#Current version of libre.sh to be installed
LIBRE_VERSION=1.2
# System env vars : can be overrided by a values.env file next to this install file
### CONFIG : Specify you template repo ROOT without training slash (Optional) or comment if you want to supply full url for apps
APP_REPO_URL="lab.libreho.st/libre.sh/compose"
## domain handling
### CONFIG : change to your domain vendor ( namecheap, ovh , scaleway, )
DOMAIN_SERVER=namecheap
### Namecheap specific
NAMECHEAP_URL="namecheap.com"
NAMECHEAP_API_USER="pierreo"
NAMECHEAP_API_KEY=
### ovh specific (WIP)
OVH_URL="eu.api.ovh.com"
OVH_API_USER=""
OVH_API_KEY=
### Scaleway specific (WIP)
SCALEWAY_URL=""
SCALEWAY_API_USER=""
SCALEWAY_API_KEY=
### TODO : change your settings
IP="curl -s http://icanhazip.com/"
FirstName="Pierre"
LastName="Ozoux"
Address=""
PostalCode=""
Country="Portugal"
Phone="+351.967184553"
EmailAddress="pierre@ozoux.net"
City="Lisbon"
CountryCode="PT"
## Backup
BACKUP_DESTINATION=root@xxxxx:port
### CONFIG : Change your mail settings.
## SMTP
MAIL_USER=
MAIL_PASS=
MAIL_HOST=mail.indie.host
MAIL_PORT=587
MAIL_SECURITY=
# Default admin emails for apps
ADMIN_EMAIL=support@ekimia.fr
### TODO : source a setting file is present to override defaults
echo "-------- Welcome to libre.sh $LIBRE_VERSION installer"
echo "---- sourcing local values.env file if present"
source values.env
# STEP add kernel parameter
# STEP Define environnement
echo "-------- setting up system variables"
echo "APP_REPO_URL=${APP_REPO_URL}" >> /etc/environment
echo "LIBRE_VERSION=${LIBRE_VERSION}" >> /etc/environment
echo "MAIL_USER=${MAIL_USER}" >> /etc/environment
echo "MAIL_PASS=${MAIL_PASS}" >> /etc/environment
echo "MAIL_HOST=${MAIL_HOST}" >> /etc/environment
echo "MAIL_PORT=${MAIL_PORT}" >> /etc/environment
echo "MAIL_SECURITY=${MAIL_SECURITY}" >> /etc/environment
echo "ADMIN_EMAIL=${ADMIN_EMAIL}" >> /etc/environment
# STEP Install Docker
name="docker.io"
# TODO : Fix a version for docker ?
dpkg -s $name &> /dev/null
if [ $? -ne 0 ]
then
echo "$name not installed"
apt-get update
# curl -fsSL https://get.docker.com -o get-docker.sh
# sh get-docker.sh
apt install -y $name
echo "-------- Native docker installed "
else
echo "$name already installed"
fi
# STEP "install docker-compose"
echo "-------- Install native docker-compose "
# TODO : Fix a version for docker compose ?
#mkdir -p /opt/bin &&\
#dockerComposeVersion=$(curl -s https://api.github.com/repos/docker/compose/releases/latest|grep tag_name|cut -d'"' -f4) &&\
#curl -L https://github.com/docker/compose/releases/download/$dockerComposeVersion/docker-compose-`uname -s`-`uname -m` > /opt/bin/#docker-compose &&\
#chmod +x /opt/bin/docker-compose
apt install -y docker-compose
# STEP "install git"
echo "-------- Install git"
distro=$( ( lsb_release -ds || cat /etc/*release || uname -om ) 2>/dev/null | head -n1 | cut -d " " -f1)
if [[ "$distro" == "Ubuntu" || "$distro" == "Debian" ]]; then
apt-get install -y git
elif [[ "$distro" == "CentOS" || "$distro" == "AlmaLinux" || "$distro" == "Rocky" || "$distro" == "Fedora" ]]; then
yum install -y git
elif [[ "$distro" == "openSUSE" ]]; then
zypper install git
elif [[ "$distro" == "Arch" ]]; then
pacman -S git
elif [[ "$distro" == "Mageia" ]]; then
urpmi git
fi
# STEP install Libre.sh
echo " ---Removing previous install --- "
rm -rf /libre.sh
echo "-------- installing libre.sh"
git clone https://lab.libreho.st/libre.sh/compose.libre.sh.git /libre.sh
mkdir -p /{data,system}
mkdir -p /data/trash
mkdir -p /data/domains
cp /libre.sh/unit-files/* /etc/systemd/system && systemctl daemon-reload
systemctl enable web-net.service
systemctl start web-net.service
mkdir -p /opt/bin
cp /libre.sh/utils/* /opt/bin/
# STEP add /opt/bin path
echo "-------- updating PATH"
cat > /etc/profile.d/libre.sh <<EOF
export PATH=$PATH:/opt/bin
EOF
chmod 644 /etc/profile.d/libre.sh
bash /etc/profile.d/libre.sh
#TODO : reload profile to use libre right away
#!/bin/bash -eux
# Verify they are all in sync with git, if not, print the domain name.
for oo in `ls -d ./oo-*`;do
cd $oo
if ! git diff --exit-code --quiet; then
echo $oo
fi
cd ..
done
# Update all oo
for oo in `ls -d ./oo-*`;do
cd $oo
libre update
cd ..
done
#!/bin/bash
function valid_ip()
{
local ip=$1
local stat=1
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
&& ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
stat=$?
fi
return $stat
}
LABEL=$1
echo Label: $LABEL
echo API key: $VULTR_API_KEY
VPSPLANID=${2:-29}
SSHKEYID=`curl -s https://api.vultr.com/v1/sshkey/list\?api_key\=$VULTR_API_KEY | cut -d\" -f2`
echo Got your ssh key ID $SSHKEYID:
SUBID=`curl -s -d "DCID=9&VPSPLANID=$VPSPLANID&OSID=179&label=$LABEL&SSHKEYID=$SSHKEYID" https://api.vultr.com/v1/server/create\?api_key\=$VULTR_API_KEY | cut -d\" -f4`
echo Got your SUB ID $SUBID:
while :
do
IP=`curl -s https://api.vultr.com/v1/server/list_ipv4\?api_key\=$VULTR_API_KEY\&SUBID\=$SUBID | cut -d\" -f6`
if valid_ip $IP; then
break
else
echo "waiting to get an IP..."
sleep 5
fi
done
echo Writing $LABEL to /etc/hosts file, needs your root password:
sudo -- sh -c "echo $IP $LABEL \#$SUBID >> /etc/hosts"
while :
do
ssh -o "StrictHostKeyChecking no" -o "BatchMode yes" root@$LABEL exit
if [ $? == 0 ];
then
break
else
echo "waiting to be able to ssh..."
sleep 5
fi
done
#!/bin/bash -eux
LABEL=$1
SUBID=`cat /etc/hosts | grep $LABEL | cut -d# -f2`
echo Writing $LABEL to /etc/hosts file, needs your root password:
sudo sed -i "/$LABEL/ d" /etc/hosts
curl -d SUBID=$SUBID https://api.vultr.com/v1/server/destroy\?api_key\=$VULTR_API_KEY
#!/bin/bash -eux
/usr/bin/coreos-cloudinit --from-file=/var/lib/coreos-user_data
docker pull indiepaas/rsyslog
docker pull indiepaas/haproxy
docker pull indiepaas/confd
docker pull indiepaas/postfix
docker pull indiepaas/dovecot
docker pull indiepaas/nginx
docker pull indiepaas/mysql
docker pull indiepaas/wordpress
docker pull indiepaas/known
docker pull indiepaas/piwik
docker pull indiepaas/owncloud
docker pull indiepaas/duplicity
docker pull ibuildthecloud/systemd-docker
# Create Directory structure
mkdir -p /data/domains
mkdir -p /data/runtime/haproxy/approved-certs
git clone https://github.com/indiepaas/IndiePaaS.git /data/indiehosters
# Install unit-files
cp /data/indiehosters/unit-files/* /etc/systemd/system && systemctl daemon-reload
# Configure and start HAproxy
cp /data/indiehosters/tests/unsecure-certs/indiehosters.dev.pem /data/runtime/haproxy/approved-certs/default.pem
systemctl enable rsyslog
systemctl start rsyslog
systemctl enable confd
systemctl start confd
systemctl enable haproxy.path
systemctl start haproxy.path
source /etc/environment
# Put the backup server in known_hosts files using RSA algo
# https://github.com/paramiko/paramiko/issues/243
ssh -o "StrictHostKeyChecking no" -o "BatchMode yes" -o "HostKeyAlgorithms=ssh-rsa" $BACKUP_DESTINATION exit
# Import backup encryption key
gpg --import /root/key.pub
TRUSTVAR=`gpg --fingerprint root | grep Key|cut -d= -f2|sed 's/ //g'`
TRUST_VALUE=':6:'
echo $TRUSTVAR$TRUST_VALUE | gpg --import-ownertrust
docker run --rm -v /opt/bin:/target jpetazzo/nsenter
curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
update_engine_client -update