Update private plugin without rebuilding the application
The discussion revolves around updating a private plugin hosted on Bitbucket without rebuilding the Discourse application, which results in downtime.
The issue arises from the /admin/upgrade page checking for updates on GitHub, not Bitbucket, due to a hardcoded URL conversion in docker_manager/lib/docker_manager/git_repo.rb.
sam suggests splitting the application into two containers, one for data and one for web, to enable seamless rebuilds. net_deamon successfully implements this solution, separating the standalone instance into web and data containers.
However, net_deamon encounters another issue when trying to fix the plugin update process. The problem lies in the Host key verification failure when using SSH to connect to Bitbucket. Despite configuring the .ssh/config file and successfully running the upgrade command manually, the error persists when running from /admin/upgrade. net_deamon seeks guidance on how to proceed, considering two options:
Using SSH with the git@bitbucket.org URL, which currently fails due to Host key verification.
Using HTTPS with the https://<accountname>@bitbucket.org URL, which requires providing a username and password before upgrading.
The admin upgrade page /admin/upgrade checks with “github.com” for all the plugins.
If we have a private plugin (with bitbucket), then it does not check with bitbucket, but with github. And so the plugin is always shown as update to date with last commit id.
Due to this, in order to upgrade private plugin, I have to rebuild the app, which results in downtime.
I have followed this tutorial/thread to add link the plugin with bitbucket.
What do you guys do to update bitbucket/private plugins without rebuilding the app?
Thanks @sam , I was successfully able to seperate the standalone instance into web and data. It took me a bit of research to fully understand and implement it, but thanks for pointing me the right direction and link.
Hi @sam, I am now working on fixing the plugin. Needed some guidance.
The real problem lies here
In docker_manager/lib/docker_manager/git_repo.rb (54)
if url =~ /^git/
# hack so it works with git urls
url = "https://github.com/#{url.split(":")[1]}"
end
It converts the bitbucket url to github because bitbucket url starts with “git”
example : git@bitbucket.<account_name>/<plugin_name>.git
By adding a condition to check for bitbucket works ( and it detects the upgrade version too), but when I try to upgrade, it throws errror “Host key verification failed”
Then I came to know that it occurs because we remove the keys from .ssh folder in app.yml file for bitbucket.
But even if I let the ssh keys to be present inside docker container, and run the upgrade, I get the same error.
Here is the output of /.ssh/config file
Host bitbucket
StrictHostKeyChecking no
HostName bitbucket.org
IdentityFile /root/.ssh/id_rsa
I can successfully run the upgrade command inside docker container and upgrade the plugin myself, but it throws above error when running from /admin/upgrade.
I think it might be because the upgrader is not running as sudo user(correct me if I am wrong).
So can you give me some pointers, on how to proceed
Using ssh way ie git@bitbucket.org:<accountname>/<reponame>.git and pulling from bitbucket ( this is giving me error “host key verification failed”)
Using https way ie https://<accountname>@bitbucket.org/<accountname>/<reponame>.git, but I need to somehow provide password and username before upgrading. I think I can add textbox which asks for username and password before starting the upgrade