创建符号链接和符号链接的重要性是什么?如何在 EngineYard 中创建它
我的 Rails 应用程序位于 Engineyard 服务器上。
我需要为公用文件夹创建符号链接。
如何在engineyard服务器上创建符号链接?
我没有部署经验,所以我非常渴望知道符号链接和符号链接的重要性是什么。应该为哪个文件夹创建?
目前我正在使用我的暂存环境,我应该在代码中编写什么或创建一个文件,以便当我在生产中部署相同的代码时它应该自动创建符号链接。
谢谢!
My rails app is on engineyard server.
I need to create symlink for public folder.
How to create symlink on engineyard server?
I have no experience in deployment so i am very eager to know what is the importance of the symlink & for which folder it should be created?
Also currently i am using my staging environment what should i write in code or create a file so that it should create a symlink automatically when i deploy same code on production.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 EngineYard 上创建符号链接的正确方法是添加部署挂钩。您想要将 /deploy 目录添加到项目中并添加 before_symlink.rb 文件。
例如,如果我将配置文件放在共享目录 (/data/my_app/shared/config) 中,我可以添加一个部署挂钩来符号链接此文件。
文件的内容将如下所示:
#{shared_path } 变量指向您的应用程序共享目录,#{release_path} 是作为部署的一部分创建的当前版本。
更多信息请访问:http://docs。 engineyard.com/use-deploy-hooks-with-engine-yard-cloud.html
The proper way to create a symlink on EngineYard is to add deploy hooks. You want to add a /deploy directory to your project and add a before_symlink.rb file.
For example, if I put a configuration file in the shared directory (/data/my_app/shared/config), I can add a deploy hook to symlink this file in.
The contents of your file would look like this:
The #{shared_path} variable points to your apps shared directory and #{release_path} is the current release being created as part of the deploy.
More info can be found at: http://docs.engineyard.com/use-deploy-hooks-with-engine-yard-cloud.html
每当您部署时,都会自动创建符号链接。其目的是在多个部署中维护应用程序的相同路径。当您部署应用程序时,您应该创建一个指向最新版本的符号链接,如下所示(在 Unix 机器上):
第一个路径是 REAL 文件或目录。第二个路径是符号链接的路径和名称。现在,当您将某些内容指向 /application/current 时,它将处于最新版本中。
如果您使用 Capistrano,所有这些都会自动为您处理每当您部署时。
The symlink should get automatically created whenever you deploy. Its purpose is to maintain the same path to your application across multiple deployments. When you deploy your application, you should create a symlink to the latest release, like this (on a Unix machine):
The first path is the REAL file or directory. The second path is the path and name of the symlink. Now when you point something to /application/current, it will be in the latest release.
If you use Capistrano, all of this is taken care of for you automatically whenever you deploy.