How to deploy files of a folder into another one? Follow
My problem is simple, I have a project, and in this project:
- There is a project/js folder, with plenty of js files
- There is a project/js-prod folder, with plenty of js files, but minified
- I have, for the concerned project instance, two deployment instances: staging and prod.
- Into staging, I want to deploy js, so I have set, for the staging deployment server: added project/js-prod to local excluded paths
- Into prod, I want to deploy js-prod, but as js, so I have set, for the prod deployment server: added project/js to local excluded paths, added path mapping of local project/js-prod to server/project/js.
The problem: When I deploy to prod, I seemingly deploy js-prod twice, once into server/project/js; and once into server/project/js-prod. What am I missing?
Please sign in to leave a comment.
Is this the wrong place to post this kind of question?
No. This is the right place for this kind of questions. I'm surprised that you had no answer here yet.
Regarding your issue: I normally either have minified files next to sources, just with .min part (e.g. .min.js etc) or selecting the right path based on a switch when rendering the view (i.e. script('path/to/script') that then decides what file to use, adds version/hash info query string etc etc))
With your setup/approach (should have really tested it first before giving these advices...):
A few questions though (as it may work OK in one setup and not work in another):
Cheers for your response and hints. Yes, the fact that I wasn't getting any answer made me think that I posted in the wrong forum. Regarding your questions:
Another difference I've noticed: In the Mappings configuration for staging, I have a single path mapping:
Local path: path/to/local/staging/project
Deployment path: /
Web path: /
In the mappings configuration for prod, I have two specified path mappings:
Local path: path/to/local/prod/project
Deployment path: /
Web path: /
Local path: path/to/local/prod/project/js-prod
Deployment path: /server/project/js
Web path: (none specified)
Is the first provided mapping maybe the reason ? I mean, the path exclusions should still prevent the js-prod folder, situated within path/to/local/prod/project/js-prod from being deployed, even given the two path mappings above, no?
Try plain SFTP, not rsync. This might be a rsync integration issue / missed scenario.
Rather unlikely. The path exclusion should take care.
Having 2 paths mappings is quite common (for a different reason, but still):
This way the IDE will know that when accessing the ROOT/public/image.jpg it should be accessible via domain.com/image.jpg URL (as public is a website root folder). The above setup does not cause any issues. But it is different from yours .. hence it's hard for me to say anything specific...
P.S. See if you get a response from JetBrains folks. If none by Tuesday -- use the "Submit a Request" link at the top of this page to make a Support Request ticket where you can privately provide more info / logs / etc.
I have done some experiments with plain FTP deployment .. and "Deployment | Upload to XXX" seems to work fine for me regardless of where it was invoked: in a file to upload current file, or when selecting the whole folder (inc parent folder) in the Project View panel.
BUT it does not work if I use "Deployment | Sync with Deployed to XXX" -- the path mapping gets ignored here...
TTT was the folder to test (located in the project root)
And these are the exclusions and mappings:
Proof (deployment logging):
I'm on Windows and do not have rsync so cannot test how it will work there. Try with just "plain" SFTP and see if it will make any difference.
I've tried it after disabling rsynch, hende deployment via SFTP, via many different ways (keyboard shortcuts, "Upload To.."; and that seemed to do the trick. Hence this indeed seems to be an rsynch issue!
Guys, thank you for your activity and sorry for the lack of reaction from our side, we are bit understaffed at the moment and trying to recover.
In the meantime, I have tried to play around with "Excluded paths" on rsync-enabled connection but was not able to reproduce the issue, everything that is excluded is actually excluded from upload for me.
There is an old ticket with ignored exclusions on Windows machines:
According to the ticket details, it should be fixed already and, as I mentioned before, I was not able to reproduce it (I have a Windows client + Ubuntu SSH/Rsync server).
Just to confirm, what IDE version do you have?
Thanks for your reply; I'm using PHPStorm 2022.1.4, Build #PS-221.6008.16, built on July 20, 2022, on a MacBook Pro (Retina, 13-inch, Early 2015), using macOS Monterey 12.5.1; does that help you?
Thank you for the update.
Even though the aforementioned issue seems to be fixed in earlier version, I was wondering if you could update to the most recent stable build (2022.3.2) and check if it is still reproducible for you there.
With PhpStorm 2022.3.2; Build #PS-223.8617.59, built on January 30, 2023; the issue persists. Concretely:
Again, our path configs are:
Local Path Deployment Path Web Path
/local/project/path / /
Note that there's nothing specified for "Web Path" in the second line, leading to the warning "Web path is not specified for "local/project/path/to/js-prod"; but your docs state that this warning can be ignored.
Result: /local/project/path/to/js-prod gets deployed to /to/js-prod on the server, and /to/js on the server remains as before deployment.
Note that the EXCLUDED PATHS exclude some further files which must not be deployed, and that actually works. So I assume your issue comes from combining all a path mapping, an excluded path, an rsynch uploads using SFTP for two concerned folders (js-prod and js, here). Like this, you may be able to test it. Please keep us posted, as this is a crucial part of our deployment procedures. If we're supposed to use it, we have to be able to rely on it.
How long will it take to fix this? For now we'll try it out via SFTP and turn off rsynch, but this makes the deployments a lot slower. Using rsynch is not an option for now, as its deployments seem to be unreliable when it comes to excluded paths... Any idea by which configs etc. these problems could be caused?
I have tried to reproduce it again but still no luck.
Here is the local structure (I am on Windows):
Here are my mappings:
And upload result (nothing from "to/js-prod" is uploaded):
Rsync is on:
What am I missing?
Would it be possible to share a sample project with the needed file structure and configured deployment ("visible for this project", leave a dummy SSH config, I will replace it my server), so I could try it on my setup?