Updating snapcraft store proxy for new IP

I have been testing out the snap store proxy on my internal network, and recently redid my network to use a different addresses. I’m hoping I can update my snap store rather than destroying it and creating a new one. I was able to update the config on the snap with:

sudo snap-proxy config proxy.domain=NEW_IP

However, that doesn’t seem to be sufficient for getting snapd to actually talk to the proxy. I’m guessing it is because my assertion still is:

$ curl -s http://NEWIP/v2/auth/store/assertions
type: store
authority-id: canonical
...
timestamp: 2019-03-20T15:08:23.051646Z
url: http://OLDIP
...

I’m guessing I need some way to tell the snap-proxy to regenerate its assertions. sudo snap-proxy register doesn’t work because it has already been registered with the given identifier.

I was hoping that I could update the assertions, and then update the other devices on my network for their assertions. But do I need to just wipe the proxy (snap remove --purge?) and then start from scratch again?

It would be good if you could re-register without a complete reinstall. @twom @bloodearnest is that possible, and if not we should probably file an enhancement bug for that.

Hi,

Sorry for the slower reply, took a bit of time to validate what was going on.
It looks like this is impossible on the current release, so a reinstall will be your only resort there.

I’ve raised a ticket to work out why snap set snap-store-proxy internal.store.id=null doesn’t work, and to formalise that into a --reregister command.

Is there a reason you can’t use a domain/hostname for the registration that could then be moved to the new IP? We made the assumption that the proxy would be used like that, so wondering if there’s cases that we didn’t expect that would invalidate that.

Thanks for the report!

Thanks for investigating. As for using a DNS entry, I’m just doing this on my local network, which has probably only ever changed once, so it isn’t really something I need to set up a DNS server for. I just happened to buy new networking gear and the default IP ranges changed.

Can you confirm that the right path forward is to “snap remove --purge snap-store-proxy” and then following the install/setup instructions again.

Yep, for now, that looks like the only option.
Any overrides you’ve set should be maintained, assuming you reuse the same database.

I’ll post here when the reregister command lands.

Thanks