sandstorm-io / sandstorm

Sandstorm is a self-hostable web productivity suite. It's implemented as a security-hardened web app package manager.
https://sandstorm.io
Other
6.74k stars 707 forks source link

Feature request: Provide a way to re-download apps in /opt/sandstorm/var/sandstorm/apps from app market, if local copy becomes corrupted #1808

Open memento opened 8 years ago

memento commented 8 years ago

Hey guys, do you plan to implement to create an option to allow user to redownload an app when the existing app gets corrupted. It could be great because for now, the only way to (really) redownload an app is to erase every child grain. Apps corruption can happen when you move your sandstorm instance from a server to another...

Until then, can you give us a workaround ?

Happy coding !

-another coder-

paulproteus commented 8 years ago

If you want to manually re-extract a Sandstorm package, you can do it with:

spk unpack filename.spk

You might have to fiddle with "cd" etc., but maybe that can help you for now? Sorry that you had this issue. Once you've resolved it, I'd like to know more about how you did your server move, and if there's anything Sandstorm could have done to help avoid this problem.

memento commented 8 years ago

Please, correct me if I'm wrong : I guess the filename.spk is the file that's downloaded when you get to the market place and you click on the install button.

For example, for wordpress, the link is

https://myserver.sandcats.io/install/8cafc7406e41116f33774136e4d02446?url=https://app-index.sandstorm.io/packages/8cafc7406e41116f33774136e4d02446

So the file downloaded is 8cafc7406e41116f33774136e4d02446 (with no extension)

Can I deduce that the filename.spk is the file named 8cafc7406e41116f33774136e4d02446 that I can download manually by doing a

wget https://app-index.sandstorm.io/packages/8cafc7406e41116f33774136e4d02446

Actually I'm quite the documentation guy type so I'll be _glad_ to write you a precise post/article regarding the issue and the way to solve it.

Best regards. Greetings from France.

memento commented 8 years ago

This ways seems to work, man !

My guess is it's possible to make a bash script that :

1 - we stop sandstorm and sandstorm service

2 - list the /opt/sandstorm/var/sandstorm/apps for directories and gets the list of names of the packages (we take only the directories names because we don't want the xxx.appid files)

3 - for each spk name, we do a wget of the corresponding package appending it to this command as a result :

wget https://app-index.sandstorm.io/packages/<name of the package>

Example : wget https://app-index.sandstorm.io/packages/8cafc7406e41116f33774136e4d02446

4 - Once the downloads are over, for each we rename it .spk AND we unpack it to this same directory ( /opt/sandstorm/var/sandstorm/apps ). At the end of each unpacking the console will return the id of the app. We take this id and put it in a new file : .appid

5 - Finally we start the sandstorm service again !

_This is only a workaround, of course , but this should work._

memento commented 8 years ago

It works !

_My script is available here_

Feel free to improve it.

Greetings from France

paulproteus commented 8 years ago

Thanks for filing this, and I'm glad you were able to solve your issue! I've retitled this for now, to indicate the request more clearly.

paulproteus commented 8 years ago

I admit the core team probably won't be able to prioritize working on this any time soon, but I'll leave this open in the hopes that if someone else runs into the problem, they can leave a comment here. If two people experience it would make it higher-priority for the core team to tackle. It would also be cool if someone felt like submitting a pull request!

ocdtrekkie commented 8 years ago

Does the app market contain all previous versions of apps that have been submitted to it?

paulproteus commented 8 years ago

I believe the package files are in fact kept, yes.