Skip to content

Commit

Permalink
docker: change location of the nextcloud folder
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jan 17, 2019
1 parent 84ac075 commit bab2d22
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
10 changes: 5 additions & 5 deletions docker-armhf/nextcloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ source /usr/local/etc/library.sh; \
set +x; \
install_app /nc-nextcloud.sh; \
run_app_unsafe /nc-nextcloud.sh; \
mv /var/www/nextcloud /data-ro/app; \
ln -s /data-ro/app /var/www/nextcloud; \
mv /var/www/nextcloud /data-ro/nextcloud; \
ln -s /data-ro/nextcloud /var/www/nextcloud; \

# stop mysqld
mysqladmin -u root shutdown; \
Expand All @@ -46,7 +46,7 @@ COPY docker-common/nextcloud/020nextcloud /etc/services-enabled.d/
COPY bin/ncp-provisioning.sh /usr/local/bin/

# display message until first run initialization is complete
COPY docker-common/nextcloud/ncp-wait-msg.html /data-ro/app
COPY docker-common/nextcloud/ncp-wait-msg.html /data-ro/nextcloud
RUN \
mv /data-ro/app/index.php /; \
mv /data-ro/app/ncp-wait-msg.html /data-ro/app/index.php;
mv /data-ro/nextcloud/index.php /; \
mv /data-ro/nextcloud/ncp-wait-msg.html /data-ro/nextcloud/index.php;
10 changes: 5 additions & 5 deletions docker-common/nextcloud/020nextcloud
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -e

# we want to work in the volume version of the code
rm /var/www/nextcloud
ln -s /data/app /var/www/nextcloud
ln -s /data/nextcloud /var/www/nextcloud

echo "Starting Redis"
sed -i 's|^requirepass .*|requirepass default|' /etc/redis/redis.conf
Expand All @@ -33,16 +33,16 @@ echo "Starting Postfix"
postfix start

# INIT DATABASE AND NEXTCLOUD CONFIG (first run)
test -f /data/app/config/config.php || {
test -f /data/nextcloud/config/config.php || {
echo "Uninitialized instance, running nc-init..."
source /usr/local/etc/library.sh
run_app_unsafe /nc-init.sh
mv /index.php /var/www/nextcloud/ # restore this file after init
}

# Better do real provisioning at the end, as it can restart PHP asynchronously
sed -i "s|'password'.*|'password' => 'default',|" /data/app/config/config.php
sed -i "s|'dbpassword' =>.*|'dbpassword' => 'default',|" /data/app/config/config.php
sed -i "s|'password'.*|'password' => 'default',|" /data/nextcloud/config/config.php
sed -i "s|'dbpassword' =>.*|'dbpassword' => 'default',|" /data/nextcloud/config/config.php
echo -e "[client]\npassword=default" > /root/.my.cnf
chmod 600 /root/.my.cnf
DBPASSWD=default
Expand All @@ -69,6 +69,6 @@ echo "Provisioning"
bash /usr/local/bin/ncp-provisioning.sh

# Display NC logs in the docker logs
tail -f -n0 /data/app/data/nextcloud.log &
tail -f -n0 /data/nextcloud/data/nextcloud.log &

exit 0
10 changes: 5 additions & 5 deletions docker/nextcloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ source /usr/local/etc/library.sh; \
set +x; \
install_app /nc-nextcloud.sh; \
run_app_unsafe /nc-nextcloud.sh; \
mv /var/www/nextcloud /data-ro/app; \
ln -s /data-ro/app /var/www/nextcloud; \
mv /var/www/nextcloud /data-ro/nextcloud; \
ln -s /data-ro/nextcloud /var/www/nextcloud; \

# stop mysqld
mysqladmin -u root shutdown; \
Expand All @@ -46,7 +46,7 @@ COPY docker-common/nextcloud/020nextcloud /etc/services-enabled.d/
COPY bin/ncp-provisioning.sh /usr/local/bin/

# display message until first run initialization is complete
COPY docker-common/nextcloud/ncp-wait-msg.html /data-ro/app
COPY docker-common/nextcloud/ncp-wait-msg.html /data-ro/nextcloud
RUN \
mv /data-ro/app/index.php /; \
mv /data-ro/app/ncp-wait-msg.html /data-ro/app/index.php;
mv /data-ro/nextcloud/index.php /; \
mv /data-ro/nextcloud/ncp-wait-msg.html /data-ro/nextcloud/index.php;
9 changes: 6 additions & 3 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,18 @@ cp -r ncp-app /var/www/

# docker images only
[[ -f /.docker-image ]] && {

# fix dirs
[[ -d /data/app ]] && {
ncc config:system:set datadirectory --value="/data/nextcloud/data"
[[ -d /data/nextcloud ]] && mv /data/nextcloud /data/nextcloud-old
mv /data/app /data/nextcloud && \
rm -f /var/www/nextcloud && \
ln -s /data/nextcloud /var/www/nextcloud
}

# re-enable automount
is_active_app nc-automount && run_app nc-automount
:
}

Expand Down Expand Up @@ -245,9 +251,6 @@ cp -r ncp-app /var/www/
</Directory>
EOF

# re-enable automount
is_active_app nc-automount && run_app nc-automount

# update nc-backup
install_app nc-backup
install_app nc-restore
Expand Down

0 comments on commit bab2d22

Please sign in to comment.