How to deploy files from local folder /my/local/folder into /remote/destination ?

Answered

How do I have to setup the path mappings to deploy as mentioned in my question ? I currently use the following deployment configs, but this does not do as needed:

Path Mappings:

Local Path                               |     Deployment Path                |      Web Path 
---------------------------+------------------------------+------------------------------
/absolute/my/local/folder | /abs/remote/destination       |    /destination
---------------------------+------------------------------+------------------------------
/absolute                                | /                                                    | /

 

The result of this config is that the /absolute/my/local/folder gets deployed to /abs/my/local/folder, and the /abs/remote/destination contents remain unchanged. I'm deploying using ssh and rsynch, if that even matters, and the SSH connection properly works, no issues.

Help?

0
6 comments

Hi,

I remember seeing a report on a forum where exclusions did not work when “rsync” is enabled, so I wonder if we got something similar here. Does it work if you untick “rsync”?

0

I'll give it a try. So this means that the mapping above is correct? How do I avoid at the same time that 

/absolute/my/local/folder

gets deployed to

 /abs/remote/folder?

0

> So this means that the mapping above is correct?

At the quick glance, it is. However, I have not seen “Root path”. What path did you set there?

Here is a similar scenario that I have just tested:

 

0


How do I avoid at the same time that 

/absolute/my/local/folder

gets deployed to

 /abs/remote/folder?

Not sure if I got this point correctly though. Isn't that something that you need to achieve?

0

At the quick glance, it is. However, I have not seen “Root path”. What path did you set there?

The server's root path, and it works fine.

Not sure if I got this point correctly though. Isn't that something that you need to achieve?

Yes indeed, but only for the staging server / environment. In production, I have to prevent that deployment. I know found out with a few tests that excluding specific paths from deployment works both with and without rsynch enabled. But distinct path mapping (e.g. /absolute/projectroot/local/folder to /abs/remote/destination , as in this example), indeed fails when using rsynch (deploys /absolute/projectroot/local/folder to /absolute/serverroot/local/folder).

The solution we've set for now thus is the following:

  • If you have a distinct path mapping (local path from project root does not match deployed path on server root)
  • Create a deployment connection / config A, using rsynch, deploying every path except the distinct paths. Do not specify anything about them within the Mapping section of your deployment config, as this will not properly work using rsynch. But exclude them (the local paths) from deployment.
  • Duplicate the deployment connection / config created in the previous step to an additional config B, which is then only used for the distinct paths deployment, and not using rsynch. Delete all path exclusions, and specify all distinct path mappings within the Mappings section, and do not specify the root project path for deployment in the path mappings.
  • Whenever code unrelated to the paths of a distinct mapping are changed, deploy them using config A (hence via rsynch). Otherwise, deploy using config B (hence using regular ssh / sftp).

This seems to work as intended, hence two follow-up questions:

  1. If the paths specified in the mappings section are NOT the local project root, but only specific subfolders (e.g. /absolute/local/projectroot/my/sub/folder instead of /absolute/local/projectroot), is my assumption correct that this will exclusively deploy what's inside /absolute/local/projectroot/my/sub/folder, and ignore files / directories above the /absolute/local/projectroot/my/sub/folder, yes? And this will not change anytime soon with updates of the IDE? We would like to know this, as you can imagine, for the security of the integrity of our deployment cycles.
  2. Will this deployment issue with rsynch be corrected anytime soon?
  3. Do you have a better strategy than our workaround mentioned above?
  4. How can we create a backup of all IDE configs (including live templates + deployment configs) which can be imported into other IDEs?
0

Hi,

Thank you for your reply.

In the meantime, I have managed to reproduce this issue (at least, on Windows) and may confirm that multiple mappings are simply ignored when Rsync is enabled. Here is my brand new report about it:
https://youtrack.jetbrains.com/issue/WI-75333/Rsync-Additional-mappings-are-ignored

The first workaround that I may think of is to create several deployment configurations (even pointing to the same servers) each with its own single and precise granular mapping (to avoid the aforementioned issue). In theory, it should work.
 


How can we create a backup of all IDE configs (including live templates + deployment configs) which can be imported into other IDEs?

Deployment and SSH configurations can be saved with the project ("Visible for this project" option).
As for other settings, you may export/import these manually or share via the Settings Repository:
https://www.jetbrains.com/help/phpstorm/sharing-your-ide-settings.html

 

0

Please sign in to leave a comment.