Register now and start sharing your code snippets.
-->
Vlad deployment recipe for Phusion Passenger
Ruby posted 4 months ago by christian
1 # 2 # General configuration 3 # 4 #set :ssh_flags, '-p 110000' 5 set :application, 'app.xxx' 6 set :domain, 'x.x.x.x' 7 set :deploy_to, '/var/www/app.xxx' 8 set :revision, 'master' 9 set :repository, '/var/lib/git/repositories/app.xxx/' 10 11 12 namespace :vlad do 13 set :app_command, "/etc/init.d/apache2" 14 15 desc 'Restart Passenger' 16 remote_task :start_app, :roles => :app do 17 run "touch #{current_release}/tmp/restart.txt" 18 end 19 20 desc 'Restarts the apache servers' 21 remote_task :start_web, :roles => :app do 22 run "sudo #{app_command} restart" 23 end 24 end
Rails+Mongrel+Apache 2 on Mac OSX Leopard
Apache posted 4 months ago by christian
I use this configuration on my development machine when I need mod_rewrite; it’s not meant for production:
1 <VirtualHost *:80> 2 ServerName dev.xxx.com 3 4 # Enable URL rewriting 5 RewriteEngine On 6 7 # Rewrite index to check for static pages 8 RewriteRule ^/$ /index.html [QSA] 9 10 # Rewrite to check for Rails cached page 11 RewriteRule ^([^.]+)$ $1.html [QSA] 12 13 # Redirect all non-static requests to cluster 14 RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f 15 RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] 16 17 DocumentRoot "/Users/christian/Documents/Projects/xxx/public" 18 <Directory "/Users/christian/Documents/Projects/xxx/public"> 19 Options Indexes FollowSymLinks 20 21 AllowOverride None 22 Order allow,deny 23 Allow from all 24 </Directory> 25 26 </VirtualHost> 27 28 <Proxy balancer://mongrel_cluster> 29 BalancerMember http://127.0.0.1:3000 30 </Proxy>
Generate a 56-bit DES encrypted (htpasswd) password with Ruby
CSS posted 12 months ago by christian
Run the following in an irb console to generate a 56-bit DES encrypted password:
1 "password".crypt("salt")
The password can be used in an Apache or Nginx htpasswd file to enable basic authentication.
The generated password can also be used in other Unix password files.
How to run multiple Rails applications from the same directory
Ruby posted about 1 year ago by christian
Set this in environment.rb:
1 ActionController::AbstractRequest.relative_url_root = "/appname/" 2 ActionController::CgiRequest.relative_url_root = "/appname/"