I have a hummingbird that hums so loud. You think you were loosing your mind.
Author Archives: aaron
Nestacms with passenger, rvm, apache
Objective
To get Nesta to be served from Apache with Passenger.
Summary
About a couple months ago, I came across Nesta which is really awesome and really simple CMS built off the Sinatra framework. But I could not figure out how to host the application with Apache. Fast forward to this evening and I finally found a solution. If you have any suggestions on how it could be done different, please post a comment as I would like to hear about it.
Build
So! you want to build it. Ok, here are the steps I did:
- Install RVM and Ruby (I ended up with the single user install as you will notice)
- curl -L get.rvm.io | bash -s stable
- rvm requirements
- (install necessary stuff to compile ruby and gems)
- rvm install 1.9.2
- rvm use –default 1.9.2
- Install Nesta
- gem install nesta
- Create your site home and site itself
- mkdir /apps
- cd /apps
- nesta new mysite
- (take note that all additional steps use “/apps/mysite” as the nesta directory)
- Install Passenger
- gem install passenger
- passenger-install-apache2-module
- Apache config
- mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled /etc/httpd/mods-available /etc/httpd/mods-enabled
- Create the file /etc/httpd/mods-available/passenger.conf (see git gist below)
- Create the file /etc/httpd/sites-available/mysite (see git gist below)
- cd /etc/httpd/sites-enabled
- ln -s ../sites-available/mysite mysite
- cd /etc/httpd/mods-enabled
- ln -s ../mods-available/passenger.conf passenger.conf
- turn on NameVirtualHosts feature
- sudo /etc/init.d/httpd restart
- goto your new site!
The case for beer
A friend of mine shared this great info graphic and I had to post it up at my site!
Source: FrugalDad.com
Using the console with RedMine to find records or information
Some features of RedMine are not available for doing reporting. So I started to dig into the console interface and ran some of my own queries:
Starting the RedMine console (WARNING! Be careful!)
To start the RedMine console, change directories to your application base:
cd /usr/share/redmine-1.2
Now run the following command to get into the console:
RAILS_ENV=production ./script/console
This will get you into the Production side of your environment. If you want to use development area:
RAILS_ENV=development ./script/console
Running some queries:
Find all issues by their description only:
Issue.find(:all, :conditions => "description LIKE '%your_pattern%'")
Find all issues by their description only limited by project id:
Issue.find(:all, :conditions => "description LIKE '%your_pattern%' AND project_id = '5'")
Find spent hours by looking for a custom value in a issue:
hours = [] CustomValue.find(:all, :conditions => "custom_field_id = 35 AND value LIKE '%your_pattern%'").each do |c| hours << Issue.find(c.customized_id).spent_hours end
Find all issues that a specific user has commented on:
user_2 = [] Project.find(5).issues.each do |issue| issue.journals.each do |journal| if journal.user_id == 2 user_id << issue.id end end
Find list of users who contributed to an issue for a specific project:
results = Hash.new
Project.find(5).issues.find(:all).each do |issue|
people = []
issue.journals.each do |j|
people << user
end
results["#{issue}"] = people unless people.empty?
end
y results
Configuring rvm with ruby on rails with passenger and capistrano
This covers using the following software versions:
- ruby-1.9.2-p318
- passenger-3.0.11
- rails 3.2.2
- Apache 2.2
In short, the following steps are necessary:
- Install RVM with the multi user instructions
- Check requirements
rvm requirements
- Install ruby 1.9.2
rvm install 1.9.2
- Install passenger
gem install passenger
- Load passenger into apache with passenger.conf
- Add a new user called ‘cap-deploy’
- Create a dir of /webapps and owned by the user and group of the apache process
- Create a dir of /webapps/yourrailsapp and the user and group of cap-deploy with perms of 775 (might be able to get away with less perms)
- Cap your rails application on your dev environment
- Add your rails app to a version management (I went with github) that is accessible by your hosting server
- Configure your version management to ignore the following files gitignore
- Add the following to your Cap file: Capfile
- Configure your /config/deploy.rb file with db support so that version control system does not share our db config: deploy.rb
- Run the cap and have fun!
- cap deploy:setup
- do first push
- cap deploy:cold
- do updates
- cap deploy
