Custom symlinks in Amazon Opsworks RoR application

Wojciech Ziniewicz
Stories imported from wordpress
1 min readJun 10, 2013

If you want your custom yaml files inside config/ directory of your rails application deployed via Amazon Opsworks, its nice to do it the Chef-way. Provided that your application name is “MyApp Staging”, and you already have “database” and other settings in “deploy” clause, you just have to define “symlink_before_migrate” section:

[code language=”shell”]
{
“deploy”: {
“myapp_staging”: {
“database”: {
“adapter”: “postgresql”,
“username”: “myapp_staging”,
“database”: “myapp_staging”,
“host”: “db-ext”,
“password”: “supersecret”,
“su_username”: “myapp_staging”,
“su_password”: “supersecret”,
“schema_search_path”: “public, postgis”,
“postgis_extension”: true
},
“symlink_before_migrate”:{
“config/application.yml” : “config/application.yml”
}
}
}
}

[/code]

This will create symlink from your #{deploy_to}/shared/config/application.yml to #{deploy_to}/current/config/application.yml just before the migrations while deploying the app.

--

--