Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tweaks, prepping for deployment.

  • Loading branch information...
commit 9d633c5848668e5df6636b801b52f541719d153f 1 parent 0ec08af
@thomasn authored
View
8 app/controllers/common_controller.rb
@@ -55,12 +55,14 @@ def search
return
end
+ if params[:table_name] != 'contacts'
+ @objects = []
+ return
+ end
page = (params[:page] ||= 1).to_i
- ## FIXME @objects = Ultrasphinx::Search.new(:query => params[:query], :page => params[:page], :per_page => OBJECTS_PER_PAGE)
- ## FIXME Check - parse query to do: Contact.search(:conditions => {:first_name => 'Renat'}, :page => '1', :per_page => 9999) ???
+ ## TODO: parse query to do: Contact.search(:conditions => {:first_name => 'Renat'}, :page => '1', :per_page => 9999)
@objects = Contact.search(params[:query], :page => params[:page], :per_page => OBJECTS_PER_PAGE) || []
- ### FIXME@objects.run
render :action => 'list'
end
View
4 app/views/common/_table_rows_for_list.rhtml
@@ -18,13 +18,9 @@
<% (object.get_entity_columns + @dynamic_attributes).each do |column| %>
<td>
<% if column.name == 'notes' -%>
- <% logger.debug("###-002 notes column... ### FIXME ###") %>
<%= markdown object.send(column.name) -%>
<% else %>
<% Contact.create_attributes %> <!-- FIXME -->
- <% logger.debug("###-003 #{column.name} column... ### FIXME ###") if column.name == 'website' %>
- <% logger.debug("###-004 <<#{object.send(column.name)}>> ### FIXME ###") if column.name == 'website' %>
- <% logger.debug("###-005 <<#{object.send(column.name)}>> ### FIXME ###") if column.name == 'website' %>
<%= h object.send(column.name) -%>
<% end -%>
</td>
View
105 config/deploy.rb
@@ -1,15 +1,98 @@
+# Deployment recipe for forgetmenot on Passenger
+# Thanks: http://www.zorched.net/2008/06/17/capistrano-deploy-with-git-and-passenger/
+
set :application, "forgetmenot"
-set :repository, "set your repository location here"
+set :repository, "git://github.com/thomasn/forgetmenot.git"
+set :deploy_to, "/var/www/rails/forgetmenot"
+set :rails_env, "production"
+set :branch, "master" # FIXME yuk yuk yuk
+set :user, "root"
+set :runner, user
+set :scm, :git
+# set :scm_password, Proc.new { Capistrano::CLI.password_prompt("Git password for #{repository}: ") }
+set :deploy_via, :remote_cache
-# If you aren't deploying to /u/apps/#{application} on the target
-# servers (which is the default), you can specify the actual location
-# via the :deploy_to variable:
-set :deploy_to, "/var/www/rails/#{application}"
-# If you aren't using Subversion to manage your source code, specify
-# your SCM below:
-set :scm, :git
+# Use staging settings by default - override these in farm-specific tasks.
+set :domain, Proc.new { Capistrano::CLI.password_prompt("Target domain for #{repository}: ") }
+role :web, domain
+role :app, domain
+role :db, domain, :primary => true
+
+
+
+# Invoke as: `cap aws deploy:cold` etc
+task :aws do
+
+ roles[:web].clear
+ roles[:app].clear
+ roles[:db].clear
+ set :awsbox, "aws.example.com"
+ role :web, awsbox
+ role :app, awsbox
+ role :db, awsbox, :primary => true
+
+end
+
+# == BOILERPLATE == #
+
+
+namespace :deploy do
+ desc "Restarting mod_rails with restart.txt"
+ task :restart, :roles => :app, :except => { :no_release => true } do
+ run "touch #{current_path}/tmp/restart.txt"
+ end
+end
+
+[:start, :stop].each do |t|
+ desc "#{t} task is a no-op with mod_rails"
+ task t, :roles => :app do ; end
+end
+
+# We do not need script/spin :
+deploy.task :start do
+ # nothing
+ end
+
+
+desc "Demonstrates the various helper methods available to recipes."
+task :helper_demo do
+ # "setup" is a standard task which sets up the directory structure on the
+ # remote servers. It is a good idea to run the "setup" task at least once
+ # at the beginning of your app's lifetime (it is non-destructive).
+ setup
+
+ buffer = render("maintenance.rhtml", :deadline => ENV['UNTIL'])
+ put buffer, "#{shared_path}/system/maintenance.html", :mode => 0644
+ sudo "killall -USR1 dispatch.fcgi"
+ run "#{release_path}/script/spin"
+ delete "#{shared_path}/system/maintenance.html"
+end
+
+
+desc "Live deployment config after cap:deploy."
+task :after_update_code, :roles => [:app] do
+ run "ln -nsf #{release_path}/config/database.yml.livecorr #{release_path}/config/database.yml"
+ run "chmod -R g+w #{release_path}/public/*"
+ # sass needs to write to public/stylesheets and g+w is insufficient!??!! :
+ run "chmod -R o+w #{release_path}/public/stylesheets"
+ run "chmod -R g+w #{release_path}/tmp/*"
+ # set setgid bit - files created within this dir will have group of parent dir (i.e. apache/mongrel), not of process:
+ # log files are sensitive - make certain they are invisible to 'other' and have SETGID set on directories:
+ # FIXME: Passenger refuses to start unless shared/log is o+x and *.log is o+rw...
+ run "cat /dev/null > #{shared_path}/log/development.log"
+ run "cat /dev/null > #{shared_path}/log/production.log"
+ run "ln -s #{release_path}/.git/refs/heads/deploy #{release_path}/public/version"
+ run "chmod 2777 #{release_path}/log"
+ run "chmod 2777 #{shared_path}/log"
+ run "chmod 0666 #{shared_path}/log/*"
+ # Set db/export to use shared dir:
+ run "mkdir -p #{shared_path}/db/export" if not File.exists?("#{shared_path}/db/export")
+ run "chmod -R 0777 #{shared_path}/db/export"
+ run "rm #{release_path}/db/export/.keep"
+ run "rmdir #{release_path}/db/export"
+ run "ln -nsf #{shared_path}/db/export #{release_path}/db/export"
+ run "chown -R apache:apache #{release_path}"
+ run "chown -R apache:apache #{shared_path}"
-role :app, "your app-server here"
-role :web, "your web-server here"
-role :db, "your db-server here", :primary => true
+end
Please sign in to comment.
Something went wrong with that request. Please try again.