added docker-x86: nc and ncp for development. Update docker-armhf

This commit is contained in:
nachoparker 2017-09-21 18:57:11 +02:00
parent fa2279faa9
commit d0a839c09d
38 changed files with 559 additions and 145 deletions

View File

@ -5,20 +5,34 @@
#
nextcloudpi: nextcloud
docker build . -f docker/nextcloudpi/Dockerfile -t ownyourbits/nextcloudpi:latest
nextcloudpi-armhf: nextcloud-armhf
docker build . -f docker-armhf/nextcloudpi/Dockerfile -t ownyourbits/nextcloudpi-armhf:latest
nextcloud: lamp
docker build . -f docker/nextcloud/Dockerfile -t ownyourbits/nextcloud:latest
nextcloud-armhf: lamp-armhf
docker build . -f docker-armhf/nextcloud/Dockerfile -t ownyourbits/nextcloud-armhf:latest
lamp: miniraspbian
docker build . -f docker/lamp/Dockerfile -t ownyourbits/lamp-arm:latest
lamp-armhf: debian-ncp-armhf
docker build . -f docker-armhf/lamp/Dockerfile -t ownyourbits/lamp-armhf:latest
miniraspbian:
docker build . -f docker/miniraspbian/Dockerfile -t ownyourbits/miniraspbian:latest
debian-ncp-armhf:
docker build . -f docker-armhf/debian-ncp/Dockerfile -t ownyourbits/debian-ncp-armhf:latest
nextcloudpi-x86: nextcloud-x86
docker build . -f docker/nextcloudpi/Dockerfile -t ownyourbits/nextcloudpi-x86:latest
nextcloud-x86: lamp-x86
docker build . -f docker/nextcloud/Dockerfile -t ownyourbits/nextcloud-x86:latest
lamp-x86: debian-ncp-x86
docker build . -f docker/lamp/Dockerfile -t ownyourbits/lamp-x86:latest
debian-ncp-x86:
docker build . -f docker/debian-ncp/Dockerfile -t ownyourbits/debian-ncp-x86:latest
devel:
docker build . -f docker/devel/Dockerfile -t ownyourbits/nextcloudpi:devel
docker build . -f docker/devel/Dockerfile -t ownyourbits/nextcloudpi-x86:devel
# License
#
# This script is free software; you can redistribute it and/or modify it

View File

@ -63,8 +63,8 @@ function nextcloud-config()
done
}
if [ $(id -u) -ne 0 ]; then
printf "Must be run as root. Try 'sudo $0'\n"
if [[ ${EUID} -ne 0 ]]; then
printf "Must be run as root. Try 'sudo $( basename "$0" )'\n"
exit 1
fi

View File

@ -1,5 +1,7 @@
[v0.32.1](https://github.com/nextcloud/nextcloudpi/commit/b9f5c95) (2017-11-04) build: replace user pi for user ncp
[v0.32.2 ](https://github.com/nextcloud/nextcloudpi/commit/d46f567) (2017-11-04) ncp-web: fix return value
[v0.32.1 ](https://github.com/nextcloud/nextcloudpi/commit/8f28660) (2017-11-04) build: replace user pi for user ncp
[v0.32.0 ](https://github.com/nextcloud/nextcloudpi/commit/8c70198) (2017-11-03) spDYN: initial adjustments

View File

@ -0,0 +1,9 @@
FROM arm32v7/debian:stretch-slim
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>
CMD /bin/bash
RUN mkdir -p /etc/services.d
COPY docker/debian-ncp/run-parts.sh /

View File

@ -2,16 +2,16 @@
cleanup()
{
for file in $( ls -1rv /etc/cont-init.d ); do
/etc/cont-init.d/$file stop
for file in $( ls -1rv /etc/services.d ); do
/etc/services.d/"$file" stop "$1"
done
exit
}
trap cleanup SIGTERM
for file in $( ls -1v /etc/cont-init.d ); do
/etc/cont-init.d/$file start
for file in $( ls -1v /etc/services.d ); do
/etc/services.d/"$file" start "$1"
done
echo "Init done"

View File

@ -0,0 +1,45 @@
#!/bin/bash
# Install docker ARM on Raspbian
#
# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
# GPL licensed (see end of file) * Use at your own risk!
#
# Usage: ./installer.sh docker-env.sh <DHCP QEMU image IP> <image>
#
install()
{
curl -sSL get.docker.com | sh
usermod -aG docker pi
}
configure(){ :; }
cleanup()
{
apt-get autoremove
apt-get clean
rm /var/lib/apt/lists/* -r
rm -f /home/pi/.bash_history
systemctl disable ssh
}
# License
#
# This script is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This script 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this script; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA

View File

@ -0,0 +1,36 @@
#!/bin/bash
source /usr/local/etc/library.sh
set -e
[[ "$1" == "stop" ]] && {
echo "Stopping apache"
apachectl graceful-stop
echo "Stopping PHP-fpm"
killall php-fpm7.0
echo "Stopping mariaDB"
mysqladmin -u root shutdown
echo "LAMP cleanup complete"
exit 0
}
# MOVE CONFIGS TO PERSISTENT VOLUME
persistent_cfg /etc/apache2
echo "Starting PHP-fpm"
php-fpm7.0 &
echo "Starting Apache"
/usr/sbin/apache2ctl start
echo "Starting mariaDB"
mysqld &
# wait for mariadb
while :; do
[[ -S /var/run/mysqld/mysqld.sock ]] && break
sleep 0.5
done
exit 0

View File

@ -0,0 +1,40 @@
FROM ownyourbits/debian-ncp-armhf
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>
SHELL ["/bin/bash", "-c"]
ENV DOCKERBUILD 1
COPY etc/library.sh lamp.sh /usr/local/etc/
RUN \
# installation
source /usr/local/etc/library.sh; \
set +x; \
install_script /usr/local/etc/lamp.sh; \
# mariaDB fixups (move database to /data, which will be in a persistent volume)
mkdir -p /data/; \
mv /var/lib/mysql /data/database; \
sed -i "s|^datadir.*|datadir = /data/database|" /etc/mysql/mariadb.conf.d/50-server.cnf; \
# package cleanup
apt-get autoremove -y; \
apt-get clean; \
rm /var/lib/apt/lists/* -f; \
rm -rf /usr/share/man/*; \
rm -rf /usr/share/doc/*; \
rm /var/cache/debconf/*-old; \
rm -f /var/log/alternatives.log /var/log/apt/*; \
# specific cleanup
rm /data/database/ib_logfile*; \
rm /usr/local/etc/lamp.sh
COPY docker/lamp/010-lamp-run.sh /etc/services.d/
ENTRYPOINT ["/run-parts.sh"]
EXPOSE 80 443

View File

@ -0,0 +1,42 @@
#!/bin/bash
source /usr/local/etc/library.sh
set -e
NCDIR=/var/www/nextcloud
OCC="$NCDIR/occ"
[[ "$1" == "stop" ]] && {
echo "stopping cron..."
killall cron
exit 0
}
echo "Starting cron"
cron
# INIT DATABASE AND NEXTCLOUD CONFIG (first run)
test -f /data/app/config/config.php || {
echo "Uninitialized instance, running nc-init..."
source /usr/local/etc/library.sh
cd /usr/local/etc/
activate_script nc-init.sh
}
# Trusted Domain ( local IP )
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
sudo -u www-data php "$OCC" config:system:set trusted_domains 1 --value="$IP"
# Trusted Domain ( as an argument )
[[ "$@" != "" ]] && {
IP=$( grep -oP '\d{1,3}(\.\d{1,3}){3}' <<< "$2" ) # validate that the first argument is a valid IP
if [[ "$IP" != "" ]]; then
sudo -u www-data php "$OCC" config:system:set trusted_domains 6 --value="$IP"
else
echo "First argument must be an IP address to include as a Trusted domain. Ignoring"
fi
}
exit 0

View File

@ -0,0 +1,36 @@
FROM ownyourbits/lamp-armhf
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>
SHELL ["/bin/bash", "-c"]
ENV DOCKERBUILD 1
COPY etc/library.sh etc/nextcloudpi-config.d/nc-init.sh etc/nextcloudpi-config.d/nc-nextcloud.sh /usr/local/etc/
RUN \
# installation ( /var/www/nextcloud -> /data/app which will be in a volume )
apt-get update; \
apt-get install --no-install-recommends -y wget ca-certificates sudo; \
source /usr/local/etc/library.sh; \
set +x; \
install_script /usr/local/etc/nc-nextcloud.sh; \
activate_script /usr/local/etc/nc-nextcloud.sh; \
mv /var/www/nextcloud /data/app; \
ln -s /data/app /var/www/nextcloud; \
# package cleanup
apt-get autoremove -y; \
apt-get clean; \
rm /var/lib/apt/lists/* -f; \
rm -rf /usr/share/man/*; \
rm -rf /usr/share/doc/*; \
rm /var/cache/debconf/*-old; \
rm -f /var/log/alternatives.log /var/log/apt/*; \
# specific cleanup
apt-get purge -y wget ca-certificates; \
rm /usr/local/etc/nc-nextcloud.sh
COPY docker/nextcloud/020-nextcloud-run.sh /etc/services.d/

View File

@ -0,0 +1,8 @@
#!/bin/bash
source /usr/local/etc/library.sh
# INIT NCP CONFIG (first run)
persistent_cfg /usr/local/etc/nextcloudpi-config.d /data/ncp
exit 0

View File

@ -0,0 +1,75 @@
FROM ownyourbits/nextcloud-armhf
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>
SHELL ["/bin/bash", "-c"]
ENV DOCKERBUILD 1
COPY nextcloudpi.sh /usr/local/etc/
RUN \
apt-get update; \
apt-get install --no-install-recommends -y wget ca-certificates; \
# install nextcloudpi
source /usr/local/etc/library.sh; \
set +x; \
cd /usr/local/etc/; \
install_script nextcloudpi.sh; \
# fix default paths
sed -i 's|/media/USBdrive|/data/backups|' nextcloudpi-config.d/nc-backup.sh; \
# specific cleanup
rm /usr/local/etc/nextcloudpi.sh; \
apt-get purge -y wget ca-certificates; \
# letsencrypt build artifacts cleanup
apt-get purge -y \
make \
git \
augeas-lenses \
binutils \
cpp \
cpp-6 \
gcc \
gcc-6 \
libasan3 \
libaugeas0 \
libc-dev-bin \
libc6-dev \
libcc1-0 \
libexpat1-dev \
libffi-dev \
libgcc-6-dev \
libgomp1 \
libisl15 \
libmpc3 \
libpython-dev \
libpython2.7-dev \
libssl-dev \
libubsan0 \
linux-libc-dev \
python-dev \
python-virtualenv \
python2.7-dev \
python-pkg-resources \
python3-pkg-resources \
python3-virtualenv \
virtualenv \
python-pip-whl; \
# package clean up
apt-get autoremove -y; \
apt-get clean; \
rm -f /var/lib/apt/lists/*; \
rm -rf /usr/share/man/*; \
rm -rf /usr/share/doc/*; \
rm -f /var/log/alternatives.log /var/log/apt/*; \
rm /var/cache/debconf/*-old;
COPY docker/nextcloudpi/000-ncp-run.sh /etc/services.d/
# 4443 - ncp-web
EXPOSE 80 443 4443

14
docker-compose-armhf.yml Normal file
View File

@ -0,0 +1,14 @@
version: '3'
services:
nextcloudpi:
image: ownyourbits/nextcloudpi-armhf
command: "${IP}"
ports:
- "80:80"
- "443:443"
- "4443:4443"
volumes:
- ncdata:/data
volumes:
ncdata:

View File

@ -0,0 +1,13 @@
version: '3'
services:
nextcloud:
image: ownyourbits/nextcloud-armhf
command: "${IP}"
ports:
- "80:80"
- "443:443"
volumes:
- ncdata:/data
volumes:
ncdata:

13
docker-compose-nc.yml Normal file
View File

@ -0,0 +1,13 @@
version: '3'
services:
nextcloud:
image: ownyourbits/nextcloud-x86
command: "${IP}"
ports:
- "80:80"
- "443:443"
volumes:
- ncdata:/data
volumes:
ncdata:

15
docker-compose-ncpdev.yml Normal file
View File

@ -0,0 +1,15 @@
version: '3'
services:
nextcloudpi-dev:
image: ownyourbits/nextcloudpi-x86
command: "${IP}"
ports:
- "80:80"
- "443:443"
- "4443:4443"
volumes:
- ./ncp-web:/var/www/ncp-web
- ncdata:/data
volumes:
ncdata:

14
docker-compose.yml Normal file
View File

@ -0,0 +1,14 @@
version: '3'
services:
nextcloudpi:
image: ownyourbits/nextcloudpi-x86
command: "${IP}"
ports:
- "80:80"
- "443:443"
- "4443:4443"
volumes:
- ncdata:/data
volumes:
ncdata:

View File

@ -0,0 +1,9 @@
FROM debian:stretch-slim
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>
CMD /bin/bash
RUN mkdir -p /etc/services.d
COPY docker/debian-ncp/run-parts.sh /

18
docker/debian-ncp/run-parts.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
cleanup()
{
for file in $( ls -1rv /etc/services.d ); do
/etc/services.d/"$file" stop "$1"
done
exit
}
trap cleanup SIGTERM
for file in $( ls -1v /etc/services.d ); do
/etc/services.d/"$file" start "$1"
done
echo "Init done"
while true; do sleep 0.5; done # do nothing, just wait for trap from 'docker stop'

View File

@ -1,7 +1,4 @@
# docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v ncdata:/data --name nextcloudpi ownyourbits/nextcloudpi:devel
# docker build . -f docker/devel/Dockerfile -t ownyourbits/nextcloudpi:devel
FROM ownyourbits/nextcloud
FROM ownyourbits/nextcloudpi-x86
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>

View File

@ -1,16 +1,22 @@
#!/bin/bash
source /usr/local/etc/library.sh
set -e
case "$1" in
stop)
apachectl graceful-stop
killall php-fpm7.0
mysqladmin -u root shutdown
echo "LAMP cleanup complete"
exit 0
;;
esac
[[ "$1" == "stop" ]] && {
echo "Stopping apache"
apachectl graceful-stop
echo "Stopping PHP-fpm"
killall php-fpm7.0
echo "Stopping mariaDB"
mysqladmin -u root shutdown
echo "LAMP cleanup complete"
exit 0
}
# MOVE CONFIGS TO PERSISTENT VOLUME
persistent_cfg /etc/apache2
echo "Starting PHP-fpm"
php-fpm7.0 &
@ -21,4 +27,10 @@ echo "Starting Apache"
echo "Starting mariaDB"
mysqld &
# wait for mariadb
while :; do
[[ -S /var/run/mysqld/mysqld.sock ]] && break
sleep 0.5
done
exit 0

View File

@ -1,12 +1,11 @@
# docker run -d -p 443:443 -p 80:80 -v ncdata:/data --name lamp ownyourbits/lamp
# docker build . -f lamp.dockerfile -t ownyourbits/lamp-arm:latest
FROM ownyourbits/miniraspbian
FROM ownyourbits/debian-ncp-x86
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>
SHELL ["/bin/bash", "-c"]
ENV DOCKERBUILD 1
COPY etc/library.sh lamp.sh /usr/local/etc/
RUN \
@ -32,9 +31,9 @@ rm -f /var/log/alternatives.log /var/log/apt/*; \
# specific cleanup
rm /data/database/ib_logfile*; \
rm /usr/local/etc/{lamp.sh,library.sh}
rm /usr/local/etc/lamp.sh
COPY docker/lamp/010-lamp-run.sh /etc/cont-init.d/
COPY docker/lamp/010-lamp-run.sh /etc/services.d/
ENTRYPOINT ["/run-parts.sh"]

View File

@ -1,11 +0,0 @@
# docker build . -f Dockerfile.raspbian -t ownyourbits/raspbian:latest
FROM ownyourbits/miniraspbian:raw
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>
CMD /bin/bash
RUN mkdir -p /etc/cont-init.d
COPY docker/miniraspbian/run-parts.sh /

View File

@ -1,25 +1,21 @@
#!/bin/bash
source /usr/local/etc/library.sh
set -e
NCDIR=/var/www/nextcloud
OCC="$NCDIR/occ"
case "$1" in
stop)
echo "stopping cron..."
killall cron
exit 0
;;
esac
# COPY NEXTCLOUD TO /data, WHICH WILL BE IN A PERSISTENT VOLUME (first run)
test -d /data/app || {
echo "Setting up persistent Nextcloud dir..."
mv "$NCDIR" /data/app
ln -s /data/app "$NCDIR"
[[ "$1" == "stop" ]] && {
echo "stopping cron..."
killall cron
exit 0
}
echo "Starting cron"
cron
# INIT DATABASE AND NEXTCLOUD CONFIG (first run)
test -f /data/app/config/config.php || {
echo "Uninitialized instance, running nc-init..."
@ -28,22 +24,19 @@ test -f /data/app/config/config.php || {
activate_script nc-init.sh
}
# Trusted Domain ( local IP )
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
sudo -u www-data php "$OCC" config:system:set trusted_domains 1 --value="$IP"
# Trusted Domain ( as an argument )
[[ "$@" != "" ]] && {
IP=$( grep -oP '\d{1,3}(\.\d{1,3}){3}' <<< "$1" ) # validate that the first argument is a valid IP
IP=$( grep -oP '\d{1,3}(\.\d{1,3}){3}' <<< "$2" ) # validate that the first argument is a valid IP
if [[ "$IP" != "" ]]; then
sudo -u www-data php $OCC config:system:set trusted_domains 1 --value="$IP"
sudo -u www-data php "$OCC" config:system:set trusted_domains 6 --value="$IP"
else
echo "First argument must be an IP address to include as a Trusted domain. Ignoring"
fi
}
# Trusted Domain ( local IP )
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
sudo -u www-data php $OCC config:system:set trusted_domains 2 --value="$IP"
echo "Starting cron"
cron
exit 0

View File

@ -1,22 +1,24 @@
# docker run -d -p 443:443 -p 80:80 -v ncdata:/data --name nextcloud ownyourbits/nextcloud
# docker build . -f nextcloud.dockerfile -t ownyourbits/nextcloud:latest
FROM ownyourbits/lamp-arm
FROM ownyourbits/lamp-x86
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>
SHELL ["/bin/bash", "-c"]
ENV DOCKERBUILD 1
COPY etc/library.sh etc/nextcloudpi-config.d/nc-init.sh etc/nextcloudpi-config.d/nc-nextcloud.sh /usr/local/etc/
RUN \
# installation
# installation ( /var/www/nextcloud -> /data/app which will be in a volume )
apt-get update; \
apt-get install --no-install-recommends -y wget ca-certificates iputils-ping; \
apt-get install --no-install-recommends -y wget ca-certificates sudo; \
source /usr/local/etc/library.sh; \
set +x; \
install_script /usr/local/etc/nc-nextcloud.sh; \
activate_script /usr/local/etc/nc-nextcloud.sh; \
mv /var/www/nextcloud /data/app; \
ln -s /data/app /var/www/nextcloud; \
# package cleanup
apt-get autoremove -y; \
@ -31,14 +33,4 @@ rm -f /var/log/alternatives.log /var/log/apt/*; \
apt-get purge -y wget ca-certificates; \
rm /usr/local/etc/nc-nextcloud.sh
# TODO install make in noip:
# TODO consider pre-populating /data (volume overcopies)
# TODO call cleanup() hooks for extras
# TODO remove packages unneeded from lamp, wget...
# # libudev1 util-linux
# TODO remove mariadb client (reinstall mysqldump later, but that only)
# apt-get purge -y wget ca-certificates libhogweed4 libnettle4 libpsl5
# apt-get purge -y wget ca-certificates libgnutls-deb0-28 libhogweed2 libicu52 libnettle4 libpsl0
COPY docker/nextcloud/020-nextcloud-run.sh /etc/cont-init.d/
COPY docker/nextcloud/020-nextcloud-run.sh /etc/services.d/

View File

@ -1,25 +1,8 @@
#!/bin/bash
NCDIR=/var/www/nextcloud
OCC="$NCDIR/occ"
# INIT SYSTEM CONFIG (first run)
test -d /data/etc || {
echo "Setting up system dir..."
#mv /etc /data/etc
#ln -s /data/etc /etc
}
source /usr/local/etc/library.sh
# INIT NCP CONFIG (first run)
test -d /data/ncp || {
echo "Setting up ncp dir..."
mv /usr/local/etc/ /data/ncp
ln -s /data/ncp /usr/local/etc
}
# NC-INIT TODO copy all nextcloud folder?
# INIT DATABASE AND NEXTCLOUD CONFIG
#source /usr/local/etc/library.sh
#activate_script /usr/local/etc/nextcloudpi-config.d/nc-init.sh
persistent_cfg /usr/local/etc/nextcloudpi-config.d /data/ncp
exit 0

View File

@ -1,7 +1,4 @@
# docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v ncdata:/data --name nextcloudpi ownyourbits/nextcloudpi
# docker build . -f nextcloud.dockerfile -t ownyourbits/nextcloudpi:latest
FROM ownyourbits/nextcloudpi
FROM ownyourbits/nextcloud-x86
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>
@ -21,10 +18,54 @@ set +x; \
cd /usr/local/etc/; \
install_script nextcloudpi.sh; \
# fix default paths
sed -i 's|/media/USBdrive|/data/backups|' nextcloudpi-config.d/nc-backup.sh; \
# specific cleanup
rm /usr/local/etc/nextcloudpi.sh; \
apt-get purge -y wget ca-certificates; \
# letsencrypt build artifacts cleanup
apt-get purge -y \
make \
git \
augeas-lenses \
binutils \
cpp \
cpp-6 \
gcc \
gcc-6 \
libasan3 \
libaugeas0 \
libc-dev-bin \
libc6-dev \
libcc1-0 \
libcilkrts5 \
libexpat1-dev \
libffi-dev \
libgcc-6-dev \
libgomp1 \
libisl15 \
libitm1 \
liblsan0 \
libmpc3 \
libmpx2 \
libpython-dev \
libpython2.7-dev \
libquadmath0 \
libssl-dev \
libtsan0 \
libubsan0 \
linux-libc-dev \
python-dev \
python-virtualenv \
python2.7-dev \
python-pkg-resources \
python3-pkg-resources \
python3-virtualenv \
virtualenv \
python-pip-whl; \
# package clean up
apt-get autoremove -y; \
apt-get clean; \
@ -34,7 +75,7 @@ rm -rf /usr/share/doc/*; \
rm -f /var/log/alternatives.log /var/log/apt/*; \
rm /var/cache/debconf/*-old;
COPY docker/nextcloudpi/000-ncp-run.sh /etc/cont-init.d/
COPY docker/nextcloudpi/000-ncp-run.sh /etc/services.d/
# 4443 - ncp-web
EXPOSE 80 443 4443

View File

@ -1,7 +0,0 @@
#!/bin/bash
# Initial Trusted Domain
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
docker run -d -p 443:443 -p 80:80 -v ncdata:/data --name nextcloudpi ownyourbits/nextcloudpi $IP

View File

@ -141,16 +141,17 @@ function configure_script()
)
}
function persistent_cfgdir()
function persistent_cfg()
{
local SRCDIR="$1"
local DSTDIR="${2:-/data/etc/$SRCDIR}"
mkdir -p "$( basename "$DSTDIR" )"
test -d "$DSTDIR" || {
echo "Setting up $SRCDIR dir..."
mv /etc/"$SRCDIR" "$DSTDIR"
ln -s "$DSTDIR" /etc/"$SRCDIR"
local SRC="$1"
local DST="${2:-/data/etc/$( basename "$SRC" )}"
mkdir -p "$( dirname "$DST" )"
test -d "$DST" || {
echo "Making $SRC persistent ..."
mv "$SRC" "$DST"
}
rm -rf "$SRC"
ln -s "$DST" "$SRC"
}
# License

View File

@ -28,25 +28,25 @@ install()
update-rc.d dnsmasq disable
[[ "$DOCKERBUILD" == 1 ]] && {
cat > /etc/cont-init.d/100-dnsmasq-run.sh <<EOF
cat > /etc/services.d/100-dnsmasq-run.sh <<EOF
#!/bin/bash
source /usr/local/etc/library.sh
[[ "$1" == "stop" ]] && {
[[ "\$1" == "stop" ]] && {
echo "stopping dnsmasq..."
service dnsmasq stop
exit 0
}
persistent_cfgdir /etc/dnsmasq
persistent_cfg /etc/dnsmasq.conf
echo "Starting dnsmasq..."
service dnsmasq start
exit 0
EOF
chmod +x /etc/cont-init.d/100-dnsmasq-run.sh
chmod +x /etc/services.d/100-dnsmasq-run.sh
}
}

View File

@ -39,25 +39,25 @@ install()
rm -f /etc/fail2ban/jail.d/defaults-debian.conf
[[ "$DOCKERBUILD" == 1 ]] && {
cat > /etc/cont-init.d/100-fail2ban-run.sh <<EOF
cat > /etc/services.d/100-fail2ban-run.sh <<EOF
#!/bin/bash
source /usr/local/etc/library.sh
[[ "$1" == "stop" ]] && {
[[ "\$1" == "stop" ]] && {
echo "stopping fail2ban..."
service fail2ban stop
exit 0
}
persistent_cfgdir /etc/fail2ban
persistent_cfg /etc/fail2ban
echo "Starting fail2ban..."
service fail2ban start
exit 0
EOF
chmod +x /etc/cont-init.d/100-fail2ban-run.sh
chmod +x /etc/services.d/100-fail2ban-run.sh
}
# tweak fail2ban email

View File

@ -36,19 +36,21 @@ is_active()
install()
{
cd /etc || return 1
apt-get update
apt-get install --no-install-recommends -y python2.7-minimal
git clone https://github.com/letsencrypt/letsencrypt
/etc/letsencrypt/letsencrypt-auto --help # do not actually run certbot, only install packages
[[ "$DOCKERBUILD" == 1 ]] && {
cat > /etc/cont-init.d/100-letsencrypt-run.sh <<EOF
cat > /etc/services.d/100-letsencrypt-run.sh <<EOF
#!/bin/bash
source /usr/local/etc/library.sh
persistent_cfgdir /etc/letsencrypt
persistent_cfg /etc/letsencrypt
exit 0
EOF
chmod +x /etc/cont-init.d/100-letsencrypt-run.sh
chmod +x /etc/services.d/100-letsencrypt-run.sh
}
}

View File

@ -41,7 +41,7 @@ install()
# Optional packets for Nextcloud and Apps
apt-get update
$APTINSTALL -o "Dpkg::Options::=--force-confold" php-smbclient
$APTINSTALL postfix
$APTINSTALL postfix lbzip2 iputils-ping
}
configure()

View File

@ -61,25 +61,25 @@ EOF
mkdir -p /usr/local/etc/noip2
[[ "$DOCKERBUILD" == 1 ]] && {
cat > /etc/cont-init.d/100-noip-run.sh <<EOF
cat > /etc/services.d/100-noip-run.sh <<EOF
#!/bin/bash
source /usr/local/etc/library.sh
[[ "$1" == "stop" ]] && {
[[ "\$1" == "stop" ]] && {
echo "stopping noip..."
service noip2 stop
exit 0
}
persistent_cfgdir /usr/local/etc/noip2 /data/etc/noip2
persistent_cfg /usr/local/etc/noip2 /data/etc/noip2
echo "Starting noip..."
service noip2 start
exit 0
EOF
chmod +x /etc/cont-init.d/100-noip-run.sh
chmod +x /etc/services.d/100-noip-run.sh
}
}

View File

@ -31,7 +31,6 @@ install()
$APTINSTALL apt-utils
$APTINSTALL cron
$APTINSTALL util-linux # TODO only need getopt (busybox?)
$APTINSTALL apache2
$APTINSTALL php7.0 php7.0-curl php7.0-gd php7.0-fpm php7.0-cli php7.0-opcache php7.0-mbstring php7.0-xml php7.0-zip php7.0-APC php7.0-fileinfo php7.0-mcrypt
mkdir -p /run/php

View File

@ -28,9 +28,9 @@ install()
# NEXTCLOUDPI-CONFIG
##########################################
apt-get update
$APTINSTALL dialog
$APTINSTALL dialog whiptail
mkdir -p $CONFDIR
[[ "$DOCKERBUILD" != 1 ]] && {
test -f /usr/bin/raspi-config && {
sed -i '/Change User Password/i"0 NextCloudPi Configuration" "Configuration of NextCloudPi" \\\\' /usr/bin/raspi-config
sed -i '/1\\\\ \*) do_change_pass ;;/i0\\\\ *) nextcloudpi-config ;;' /usr/bin/raspi-config
}
@ -74,6 +74,7 @@ Listen 4443
Require host localhost
Require local
Require ip 192.168
Require ip 172
Require ip 10
</RequireAny>

View File

@ -24,13 +24,20 @@ nc-nextcloud.sh
nc-init.sh
"
# need to be fixed for this
EXCL_DOCKER+="
nc-webui.sh
dnsmasq.sh
fail2ban.sh
"
# better use a designated container
EXCL_DOCKER+="
samba.sh
NFS.sh
"
# TODO review systemd timers
# use systemd timers
EXCL_DOCKER+="
nc-notify-updates.sh
nc-scan-auto.sh
@ -220,6 +227,8 @@ EOF
grep -q TimeOut /etc/apache2/sites-enabled/ncp.conf || \
sed -i '/SSLCertificateKeyFile/aTimeOut 172800' /etc/apache2/sites-enabled/ncp.conf
# relocate noip2 config
mkdir -p /usr/local/etc/noip2
}
# License