Hello, today i am tell you about Capistrano 3 and Rails 4 setup. For those who never heard about Capistrano, this is deployment library which can be scripted on ruby, in any ways.
First of all Gemfile:
After that add into Capfile some require string to previous install gems:
Next to deploy.rb:
Also you need to edit deploy/production.rb to setup production server hostname . Read full article to understain the key problem and solution for it …
Some rude code for task to unicorn managemnt in deploy.rb:
After that you probably think that everything should go nice and smooth, but something goes painfull…
After trying to make cap production deploy:start your likely get message that says you don’t set SECRET_KEY_BASE into environment variable. And if you add it to .bashrc .bash_profile or .profile files everything goes the same way with message.
After several tests i am explain that SSHKit starts shell with non-interactive and non-login options. That is exaclty the reason why nothing goes load with dotfiles. The thing is that when shell starts with non-interactive and non-login options, no one dotfiles is going to load, and everyting you have is $BASH_ENV.
To more expose this situation you must see this picture:
So what should you do next ?
sshd have a special option for this situation, - PermitUserEnvironment yes, you must set it in /etc/ssh/sshd_config
After that you can create ~/.ssh/environment and put into:
After that when you run cap production deploy:start to strart unicorn server, everything will be fine because SECRET_KEY_BASE will be loaded from ~/.ssh/environment file
Have fun with it.
Comments powered by Talkyard.