-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the CAN_INSTALL file when occ maintenance:install is complete #27492
Remove the CAN_INSTALL file when occ maintenance:install is complete #27492
Conversation
I came across this when creating a Kubernetes deployment for Nextcloud, with a batch job to perform the initial setup. I'd expected the CAN_INSTALL to be removed when the setup had completed, in the same manner as the web installer, so was using the presence of this file in an init container to delay the deployment of the frontend Apache container. Worked around this issue by delete the file in the batch job instead for now. |
Resolves #24301 |
Looks like a few of the CI tests failed due to git clone issues :( |
Good catch, would be good to also check the return value of unlink and log an error in case the file was not removed. |
@juliushaertl Would you class this enough of an error to return it in the error array from the install method in the Setup class, which would then be handled in the install command, returning with an exit code of 1 instead of 0 (core/Command/Maintenance/Install.php:109), or just log the fact it couldn't be removed? |
Little bit of a rework as the SetupController was calling the install method of the Setup class, so was duplicating the check to unlink the CAN_INSTALL file. Resolved that and added logging to the CLI command to output a warning that the file needs to be removed manually (matching the web installer). |
@cyclops8456 any update here? |
@cyclops8456 any update here? |
Would this be a solution to #18620 ? |
When occ maintenance:install is run from the CLI, the CAN_INSTALL in the config directory is left in place when installed is set to true, whereas this file is removed when the web installer is used. Removing this file in the CLI command maintains consistency between the two. This allows automation tools an easier way to determine if this process has been completed. Signed-off-by: Alex Harpin <development@landsofshadow.co.uk>
Move the check for the CAN_INSTALL file in the config directory to a method in the Setup class and remove the call to unlink from the SetupController as this in now handled in the Setup class. Signed-off-by: Alex Harpin <development@landsofshadow.co.uk>
Log a warning for the CLI install command if the CAN_INSTALL file still exists at the end of the installation. This matches the warning logged by the web installer. Signed-off-by: Alex Harpin <development@landsofshadow.co.uk>
Rename canInstallExists to shouldRemoveCanInstallFile to cover removal of this file for non-git channels and logging any failure to remove it. Add new method to detect if this file exists during web based installation. Signed-off-by: Alex Harpin <development@landsofshadow.co.uk>
5c3a37d
to
644df59
Compare
@szaimen @juliushaertl Returning to this MR after getting snowed under with other work and completely forgetting about it. I've rebased my branch against current master and have tested it locally for both web and CLI based installs and the CAN_INSTALL file is removed as expected in both cases now. This should mean that automated installs don't need to do this manually now, and I can remove it from my Kubernetes deployment config. |
failing CI likely unrelated |
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
When occ maintenance:install is run from the CLI, the CAN_INSTALL in the config directory is left in place when installed is set to true, whereas this file is removed when the web installer is used. Removing this file in the CLI command maintains consistency between the two. This allows automation tools an easier way to determine if this process has been completed.
Signed-off-by: Alex Harpin development@landsofshadow.co.uk