add verious installation scripts and work on setting up Nc

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2017-01-23 18:59:44 +01:00
Родитель 0d254fe16a
Коммит 1c4bcf1583
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7424F1874854DF23
6 изменённых файлов: 200 добавлений и 24 удалений

Просмотреть файл

@ -20,13 +20,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
FROM ubuntu:16.04
COPY resources/nextcloud-11.0.0.tar.bz2 /root/
RUN /bin/bash -c "export DEBIAN_FRONTEND=noninteractive" && \
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get -y update && apt-get install -y \
apache2 \
curl \
libapache2-mod-php7.0 \
php7.0 \
php7.0-mysql \
php-curl \
php-dompdf \
php-gd \
@ -36,45 +39,34 @@ RUN /bin/bash -c "export DEBIAN_FRONTEND=noninteractive" && \
php-zip \
php-apcu \
php-ldap \
php-pgsql \
wget \
unzip \
pwgen \
sudo
sudo \
lbzip2
RUN a2enmod ssl
RUN a2enmod headers
RUN a2enmod rewrite
RUN ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled
# FIXME: trusted domain
# FIXME: Rewrite Base, proxy settings?
RUN export NC_DATADIR="/var/lib/nextcloud/" && \
export NC_DB_NAME="nextcloud" && \
export NC_DB_TYPE="pgsql" && \
export NC_LOCAL_ADMIN="nc_admin" && \
export NC_LOCAL_ADMIN_PWD="pwgen -y 30 1" && \
mkdir "$NC_DATADIR" && \
cd /var/www/html && \
cd /root/ && wget https://download.nextcloud.com/server/releases/nextcloud-11.0.0.zip && unzip /root/nextcloud-11.0.0.zip && \
pwgen -y 30 1 > /etc/postgresql-nextcloud.secret && \
mkdir "$NC_DATADIR"
RUN cd /root/ && \
tar -xf "nextcloud-11.0.0.tar.bz2" && \
mv /root/nextcloud/* /var/www/html/ && \
mv /root/nextcloud/.htaccess /var/www/html/.htaccess && \
rm -Rf /root/nextcloud && \
rm "nextcloud-11.0.0.tar.bz2" && \
cd /var/www/html/ && \
chmod +x occ && \
./occ maintenance:install --admin-user "$NC_LOCAL_ADMIN" --admin-pass "$NC_LOCAL_ADMIN_PWD" --database "$NC_DB_TYPE" --database-host "$DB_HOST" --database-port "$DB_PORT" --database-name "$NC_DB_NAME" --database-user "$DB_USER" --database-pass "$DB_PASSWORD" --data-dir "$NC_DATADIR" && \
chown -R www-data "$NC_DATADIR" && \
./occ check && \
./occ status && \
./occ app:list && \
./occ upgrade && \
./occ config:system:set trusted_domains 3 --value=demo.nextcloud.com && \
./occ config:system:set htaccess.RewriteBase --value="/" && \
./occ maintenance:update:htaccess && \
/var/www/html/occ config:system:set --value "\OC\Memcache\APCu" memcache.local && \
chown -R www-data /var/www && \
cat /etc/apache2/apache2.conf |awk '/<Directory \/var\/www\/>/,/AllowOverride None/{sub("None", "All",$0)}{print}' > /tmp/apache2.conf && \
mv /tmp/apache2.conf /etc/apache2/apache2.conf && \
sed -i '/SSLEngine on/a Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"' /etc/apache2/sites-enabled/default-ssl.conf
chmod +x occ
# perhaps unnecessary?
EXPOSE 80
EXPOSE 443

33
preinst.sh Normal file
Просмотреть файл

@ -0,0 +1,33 @@
#!/bin/bash
# @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
#
# @author Arthur Schiwon <blizzz@arthur-schiwon.de>
#
# @license GNU AGPL version 3 or any later version
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
NC_PERMCONFDIR="/var/lib/univention-appcenter/apps/nextcloud/conf"
NC_UCR_FILE="$NC_PERMCONFDIR/ucr"
ls /var/lib/univention-appcenter/apps/nextcloud
touch "$NC_UCR_FILE" || echo "needs mkdir" && mkdir -p "$NC_PERMCONFDIR" && touch "$NC_UCR_FILE"
cat >"$NC_UCR_FILE" <<EOL
export NC_UCR_DOMAIN=`ucr get domainname`
EOL
exit 0

Двоичные данные
resources/nextcloud-11.0.0.tar.bz2 Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,26 @@
#!/bin/bash
# @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
#
# @author Arthur Schiwon <blizzz@arthur-schiwon.de>
#
# @license GNU AGPL version 3 or any later version
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
NC_PERMCONFDIR="/var/lib/univention-appcenter/apps/nextcloud/conf"
if [ -e "$NC_PERMCONFDIR/config/config.php" ]; then
cp "$NC_PERMCONFDIR/config/config.php" "/var/www/html/nextcloud/config/"
fi

Просмотреть файл

@ -0,0 +1,26 @@
#!/bin/bash
# @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
#
# @author Arthur Schiwon <blizzz@arthur-schiwon.de>
#
# @license GNU AGPL version 3 or any later version
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
NC_PERMCONFDIR="/var/lib/univention-appcenter/apps/nextcloud/conf"
if [ -e "/var/www/html/nextcloud/config/config.php" ]; then
cp -Ra "/var/www/html/nextcloud/config" "$NC_PERMCONFDIR/"
fi

99
setup.sh Normal file
Просмотреть файл

@ -0,0 +1,99 @@
#!/bin/bash
# @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
#
# @author Arthur Schiwon <blizzz@arthur-schiwon.de>
#
# @license GNU AGPL version 3 or any later version
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
NC_PERMDATADIR="/var/lib/univention-appcenter/apps/nextcloud/data"
NC_DATADIR="$NC_PERMDATADIR/nextcloud/data"
NC_PERMCONFDIR="/var/lib/univention-appcenter/apps/nextcloud/conf"
NC_UCR_FILE="$NC_PERMCONFDIR/ucr"
NC_DB_TYPE="pgsql"
NC_LOCAL_ADMIN="nc_admin"
NC_LOCAL_ADMIN_PWD=`pwgen -y 30 1`
cd /var/www/html
if [ ! -x occ ]; then
echo "occ missing or not executable"
exit 1
fi
mkdir -p "$NC_DATADIR"
chown www-data:www-data -R "$NC_PERMDATADIR/nextcloud"
./occ maintenance:install \
--admin-user "$NC_LOCAL_ADMIN" \
--admin-pass "$NC_LOCAL_ADMIN_PWD" \
--database "$NC_DB_TYPE" \
--database-host "$DB_HOST" \
--database-port "$DB_PORT" \
--database-name "$DB_NAME" \
--database-user "$DB_USER" \
--database-pass "$DB_PASSWORD" \
--data-dir "$NC_DATADIR"
STATE=$?
if [[ $STATE != 0 ]]; then
echo "Error while installing Nextcloud"
exit 1;
fi
chown -R www-data "$NC_DATADIR"
./occ check
./occ status
./occ app:list
./occ upgrade
"$NC_UCR_FILE"
# basic Nextcloud configuration
./occ config:system:set trusted_domains 0 --value="$NC_UCR_DOMAIN"
./occ config:system:set htaccess.RewriteBase --value="/nextcloud/"
./occ maintenance:update:htaccess
./occ config:system:set --value "\OC\Memcache\APCu" memcache.local
./occ app:enable user_ldap
# TODO: Other settings necessary? Proxy?
# configure LDAP
NC_LDAP_CID=`./occ ldap:create-empty-config| cut -d"'" -f 2`
./occ ldap:set-config "$NC_LDAP_CID" "ldapAgentName" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
./occ ldap:set-config "$NC_LDAP_CID" "KEY" "VAL"
# Apache configuration
cat /etc/apache2/apache2.conf |awk '/<Directory \/var\/www\/>/,/AllowOverride None/{sub("None", "All",$0)}{print}' > /tmp/apache2.conf && \
mv /tmp/apache2.conf /etc/apache2/apache2.conf
sed -i '/SSLEngine on/a Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"' /etc/apache2/sites-enabled/default-ssl.conf
# TODO LDAP Configuration