I use gem capistrano-env and found a small problem. My deploy script is:
Capistrano::Env.use do |env|
env.add 'DB_DSN', 'mysql:host=localhost;dbname=dbname'
env.add 'DB_USER', 'user'
env.add 'DB_PASS', 'pass'
end
And this code create .env file on server after deploy. But! .env file permissions is 640 and my PHP script cannot read it. I can run chmod command after each deploy, but probably exist other nice solution?
EDIT
I created pull request and add new filemode option into this gem. So, now solution is:
Capistrano::Env.use do |env|
env.add 'DB_DSN', 'mysql:host=localhost;dbname=dbname'
env.add 'DB_USER', 'user'
env.add 'DB_PASS', 'pass'
env.filemode = 0644
end
You have a couple options to make this nicer.
It doesn't look like capistrano-env supports a custom permissions setting, but perhaps that feature could be added! Open an issue at GitHub and maybe the project maintainer will add it.
You could modify your
deploy.rbto run the necessarychmodcommand for you. That way you wouldn't have to manually run chmod after each deploy.Something like this: