-
Notifications
You must be signed in to change notification settings - Fork 0
Deployment with Capistrano, Unicorn, and nginx
These instructions are mostly accurate but are a work in progress and will be finished in the next few days.
Deploying Huginn with Capistrano, Unicorn, and nginx is straight forward.
Follow these steps:
-
Edit your Gemfile and add the following:
group :production do gem 'unicorn' end group :development do gem 'capistrano' gem 'capistrano-unicorn', :require => false gem 'rvm-capistrano' end -
Setup a place for Huginn to run. I recommend making a dedicated user on your server for Huginn, but this is not required. Setup nginx or Apache to proxy pass to unicorn. There is an example nginx script in
doc/deployment/nginx/production.conf. -
Setup a production database on your server for Huginn.
-
Copy
doc/deployment/unicorn/production.rbtoconfig/unicorn/production.rband replace instances of you with the correct username for your server. -
Copy
doc/deployment/capistrano/deploy.rbtoconfig/deploy.rband change all instances ofyouandyourdomainto the appropriate values for your server setup. If you want RVM to be used and installed, uncomment the appropriate lines. -
Run
cap deploy:setupto create the basic Capistrano directory structure on your server. -
Make a copy of your
.envfile, setup your production settings, create a directory called/home/you/app/shared/configon your server, and place your production.envfile in this directory. -
Make a copy of your
Procfile, set it up for production, and place the copy in/home/you/app/shared/configon your server, just like you did with the.envfile for production. -
Run
cap deploy. SSH into your server, go to the deployment directory, and runbundle exec foreman startin a screen session. -
Run
RAILS_ENV=production bundle exec rake db:seedto generate your admin user. Immediately login to your new Huginn installation with the username ofadminand the password ofpasswordand change your email and password!
If you have a better config for production foreman that doesn't use a screen session, please share! I know upstart is a good option but haven't set it up yet on my box.