-
Notifications
You must be signed in to change notification settings - Fork 17
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
rm -r if directory exists?! #17
Comments
I agree, seems a bit extreme. I'm open to a PR to change this, or I can try and look at it soon. |
I agree with that using rm -R is a bit destructive, but in fact, in some cases, we'll need it. Let's assume that a user already prepared his shared folder before publishing the first time. the target folder in shared folder will already exist, so the directory will not be copied to the shared folder because something there already exists, so the last option i see is to move the folder in the tmp folder, and to backup/move them somewhere instead of deleting. Personally, i don't see any problem about rm -R except if the user performed a misconfiguration, but i don't see exaclty how it could remove something since that everything that can be removed there comes from your git repository, so you wont lose any sensitive data in any case, only some datas that you have in your repository. So, I agree with the idea that rm -R is too much destructive/dangerous, but i don't agree with your actual solution about copying folder to shared folder ( plus : this is only usefull on the first deployment .. On the second publish, the dir will already exists in shared folder, so, you will need to move or delete it. No others choices. ) |
The following structures represent how i use, and how i think we should use symlinks. Let's assume we want to have an Local structure
Git structure (files inside uploads are gitignored)
Remote structure
When shipit-shared perform the Are you maybe using symlinks in a different way than me ? |
Plus : alternatively, you can actually add |
How hard it can be?:
Most common problem with rm -fr and first deployment: Next problem: README.md I can't see any of these word "remove", "rm -fr", "lost", "backup first". So if I have repository and after few months decide to move one folder with lot of files to "shared"... I WILL LOST ALL MY DATA! So this is a problem! Even stop deployment/trigger error is better option than rm -fr... How I can trust if you "don't see any problem" with deleting my files? Even with automated backups file uploaded 2 min ago will be lost permanently! I glad I found this before something terrible happened. |
Not hard, I just haven't had time, sorry. I'm open to PR, otherwise I'll try and do it this weekend. |
@zygis You also use Finally, your question is just related about the following feature request, not to delete |
Don't worry, i'm not shipit-shared author, you don't have to trust me ;) I'm just a shipit-shared user, and i'm just giving there my mind and advices about this subject. |
Can you explain more about this ? I personally don't need to publish twice. It's interesting me, can you pls explain in which case and why you'll need to publish twice ? |
@zygis @timkelty I think that something similar to that could solve the problem
json
What do you think ? |
Yes sorry, didn't noticed.
Just "shipit-npm" completes his job first, but after "shipit-shared" and this rm -fr problem node_modules folder is empty. This problem exist for the first deploy only. But if I have to deploy ~50 micro services to new server - it's pain in ass... Example above is ok, but most important is "smart defaults", or at least clear documentation :) |
I can't understand this sry.i don't get why you're talking about an empty node_modules folder :/ |
@tlartaud
At this state I can't start application. Why? Because node_modules folder is empty...
I have to do: shipit production deploy and then shipit production deploy restart |
@zygis nodes_modules in a shared folder ? Your app looks strange ^^ Tip : You should prefer using your apps like that way so you make sure that folders like node_modules are not accessible from the web without any other apache configuration.
(and point your web vhosts to current/public) Plus : Shipit-shared works like capistrano. the spirit is to build all the last release app or website, get everything compiled locally, and push the result on the remote. So normally, you don't even need to get your nodes_modules or grunt tasks online, on production server. In some cases, with some apps, it could be required to send grunt tasks online, but i think your doing something you could do locally more easily.. Then, why do you need to run grunt tasks on remote prior to first shipit-npm execution ? |
@zygis This is some example tasks to show you to bind event or do some actions locally or even remotely, when you need them.
Hope that helps. |
I don't use apache, and all my applications are REST only, not a single file aren't exposed to public...
You probably don't know how node.js applications work. node_modules folder contains all dependencies that included in a running application at runtime. Application can't work without dependencies. Theoretically you can run npm install on local side, and then upload to remote, but some of dependencies are using C modules and need to be compiled. Developer with windows definitely can't do that, because code will be compiled for wrong operating system. Same thing with go applications, dependencies should be on remote, and code should be build on that server where you want run application.
Yes :) But fixing unexpected behaviors (or creating issues like this one) is my preferred way :) Just right tools should work right. |
Sorry, I've been really busy and haven't had time to chime in, but I will try and get this addressed this week. And as always, PRs are welcome. |
Review all of this now...beginning to see the issue. @zygis I think the reason I haven't seen this come up before is I've never seen anyone put their Also, defining Having said that:
Furthermore, once I roll in this feature, you would be able to ensure that |
Yes.
Removing node_modules folder or changing it's contents usually is not a problem, because all modules required are already running on RAM, and usually doesn't need to hammer disk. Of course if you have dynamically loaded modules probably this could be issue, but my applications requiring all needed modules at startup. And I know what I am doing (or at least I think I know :) )
No. This problem exists only when using shared dirs.
Of course you can do that, but migrating lot of processes to new server is totally pain (few times migration was in ASAP mode, due some hardware problems). Other developers in a team can simply forget to do one or another action. It's no problem when you working alone and deploying max 1 time to 1 environment. My usage look like: 6 devs, 2 environments (testing, production), ~50 different repositories and average 5 deployments per developer per day. So building good shipit config file is time/bug saver for all my team. One of the main reason why I put node_modules folder to shared - build time. Some legacy applications have tons of dependencies, these dependencies have tons other dependencies. Some of these dependencies use C modules. Updating dependencies are MUCH faster than installing from scratch. I agree that my situation isn't very common, but I must find proper solution to this. |
Got it. We'll figure something out that works for you. I realize your solution pretty easily takes care of your use case, but I'm wary of fixing it that way just because that behavior seems just as unexpected to me.
Yes, but since |
@zygis what about something like this in your shipit config?
|
@timkelty since shipit-deploy:cleanup (last task) create the symlink from The following should work on the first remote deploy
|
That's right, thanks @tlartaud. |
@timkelty that said, i can't find any documentation on shitpit-deploy related to the
|
@timkelty great idea ! sounds good for me, with some little involves maybe ;)
|
@timkelty and instead of a prompt, it would be better i guess to have the configuration stored for each file association in the config array like all the others shipit-shared configs. So, the config can be stored in the repo for team mates. For example
and you can set Or, if you don't want to break your actual syntax
|
cool, do not hesitate to tell me if there is something you do not understand. |
@timkelty dude .. you are so damn slow .... |
Sorry man, been slammed with other work. |
Hi all, I've thought this through and while I see the benefit of doing things like backing up folders, moving, etc., I think it's overcomplicating what the task should be doing, and adding complexity for a potentially narrow use-case. The core of this issue was the unexpected and undocumented use of What I've come up with is published to 4.0: https://github.com/timkelty/shipit-shared/tree/master Essentially, I've added an Furthermore, there is now a @zygis' case of a shared
|
@timkelty Wow, this is soooo bad. I'm pretty sure you didn't test what i did. Have a good luck with it. |
Can you elaborate? That doesn't really help.
I did. I just didn't agree with the approach for solving this particular problem. The issue stated was that @zygis didn't expect his files in I'm not necessarily opposed to adding features to backup and move things around, but it seemed to me like it was going way beyond the scope of this original issue. I haven't heard a justified use-case from you for these features, and in fact, you argued against it:
The fact remains that @zygis' use of
That's your prerogative. Take your PR and use it, or write something yourself. |
With the latest update to shipit-npm, controlling the order of tasks is now easier:
|
If linked directory already exists with some files inside, best option delete all?! It's a terrible idea. Never happened before like this with capistrano. Why not copy folder content to ../shared/.. and then do remaining stuff?
The text was updated successfully, but these errors were encountered: