-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: Persistent data, update improvements #1372
Comments
Something for the List
Testing updates is quite easy, if they are in the main bucket. Some programs provide a default configuration (php, nginx) which should be copied to the |
I have to clarifya bit more, implementing travelling dirs would take place in the scoop update command. But testing modified manifests would take the install path, ignoring the already installed version. |
Directory junctions would work well for persistent data directories. This way apps don't have to be configured to use a special directory, they can just use their default. If we have a JSON manifest for NodeJS, e.g. {
...
"persist": "nodejs/node_modules"
...
} Then on install, we could copy anything in So the update steps would be:
So the old "persist" directory would end up with only the files that have been replaced in the new "persist" directory, and the new "persist" directory would have all the old contents, plus anything that came with the new install. To make it resilient to failure, we could allow for reversing this process by doing the reverse |
For testing updates, does |
|
@lukesampson I like your persist idea. It would be nice if it could be a file as well as a directory. So something like this would work: {
// ...
"persist": "php.ini"
// ...
} And it should also support multiple files/directories through an array |
Agreed @deevus 👍 |
You could hash
Then if I run
Going even furtherYou could even go as far as storing the original file so that if/when the user updates a persisted file, we can compare the original vs new and show a diff. |
That would be very nice to have, @deevus. Could we use |
Thanks for the inputs Persistent dataUsing conjunctions sounds great. I tested it with the mariadb database content and it works great! There is a config option As {
"persist": "nodejs/node_modules", # just one directory
"persist": "some_file.ini", # a files
"persist": ["some_dir", "some_other"], # multiple things
"persist": [ # custom name (like with `bin`)
["nodejs/node_modules", "customname"],
"other"
]
} We have already some code for travelling directories, can I remove it? Updating copied filesNice idea, I will keep that in mind but will not focus on that for the first version.
For some other apps it would be very useful to provide a custom configuration through scoop. |
Unfortunately conjunctions are causing problems, not every program likes them 😞 As example nodejs breaks, fails at
|
That's great that it works for MariaDB. I wonder if this error is not so much because of the directory junction, but because there are already files in the node_modules directory when There seem to be similar That's fine to delete the travelling dir code too. |
That seems to be a different problem. As soon I use a conjunction for the node_modules directory strange things start to happen. If I uninstall a global module ( If I update the global npm package I never had such problems with nodejs/npm without a conjunction. |
Oh okay. That's interesting. And disappointing. It would be a shame if we have to give up on junctions and go back to something like the old travelling directories. I don't know enough about junctions to give up yet. I'll do some investigation over the weekend. |
Yes, that would be sad. Me neither, but I heard on Linux some programs have problems too when you run them inside symlinks, but it can be fixed with hardlinks or directory mounts. I tested symlinks with admin permissions too, same errors. To reproduce you can either run |
I think I might have stumbled on a possible way to make junctions behave with NPM. Can you have a look at 4382206 and tell me if I'm tricking myself? With this change, NodeJS seems to install properly including the I changed a few lines to get it to work for me, but the key line is attrib $source +R /L This sets the read-only attribute on the directory junction and seems to make it behave better with NPM. I'm not really sure why it works. I only found this by accident by unticking the Read-only checkbox in the folder (directory junction) properties with Explorer, which seemed to remove all the file attributes. And then I found this page which pointed me towards Does this work for you? |
It works! Thanks 👍 I had to changed the npm prefix to install the binary links into the data directory else they would not survive an update. 912fbe8 Better ideas on how to add paths inside the data directory to PATH? |
Has anyone experience with python and pip? I can't figure out what needs to be persistent. @lukesampson I merged your commit and rebased my persist branch upon the current master branch. You are not longer able to merge your persist branch. If you want to make changes use my new persist branch. |
Thanks, I've removed my persist branch now. I don't know if this is a better alternative to what you have, but would it work to add If that works, it is probably still a good idea to use variable replacement in the Sorry to nitpick while you're still working, but I noticed varying terms for the persisted directories and the variables and functions that reference them, like persist, data and appdata. Could these be consistent, e.g. |
That won't work. The scripts are outside of the node_modules directory. With the default config they would be at the same level as the I think it would be useful if
No problem, I will change that. |
I changed |
Thanks. Looks good! Yes, ignore the Regarding What sort of move and copy actions did you have in mind for |
I am not sure if I understand you at the As example in the case of nodejs we initialize the global modules inside the persist directory and set a config variable to use that directory instead of a location inside the version directory. That makes the files inside the version directory obsolete (npm, npm.cmd and node_modules). |
Hi, as persistent data now merged, how about adding scoop start redis
# or
scoop run mysql |
@nueko I think that might be outside Scoop's scope (it's an installer, not a service manager). But if you want to start a separate issue we could discuss what might be involved. |
Currently, a file that doesn't exist in the apps directory after installation can't be made persistent. How should we deal with these cases? |
Ideally we would not try to persist the file on the first install if the file doesn't exist, but detect this situation on That's fairly complicated. If no one wants to implement it, I wouldn't mind leaving this situation as unsupported for now until we discover more examples. Maybe we could show a warning if the manifest tries to persist a file that doesn't exist, and stop the directory from being created incorrectly. |
Running into this same issue with Reference issue: ScoopInstaller/Extras#614 |
persist per architecture would be great too |
I want to start discussion about enhancing the update functionality solving multiple issues
Persistent data
Multiple solutions were suggested for this. Travelling directories moves data between versions, already partially implemented (not working).
A
backpack
/data
/conf
directory alongside theapps
directory.Travelling directories should be easy to implement but has very big problem. When an update fails you are required to uninstall the app and install it again, if that happens you will lose your data. (See last section)
Using a custom data directory may not be possible for all apps, the app must support changing the default directories. Could that work with conjunctions/symlinks?
We may have to implement both.
Any comments or ideas?
TODO
persist
schema.json
post_install
,env_set
etc.)travel_dir
partial implementationTo consider
Affected apps:
I would like to create a list of affected apps in this issue
Feature branch https://github.com/rrelmy/scoop/tree/persist
Development/testing problematic
Testing those update paths is currently not easy.
Installing updated manifests with
scoop install bucket/app.json
does not take the same code path asscoop update app
.Using
scoop update bucket/app.json
does not work.Prevent such updates through
scoop install
and make them work withscoop update
should be pretty straightforward.What do you think about that?
Resolved
Just us
./bin/scoop.sh1 update <app>
Update failuers
I never liked the fact that failures during updates force you to uninstall the app and reinstall it completely.
While generally looking at the update procedure I would like to check if there are some possible improvements.
For example try to download the update before uninstalling the current one would catch some basic errors.
Or if possible remove the shims just before the new ones are set.
The text was updated successfully, but these errors were encountered: