Introduction
Hello, I have been running Nextcloud on a Raspberry Pi using docker-compose for a while. As I am still running version 19, I would like to upgrade to at least version 20. I tried to follow the instructions from here: GitHub - nextcloud/docker: ⛴ Docker image of Nextcloud
However, I am unable to upgrade. This is the first time I have an issue like this. I read other posts related to the upgrade from 19 to 20, so it looks like I am not alone, however none of them seemed to correspond to my particular error (if there is one, sorry for this duplicate post…).
I will provide more information below, but don’t hesitate to ask for more information if necessary
System information and versions
- Hardware: Raspberry Pi 3 Model B (or B+, I don’t remember exactly)
- OS: Raspbian GNU/Linux 9 (stretch)
- Docker version 19.03.15, build 99e3ed8919
- docker-compose version 1.26.0, build unknown
docker-compose.yml
Here is the docker-compose file I use to configure Nextcloud and the database:
version: '2'
volumes:
db:
driver: local
data:
driver: local
services:
db:
image: postgres:12.3-alpine
mem_limit: 100m
memswap_limit: 50m
volumes:
- db:/var/lib/postgresql/data
env_file:
- db.env
networks:
- internal
app:
image: nextcloud:19.0.1-apache # I changed this to 'nextcloud:20.0.14-apache'
mem_limit: 500m
memswap_limit: 500m
hostname: <MY HOSTNAME>
depends_on:
- db
env_file:
- db.env
- app.env
networks:
- web
- internal
ports:
- 8080:80
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:<MY HOSTNAME>
- traefik.port=80
- traefik.docker.network=web
volumes:
- data:/var/www/html
- <MOUNT FOLDER PATH>/mpm_prefork.conf:/etc/apache2/mods-enabled/mpm_prefork.conf
networks:
web:
external: true
internal:
I use traefik (another container) to handle certificates for HTTPS connections.
mpm_prefork.conf
As you can see in the docker-compose file, I had to override mpm_prefork.conf
. The reason for that is that my Raspberry Pi cannot handle too many requests at once.
In case that might explain my issue, I provide this file here:
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 2
MaxSpareServers 2
MaxRequestWorkers 10
MaxConnectionsPerChild 0
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Steps which lead to the issue
sudo docker-compose down
- Change
nextcloud:19.0.1-apache
tonextcloud:20.0.14-apache
indocker-compose.yml
sudo docker-compose pull
sudo docker-compose up -d
-
sudo docker-compose logs -f
(see the logs of docker-compose below, the containerapp_1
crashes) -
sudo docker-compose start
to restartapp_1
. I see the same logs, butapp_1
does not crash this time. - Open the Nextcloud URL in my browser (error 500):
Internal Server Error
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.
The only way for me to have a working Nextcloud instance is to go back to the previous version by restoring the volumes. So I cannot upgrade.
docker-compose logs
Here are the detailed logs from sudo docker-compose logs -f
:
Attaching to nextcloud_app_1, nextcloud_db_1
db_1 |
db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1 |
db_1 | 2021-12-19 14:56:32.922 UTC [1] LOG: starting PostgreSQL 12.3 on arm-unknown-linux-musleabihf, compiled by gcc (Alpine 9.3.0) 9.3.0, 32-bit
db_1 | 2021-12-19 14:56:32.923 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2021-12-19 14:56:32.923 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2021-12-19 14:56:32.949 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2021-12-19 14:56:33.071 UTC [21] LOG: database system was shut down at 2021-12-19 14:47:32 UTC
app_1 | Initializing nextcloud 20.0.14.2 ...
app_1 | Upgrading nextcloud from 19.0.1.1 ...
db_1 | 2021-12-19 14:56:33.094 UTC [1] LOG: database system is ready to accept connections
app_1 | Initializing finished
db_1 | 2021-12-19 14:58:09.764 UTC [31] LOG: could not receive data from client: Connection reset by peer
app_1 | An unhandled exception has been thrown:
app_1 | Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] timeout expired in /var/www/html/lib/private/DB/Connection.php:72
app_1 | Stack trace:
app_1 | #0 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1449): OC\DB\Connection->connect()
app_1 | #1 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(892): Doctrine\DBAL\Connection->getWrappedConnection()
app_1 | #2 /var/www/html/lib/private/DB/Connection.php(202): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM "...', Array, Array, NULL)
app_1 | #3 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(206): OC\DB\Connection->executeQuery('SELECT * FROM "...', Array, Array)
app_1 | #4 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(248): Doctrine\DBAL\Query\QueryBuilder->execute()
app_1 | #5 /var/www/html/lib/private/AppConfig.php(345): OC\DB\QueryBuilder\QueryBuilder->execute()
app_1 | #6 /var/www/html/lib/private/AppConfig.php(110): OC\AppConfig->loadConfigValues()
app_1 | #7 /var/www/html/lib/private/AppConfig.php(301): OC\AppConfig->getApps()
app_1 | #8 /var/www/html/lib/private/legacy/OC_App.php(967): OC\AppConfig->getValues(false, 'installed_versi...')
app_1 | #9 /var/www/html/lib/private/Server.php(668): OC_App::getAppVersions()
app_1 | #10 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}(Object(OC\Server))
app_1 | #11 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
app_1 | #12 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OC\\Memcache\\Fac...')
app_1 | #13 /var/www/html/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query('OC\\Memcache\\Fac...', true)
app_1 | #14 /var/www/html/lib/private/Server.php(1688): OC\ServerContainer->query('OC\\Memcache\\Fac...')
app_1 | #15 /var/www/html/lib/private/Server.php(1028): OC\Server->getMemCacheFactory()
app_1 | #16 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}(Object(OC\Server))
app_1 | #17 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
app_1 | #18 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OCP\\Lock\\ILocki...')
app_1 | #19 /var/www/html/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query('OCP\\Lock\\ILocki...', true)
app_1 | #20 /var/www/html/lib/private/Server.php(1988): OC\ServerContainer->query('OCP\\Lock\\ILocki...')
app_1 | #21 /var/www/html/lib/private/Files/View.php(118): OC\Server->getLockingProvider()
app_1 | #22 /var/www/html/lib/private/Server.php(395): OC\Files\View->__construct()
app_1 | #23 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}(Object(OC\Server))
app_1 | #24 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
app_1 | #25 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OC\\Files\\Node\\H...')
app_1 | #26 /var/www/html/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query('OC\\Files\\Node\\H...', true)
app_1 | #27 /var/www/html/lib/private/Server.php(1335): OC\ServerContainer->query('OC\\Files\\Node\\H...')
app_1 | #28 /var/www/html/lib/base.php(595): OC\Server->boot()
app_1 | #29 /var/www/html/lib/base.php(1091): OC::init()
app_1 | #30 /var/www/html/console.php(49): require_once('/var/www/html/l...')
app_1 | #31 /var/www/html/occ(11): require_once('/var/www/html/c...')
app_1 | #32 {main}nextcloud_app_1 exited with code 1