Update private plugin without rebuilding the application

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?

1 Like

The first thing I would do here is split it into 2 containers, one data and one web.

That way you can bootstrap a new web container while the site is running.

Not against making /admin/upgrade smarter, feel free to send through a PR in that department.

4 Likes

It means I will have to spawn another container. Update the other one, and then close this container?

You are talking something like this?

That topic is a bit confusing.

To do a “seamless rebuild” it would be something along the lines of:

./launcher bootstrap web
./launcher destroy web
./launcher start web

Provided web is somewhat like: https://github.com/discourse/discourse_docker/blob/master/samples/web_only.yml

7 Likes

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.

3 Likes

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

  1. Using ssh way ie git@bitbucket.org:<accountname>/<reponame>.git and pulling from bitbucket ( this is giving me error “host key verification failed”)
  2. 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
1 Like