I am currently migrating the snap proxy from snap-store-proxy to enterprise-store.
However its quite a mess. The documentation specified export commands work, except for the --export-yaml command. I needed to update the snap-store-proxy snap first for this command to work. So far so good.
The Offline Snap-store-proxy package created with store-admin --register --offline
only contains the snap-store-proxy snap, not the enterprise store snap. Thus I needed to manually import the enterprise-store snap before proceeding.
After installation, I tried to import the store config again. This is where the issue started:
sudo enterprise-store config --import-yaml proxy-config-backup.txt;
error: [Errno 2] No such file or directory: 'proxy-config-backup.txt'
## its literally there. in the same directory.
root@SnapStoreIn001:/opt/snapstore/installer/configBackup# ll
total 52
drwxr-x--- 2 root root 4096 Jul 3 11:06 ./
drwxr-x--- 6 root root 4096 Jul 4 17:00 ../
-rw------- 1 root root 61 Jul 3 11:06 proxy.auth.secret.txt
-rw------- 1 root root 17419 Jul 4 16:25 proxy-config-backup.txt
-rw------- 1 root root 61 Jul 3 11:06 proxy.device-auth.secret.txt
-rw------- 1 root root 4325 Jul 3 11:06 proxy.key.private.txt
-rw------- 1 root root 3243 Jul 3 11:06 proxy.tls.key.txt
-rw------- 1 root root 70 Jul 3 11:05 README.md
I tried with different notations using proxy-config-backup.txt, ./proxy-config-backup.txt even using the full path “/opt/snapstore/installer/configBackup/proxy-config-backup.txt”.
None worked. I then decided to try piping it in:
cat proxy-config-backup.txt | enterprise-store config --import-yaml
That worked, kind of. However it threw an error:
root@SnapStoreIn001:/opt/snapstore/installer/configBackup# cat proxy-config-backup.txt | enterprise-store config --import-yaml
error: permission denied to alter role
DETAIL: Only roles with the CREATEROLE attribute and the ADMIN option on role "packagereview" may alter this role.
Now I have no idea if the import was completed and this is a neglegable error, or if something of the configuration failed to be imported.
The next two import commands worked.
sudo enterprise-store config proxy.device-auth.secret=$(cat proxy.device-auth.secret.txt);
sudo enterprise-store config proxy.auth.secret=$(cat proxy.auth.secret.txt);
Then the next issue popped up:
sudo enterprise-store config proxy.key.private=$(cat proxy.key.private.txt);
error: Can't set a private key without a public key # I suspect it shouldve been imported previously with the proxy-config-backup.txt but wasnt.
# rerunning this command now brings the same database error:
root@SnapStoreIn001:/opt/snapstore/installer/configBackup# sudo enterprise-store config proxy.key.private=$(cat proxy.key.private.txt);
error: permission denied to alter role
DETAIL: Only roles with the CREATEROLE attribute and the ADMIN option on role "packagereview" may alter this role.
sudo enterprise-store config proxy.tls.key=$(cat proxy.tls.key.txt);
usage: snap-proxy [-h] [-d] COMMAND ...
snap-proxy: error: unrecognized arguments: -----END RSA PRIVATE KEY-----
# This one is really wild. What exactly is happening here?
Manually checking the proxy.tls.key with diff and the file I was able to confirm that they match. Yet this is weird. Now I have no idea if the migration actually worked or not.
Will maybe expand on how this migration went later.