Skip to content

Commit

Permalink
docker: build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Sep 21, 2018
1 parent 9ee4282 commit 7a8c0e4
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 10 deletions.
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

[v0.59.17](https://github.com/nextcloud/nextcloudpi/commit/620be82) (2018-09-09) docker: fix letsencrypt not persistent
[v0.59.18](https://github.com/nextcloud/nextcloudpi/commit/fb7164e) (2018-09-20) docker: build fixes

[v0.59.17](https://github.com/nextcloud/nextcloudpi/commit/9ee4282) (2018-09-09) docker: fix letsencrypt not persistent

[v0.59.16](https://github.com/nextcloud/nextcloudpi/commit/7443425) (2018-09-09) docker: allow domains in command line, not only IPs

[v0.59.15](https://github.com/nextcloud/nextcloudpi/commit/41f21fa) (2018-09-17) Don't overwrite an existing mail_smtpmode, if it is not "PHP"

Expand Down
3 changes: 3 additions & 0 deletions docker-armhf/nextcloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ activate_script /nc-nextcloud.sh; \
mv /var/www/nextcloud /data-ro/app; \
ln -s /data-ro/app /var/www/nextcloud; \

# stop mysqld
mysqladmin -u root shutdown; \

# package cleanup
apt-get autoremove -y; \
apt-get clean; \
Expand Down
1 change: 1 addition & 0 deletions docker-armhf/nextcloudpi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ for script in *.sh; do cleanup_script $script; done; \
apt-get autoremove -y; \
apt-get clean; \
rm -f /var/lib/apt/lists/*; \
find /var/log -type f -exec rm {} \; ; \
rm -rf /usr/share/man/*; \
rm -rf /usr/share/doc/*; \
rm -f /var/log/alternatives.log /var/log/apt/*; \
Expand Down
18 changes: 11 additions & 7 deletions docker-common/nextcloud/020nextcloud
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ source /usr/local/etc/library.sh

set -e

NCDIR=/var/www/nextcloud
OCC="$NCDIR/occ"

[[ "$1" == "stop" ]] && {
echo "stopping Cron..."
killall cron
Expand All @@ -24,6 +21,7 @@ rm /var/www/nextcloud
ln -s /data/app /var/www/nextcloud

echo "Provisioning"
DB_PID="$( pidof mysqld )"
bash /usr/local/bin/ncp-provisioning.sh

echo "Starting Redis"
Expand All @@ -37,10 +35,16 @@ cron
echo "Starting Postfix"
postfix start


# INIT DATABASE AND NEXTCLOUD CONFIG (first run)
test -f /data/app/config/config.php || {
echo "Uninitialized instance, running nc-init..."

# mariaDB is restarted in the backgroud during provisioning
while kill -0 "$DB_PID" 2>/dev/null; do sleep 0.5; done
while :; do
[[ -S /run/mysqld/mysqld.sock ]] && break
sleep 0.5
done
source /usr/local/etc/library.sh
activate_script /nc-init.sh
mv /index.php /var/www/nextcloud/ # restore this file after init
Expand All @@ -49,11 +53,11 @@ test -f /data/app/config/config.php || {
# Trusted Domain ( local IP )
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )
IP=$( ip a show dev "$IFACE" | grep global | 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"
ncc config:system:set trusted_domains 1 --value="$IP"

# Trusted Domain ( as an argument )
[[ "$@" != "" ]] && \
sudo -u www-data php "$OCC" config:system:set trusted_domains 6 --value="$@"
[[ "$2" != "" ]] && \
ncc config:system:set trusted_domains 6 --value="$2"

# Display NC logs in the docker logs
tail -f -n0 /data/app/data/nextcloud.log &
Expand Down
3 changes: 3 additions & 0 deletions docker/nextcloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ activate_script /nc-nextcloud.sh; \
mv /var/www/nextcloud /data-ro/app; \
ln -s /data-ro/app /var/www/nextcloud; \

# stop mysqld
mysqladmin -u root shutdown; \

# package cleanup
apt-get autoremove -y; \
apt-get clean; \
Expand Down
1 change: 1 addition & 0 deletions docker/nextcloudpi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ for script in *.sh; do cleanup_script $script; done; \
apt-get autoremove -y; \
apt-get clean; \
rm -f /var/lib/apt/lists/*; \
find /var/log -type f -exec rm {} \; ; \
rm -rf /usr/share/man/*; \
rm -rf /usr/share/doc/*; \
rm -f /var/log/alternatives.log /var/log/apt/*; \
Expand Down
2 changes: 1 addition & 1 deletion etc/ncp-config.d/nc-limits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ configure()
[[ "$REDISMEM_" == "0" ]] && REDISMEM_=$AUTOMEM && echo "Using ${AUTOMEM}B for Redis"
[[ "$REDISMEM_" != "$CURRENT_REDIS_MEM" ]] && {
sed -i "s|maxmemory .*|maxmemory $REDISMEM_|" "$CONF"
service redis restart
service redis-server restart
}
}

Expand Down
3 changes: 2 additions & 1 deletion ncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ EOF
sed -i '$c127.0.1.1 nextcloudpi' /etc/hosts

## tag image
echo "NextCloudPi_$( date "+%m-%d-%y" )" > /usr/local/etc/ncp-baseimage
[[ -f /.docker-image ]] && local DOCKER_TAG="_docker"
echo "NextCloudPi${DOCKER_TAG}_$( date "+%m-%d-%y" )" > /usr/local/etc/ncp-baseimage

## SSH hardening
if [[ -f /etc/ssh/sshd_config ]]; then
Expand Down

0 comments on commit 7a8c0e4

Please sign in to comment.