Moved to its own repo

This commit is contained in:
pierreozoux 2015-09-24 11:23:35 +01:00
parent 533397b9fb
commit 9009073734
3 changed files with 0 additions and 217 deletions

View file

@ -1,31 +0,0 @@
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

View file

@ -1,57 +0,0 @@
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;
}
}

View file

@ -1,129 +0,0 @@
#!/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"