{"action":"created","issue":{"url":"https://api.github.com/repos/timkelty/shipit-shared/issues/7","labels_url":"https://api.github.com/repos/timkelty/shipit-shared/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/timkelty/shipit-shared/issues/7/comments","events_url":"https://api.github.com/repos/timkelty/shipit-shared/issues/7/events","html_url":"https://github.com/timkelty/shipit-shared/issues/7","id":63778504,"number":7,"title":"Symlink target issue","user":{"login":"tlartaud","id":494234,"avatar_url":"https://avatars.githubusercontent.com/u/494234?v=3","gravatar_id":"","url":"https://api.github.com/users/tlartaud","html_url":"https://github.com/tlartaud","followers_url":"https://api.github.com/users/tlartaud/followers","following_url":"https://api.github.com/users/tlartaud/following{/other_user}","gists_url":"https://api.github.com/users/tlartaud/gists{/gist_id}","starred_url":"https://api.github.com/users/tlartaud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlartaud/subscriptions","organizations_url":"https://api.github.com/users/tlartaud/orgs","repos_url":"https://api.github.com/users/tlartaud/repos","events_url":"https://api.github.com/users/tlartaud/events{/privacy}","received_events_url":"https://api.github.com/users/tlartaud/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2015-03-23T17:12:48Z","updated_at":"2015-04-16T13:57:52Z","closed_at":null,"body":"Hi there,\r\n\r\nThank you for for your node. its usefull.\r\n\r\nI'm using some Chrooted environments on my remote, so my deploy user, and apache, use different root paths. shipit-shared us the \"deployTo\" path which is for the deploy user. The apache user may have some really different rights on some servers configurations.\r\n\r\nIs there a way to allow shipit-shared to use symlinks on files as this :\r\n```ln -s ../../shared/.env .env```\r\nreplacing `shared` by `grunt.shipit.config.shared.baseDir`\r\n\r\ninstead of \r\n```ln -s /httpdocs/shared/.env .env```\r\n\r\nThank you by advance"},"comment":{"url":"https://api.github.com/repos/timkelty/shipit-shared/issues/comments/93740797","html_url":"https://github.com/timkelty/shipit-shared/issues/7#issuecomment-93740797","issue_url":"https://api.github.com/repos/timkelty/shipit-shared/issues/7","id":93740797,"user":{"login":"tlartaud","id":494234,"avatar_url":"https://avatars.githubusercontent.com/u/494234?v=3","gravatar_id":"","url":"https://api.github.com/users/tlartaud","html_url":"https://github.com/tlartaud","followers_url":"https://api.github.com/users/tlartaud/followers","following_url":"https://api.github.com/users/tlartaud/following{/other_user}","gists_url":"https://api.github.com/users/tlartaud/gists{/gist_id}","starred_url":"https://api.github.com/users/tlartaud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlartaud/subscriptions","organizations_url":"https://api.github.com/users/tlartaud/orgs","repos_url":"https://api.github.com/users/tlartaud/repos","events_url":"https://api.github.com/users/tlartaud/events{/privacy}","received_events_url":"https://api.github.com/users/tlartaud/received_events","type":"User","site_admin":false},"created_at":"2015-04-16T13:57:52Z","updated_at":"2015-04-16T13:57:52Z","body":"Final solution tested and working for me. I changed link.js line 27 to 32 https://github.com/timkelty/shipit-shared/blob/issues/7-chroot/tasks/shared/link.js#L27 to this.\r\n```\r\n    return shipit.remote(\r\n      sprintf('if ( ! [ -h %(target)s ] ) || ( [ -h %(target)s ] && [ $(readlink -n %(target)s ) != %(source)s ] ); then if [ -e %(target)s ]; then rm -r %(target)s; fi; ln -s %(source)s %(target)s; fi', {\r\n        source: path.join(shipit.sharedSymlinkPath, filePath),\r\n        target: path.join(shipit.currentPath, filePath)\r\n      })\r\n    );\r\n```\r\nAnd in init.js\r\n```\r\nshipit.sharedSymlinkPath = path.join( shipit.config.shared.symlinkPath, shipit.sharedPath) || shipit.sharedPath;\r\n```\r\n\r\nAnd you can replace all\r\n```\r\nlink(path,true);\r\nlink(path,false);\r\n```\r\nby\r\n```\r\nlink(path);\r\n```\r\n\r\nAlternatively, you can choose to not join paths in init.js, but you should warn users that they need to add the correct value in each environnments, like this\r\n```\r\n{\r\n  \"options\": {\r\n    ...,\r\n    \"shared\": {\r\n      \"baseDir\": \"shared\",\r\n      \"dirs\": [\r\n        \"public/app/uploads\",\r\n        \"public/app/cache\",\r\n        \"public/app/wp-rocket-config\"\r\n      ],\r\n      \"files\": [\r\n        \".env\",\r\n        \"public/.htaccess\",\r\n        \"public/app/advanced-cache.php\"\r\n      ]\r\n    }\r\n  },\r\n\r\n  \"staging\": {\r\n    ...,\r\n    \"shared\": {\r\n      \"symlinkPath\": \"/var/www/vhosts/domain.com/staging.domain.com\"\r\n    }\r\n  },\r\n\r\n  \"production\": {\r\n    ...,\r\n    \"shared\": {\r\n      \"symlinkPath\": \"/var/www/vhosts/domain.com/httpdocs\"\r\n    }\r\n  }\r\n}\r\n```\r\nEverything is ok now\r\n```\r\nbash-4.3$ cd /staging.domain.com/current/public/app\r\nbash-4.3$ ls -al\r\ntotal 40\r\ndrwxrwxr-x  6 chrooted_user psacln 4096 Apr 16 13:55 .\r\ndrwxrwxr-x  4 chrooted_user psacln 4096 Apr 16 13:55 ..\r\nlrwxrwxrwx  1 chrooted_user psacln   96 Apr 16 13:55 advanced-cache.php -> /var/www/vhosts/domain.com/staging.domain.com/shared/public/app/advanced-cache.php\r\nlrwxrwxrwx  1 chrooted_user psacln   83 Apr 16 13:55 cache -> /var/www/vhosts/domain.com/staging.domain.com/shared/public/app/cache\r\ndrwxrwxr-x  2 chrooted_user psacln 4096 Apr 16 13:52 languages\r\ndrwxrwxr-x  2 chrooted_user psacln 4096 Apr 16 13:52 mu-plugins\r\ndrwxrwxr-x 22 chrooted_user psacln 4096 Apr 16 13:55 plugins\r\ndrwxrwxr-x  3 chrooted_user psacln 4096 Apr 16 13:52 themes\r\nlrwxrwxrwx  1 chrooted_user psacln   85 Apr 16 13:55 uploads -> /var/www/vhosts/domain.com/staging.domain.com/shared/public/app/uploads\r\nlrwxrwxrwx  1 chrooted_user psacln   94 Apr 16 13:55 wp-rocket-config -> /var/www/vhosts/domain.com/staging.domain.com/shared/public/app/wp-rocket-config\r\n```"}}