docker-syspass
docker-syspass copied to clipboard
docker container upgrade 2.1 > 3.0.x fails
Hi,
i'm struggeling migrating a 2.1 docker container to 3.0.4 (on another host). Orientation according to https://doc.syspass.org/en/3.0/updating/v3.html, ignoring the installation steps, as the container should contain everything already.
What I did was:
- moved config.xml, key.pem and pubkey.pem to another host
- moved sql database to another host (mysqldump)
- ran syspass-only docker container with volumes taken from https://raw.githubusercontent.com/nuxsmin/docker-syspass/master/docker-compose.yml (config is in correct subfolder
sysPass/app/config/config.xml
now!) - modified permission for the files to
www-data:user
(according to the other files and apache process within docker file) - modified database sections in config.xml to point to new database
- checked for
<upgradeKey></upgradeKey>
, which was EMPTY in my config.xml
When accessing the page I receive the error in browser: Host has sent invalid response. ERR_RESPONSE_HEADERS_MULTIPLE_LOCATION
Checking the logs I find a lot of these "Context not initialized" exceptions, assuming they are not relevant:
[...]
019-02-08 13:03:29 [EXCEPTION] [N/A] Context not initialized
#0 /var/www/html/sysPass/lib/SP/Core/Context/ContextBase.php(143): SP\Core\Context\ContextBase->checkContext()
#1 /var/www/html/sysPass/lib/SP/Core/Context/SessionContext.php(100): SP\Core\Context\ContextBase->getContextKey('locale', NULL)
#2 /var/www/html/sysPass/lib/SP/Core/Context/SessionContext.php(392): SP\Core\Context\SessionContext->getContextKey('locale')
#3 /var/www/html/sysPass/lib/SP/Core/Language.php(222): SP\Core\Context\SessionContext->getLocale()
#4 /var/www/html/sysPass/lib/SP/Providers/Log/FileLogHandler.php(112): SP\Core\Language->unsetAppLocales()
#5 /var/www/html/sysPass/lib/SP/Core/Events/EventDispatcherBase.php(121): SP\Providers\Log\FileLogHandler->updateEvent('upgrade.config....', Object(SP\Core\Events\Event))
#6 /var/www/html/sysPass/lib/SP/Services/Upgrade/UpgradeConfigService.php(222): SP\Core\Events\EventDispatcherBase->notifyEvent('upgrade.config....', Object(SP\Core\Events\Event))
#7 /var/www/html/sysPass/lib/SP/Bootstrap.php(415): SP\Services\Upgrade\UpgradeConfigService->upgrade('217.17042101', Object(SP\Config\ConfigData))
#8 /var/www/html/sysPass/lib/SP/Bootstrap.php(389): SP\Bootstrap->checkConfigVersion()
#9 /var/www/html/sysPass/lib/SP/Bootstrap.php(292): SP\Bootstrap->initConfig()
#10 /var/www/html/sysPass/lib/SP/Bootstrap.php(223): SP\Bootstrap->initializeCommon()
#11 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#12 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(886): call_user_func(Object(Closure), Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#13 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route), Object(Klein\DataCollection\RouteCollection), Array)
#14 /var/www/html/sysPass/lib/SP/Bootstrap.php(456): Klein\Klein->dispatch(Object(Klein\Request))
#15 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap::run(Object(DI\Container))
#16 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')
#17 {main}
2019-02-08 13:03:29 [ERROR] [SP\Core\Language::setLocales] Could not set locale
[...]
Then it complains not being able to access the config.xml. Permissions are correct, and after the http request the file has been wiped (0 bytes), so it absolutely had write access to it:
[...]
2019-02-08 13:03:29 [EXCEPTION] [N/A] Unable to read/write file (/var/www/html/sysPass/app/config/config.xml)
#0 /var/www/html/sysPass/lib/SP/Storage/File/XmlHandler.php(80): SP\Storage\File\FileHandler->getFileSize(true)
#1 /var/www/html/sysPass/lib/SP/Config/Config.php(165): SP\Storage\File\XmlHandler->load('config')
#2 /var/www/html/sysPass/lib/SP/Config/Config.php(253): SP\Config\Config->loadConfigFromFile()
#3 /var/www/html/sysPass/app/modules/web/Init.php(155): SP\Config\Config->loadConfig(true)
#4 /var/www/html/sysPass/lib/SP/Bootstrap.php(228): SP\Modules\Web\Init->initialize('index')
#5 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#6 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(886): call_user_func(Object(Closure), Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#7 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route), Object(Klein\DataCollection\RouteCollection), Array)
#8 /var/www/html/sysPass/lib/SP/Bootstrap.php(456): Klein\Klein->dispatch(Object(Klein\Request))
#9 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap::run(Object(DI\Container))
#10 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')
#11 {main}
2019-02-08 13:03:29 [INFO] [SP\Core\UI\Theme::saveIcons] Saved icons cache
[...]
Then it notices upgrade is needed, but fails to check the database:
[...]
2019-02-08 13:03:29 [ERROR] [SP\Modules\Web\Init::initialize] Upgrade needed
2019-02-08 13:03:29 [ERROR] [SP\Modules\Web\Init::initialize] Database checking error
2019-02-08 13:03:29 [EXCEPTION] [N/A] Response is locked
#0 /var/www/html/sysPass/vendor/klein/klein/src/Klein/AbstractResponse.php(211): Klein\AbstractResponse->requireUnlocked()
#1 /var/www/html/sysPass/vendor/klein/klein/src/Klein/AbstractResponse.php(523): Klein\AbstractResponse->code(302)
#2 /var/www/html/sysPass/app/modules/web/Init.php(213): Klein\AbstractResponse->redirect('index.php?r=err...')
#3 /var/www/html/sysPass/lib/SP/Bootstrap.php(228): SP\Modules\Web\Init->initialize('index')
#4 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#5 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(886): call_user_func(Object(Closure), Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#6 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route), Object(Klein\DataCollection\RouteCollection), Array)
#7 /var/www/html/sysPass/lib/SP/Bootstrap.php(456): Klein\Klein->dispatch(Object(Klein\Request))
#8 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap::run(Object(DI\Container))
#9 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')
#10 {main}
2019-02-08 13:03:29 [EXCEPTION] [N/A] Response is locked
#0 /var/www/html/sysPass/vendor/klein/klein/src/Klein/AbstractResponse.php(157): Klein\AbstractResponse->requireUnlocked()
#1 /var/www/html/sysPass/lib/SP/Bootstrap.php(145): Klein\AbstractResponse->body('Response is loc...')
#2 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Klein), 'Response is loc...', 'Klein\\Exception...', Object(Klein\Exceptions\LockedResponseException))
#3 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(936): call_user_func(Object(Closure), Object(Klein\Klein), 'Response is loc...', 'Klein\\Exception...', Object(Klein\Exceptions\LockedResponseException))
#4 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(645): Klein\Klein->error(Object(Klein\Exceptions\LockedResponseException))
#5 /var/www/html/sysPass/lib/SP/Bootstrap.php(456): Klein\Klein->dispatch(Object(Klein\Request))
#6 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap::run(Object(DI\Container))
#7 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')
#8 {main}
And that's where I end up currently. Any clue what's happening here?
- Why is the config.xml being cleared? (although error shows not being able to access it?)
- Why it can detect an upgrade to the db is needed, when it cleared the config.xml before?
- What's behind the "Database checking error"?
- Why is my upgradeKey emtpy?
Hello, it's a weird issue:
Why is the config.xml being cleared? (although error shows not being able to access it?)
It shouldn't be cleared.
Why it can detect an upgrade to the db is needed, when it cleared the config.xml before?
Because the database contains a version parameter which would be used to check whether it needs to be upgraded (not needed when config is upgraded).
What's behind the "Database checking error"?
It means that the database tables aren't the expected for the current app version. This message shouldn't have been displayed since the upgrade process should have redirected to the upgrade page...
Why is my upgradeKey emtpy?
It should have set it when complained about Upgrade needed
Sorry, I can't figure out what is going on, it seems a permissions issue (not related to the files owner).
Regards
Hi,
I tried the other way exporting a backup from 2.1 and reimporting it to 3.0, but all the settings are missing afterwards and the group assignments are gone. Would be a pain to go through 500+ passwords and reassign everything.
I might install an intermediate syspass plain without docker to see if that works, maybe i can then use the docker container to read the then updated database without performing an upgrade. Will take some time though.
Thanks