Gee, almost another 2 years have gone by!
Anyhow I’ve been playing with a new version of GolfGaggle.com, my learning rails application for well over a year, trying to get the group I now play with move move off of their DOS command line application. Still not sure they are going to use it, I may have too many bells and whistles.
My old site was in Rails 3.x and I’ve been doing most playing with rails 4.x. Rather then upgrade, I started from scratch. Tried different approaches, but it ends up being about the same structure, just a lot of cleanup and replacing my css with mainly Zurb Foundation. Therefore the new application is phone and pad friendly (responsive).
I had it just about all done and put a development version on my MacMini server for the current group to test. I at least got them to look and it, but nothing close to testing, so I decided to get it ready to deploy and put in production. That’s where I got overwhelmed. I vaguely remember how to deploy on a Mac server, but wanted to upgrade the OS and a few other things. The last thing I did was on linux and while I didn’t want to abandon the Mac, I decided to try and see how long it took me to put it on a VM cloud server. About three mornings! I got an account with Digital Oceans a couple days ago and had the Debian environment up in a matter of hours with Postgresql, Unicorn, Nginx and rbenv. They all worked, or at least installed, but then started to run into little problems.
After I got rails installed, I tried a new rails application just to see if I could hit it. Postgres had a problem with locale. Debian installed with en_US and Postgres wanted UTF-8. That took a few hours of searching and fixing.
I then added Capistrano using my other linux project as an example. That was surprising easy. I was skipping between Digital Oceans tutorials and others, mixing things together. Of course that had problems. An example using rbenv would deploy, but not run. Spent another morning getting some stuff to work. I could bring it up under webbrick, but not unicorn.
This morning I got it all working. All those mixed gists on the configuration files for unicorn.rb, unicorn.init and init.d had to be tweaked because of Capistrano. I know I had almost everything there, but couldn’t get bundle exec to work. The final fix was found - I also had the same problem with another site and I kludge fixed it. I found a better approach. In the init script I changed this:
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production"
CMD="cd $APP_ROOT; ~/.rbenv/bin/rbenv exec bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production"
Something about how rbenv and init.d work with executing as root, Whether rbenv in is .bachrc or .bashprofile. This basically fixes it!
All seems to be working fine. I even added this Octopress blog that I have not touched in a while without any problems.