Skip to content

Instantly share code, notes, and snippets.

View edavis10's full-sized avatar

Eric Davis edavis10

View GitHub Profile
# install passenger (I like this but others will choose mongrel clusters)
## Temporarily disable SELinux
echo 0 > /selinux/enforce
## Permantly disable by changing SELINUX=enforcing to SELINUX=disabled
## in the file: /etc/selinux/config use the command:
vi /etc/selinux/config
## Fix SELINUX (from passenger site) if installed from a gem (like here)
## find the passenger root folder:
$ ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.4, 2.2.3)
actionpack (2.3.4, 2.2.3)
activerecord (2.3.4, 2.2.3)
@edavis10
edavis10 / 90-staging.rb
Created September 9, 2009 23:24
Patch TMail/ActionMailer to deliver all email to one address in staging
# Send all mail to a single address in staging
if RAILS_ENV == 'staging'
STAGING_EMAIL_ADDRESS = '[email protected]'
module TMail
class Mail
def destinations
[STAGING_EMAIL_ADDRESS]
end
def to=( *strs )
@edavis10
edavis10 / gist:183286
Created September 8, 2009 22:41
Moving and upgrading a Redmine database
1. Create a text backup of your data form the live server. This will ask for a password.
mysqldump -u your_user -p your_redmine_database > backup_sql_file.sql
2. Transfer the backup_sql_file.sql to your new server.
3. Once there, drop the existing database on the new server.
!!!! Triple check this is on the new server and not your live one!!!!
git diff
diff --git a/config/deploy.rb b/config/deploy.rb
index 4140c0b..acaa784 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -3,7 +3,7 @@ set :repository, "[email protected]:redmine.git"
set :scm, :git
set :git_enable_submodules,1
#set :deploy_via, :remote_cache
-set :deploy_via, :copy
# /etc/init.d/nginx
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
>> cmd = "puts Time.local(2009).zone"
=> "puts Time.local(2009).zone"
>> ['PST', 'CST'].each do |tz|
?> ENV['TZ'] = tz
?> puts `ruby -e \"#{cmd}\"` # Prints two different values on Windows
?> end
UTC
# vendor/plugins/plugin_a/init.rb
Dispatcher.to_prepare do
require_dependency 'application' # for ApplicationController
ApplicationController.send(:include, PluginAPatch)
end
FatFreeCRM::Plugin.register(:fat_free_issues, initializer) do
name "Fat Free Issues"
author "PCCL"
version "1.0"
description "Basic support for issues"
dependencies :simple_column_search, :uses_mysql_uuid, :uses_user_permissions
end
#!/bin/bash
TZ='America/Los_Angeles'; export TZ
## All projects
# /home/websites/projects.littlestreamsoftware.com/current/script/runner -e production "Repository.fetch_changesets"
## Only active projects
/home/websites/projects.littlestreamsoftware.com/current/script/runner -e production "Project.find_all_by_status(Project::STATUS_ACTIVE).collect(&:repository).compact.each {|repo| repo.fetch_changesets }"