How-to: Deploy Rails 4 App From Windows Dev Environment Using Capistrano 3
This post will be primarily sharing some gotchas when I went through this post for deploying to a Linux server from Windows development machines using capistrano 3.
Environment
- Development on Windows 7
- Deployment on aliyun ECS Ubuntu 12.04 image
- Rails 4
- Capistrano 3
Sidenote
- Capistrano will automatically run
rake db:migration
for you if you uncommentrequire 'capistrano/rails/migrations'
in capfile. - Capistrano will automatically precompile assets for you if you uncomment
require 'capistrano/rails/assets'
in capfile.
fetch not working?
When running cap production git:check
, I always get something like the following error when I use a variable defined by set
method.
1 2 |
|
1 2 3 4 5 6 |
|
I have to ditch fetch
method and write something like…
1
|
|
No such file to load — bcrypt
Capistrano will try to precompile assets at somepoint while running cap production deploy
. It kept throwing an error saying No such file to load -- bcrypt
. I found a comment from Railscast solved my problem.
I had this issue. I develop on Windows 7, and certain gems have windows-specific versions. I went into my Gemfile.lock and removed all “x86-mingw32” in the gem version numbers. After commiting the changes and deploying again, it worked. I also had this problem with postgres and the pg gem. (by jdresner)
References
- [1] My gemfile.
- [2] Corlew solutions’s How-To Deploy Rails Applications Using Capistrano 3.1 and Windows 7
- [3] Corlew solutions’s Guide To Setting Up SSH on Windows 7