What is the importance of creating symlink & how to create it in EngineYard

880 views Asked by At

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!

2

There are 2 answers

0
Chris Wise On

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:

run "ln -nfs #{shared_path}/config/some_config.yml #{release_path}/config/some_config.yml"

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

0
bricker On

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):

ln -s /application/releases/10102011011029/public /application/current

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.