Merb Wiki
Home
All Pages
New Page
Editing Deployment
Textile Enabled
| [[Page Name]] for internal links
h2. Blog Posts * "Phusion Passenger now supports Merb":http://github.com/FooBarWidget/passenger/tree/master Check out the [[Phusion Passenger]] page for more info. * "Nginx and Mongrel Merb":http://www.benr75.com/articles/2007/12/24/taking_merb_to_production_nginx_evented_mongrel_capistrano - Yes, it's outdated but that has a great nginx configuration file. * "Soar with Merb":http://blog.kineticweb.com/articles/2008/02/09/soar-with-merb-core-and-merb-more-0-9 * "Starter guide for getting configured on Fedora 8 - Updated 4/13/08":http://skippidydoo.com/posts/show/e3f8c6ed-ab52-4626-9e4a-bc633ab4ea69 * "Merb Server Management":http://github.com/eldiablo/merb-manage/tree/master h2. Phusion Passenger. See separate page for [[Phusion Passenger]]. In 2.0 it supports Rack-based frameworks so you can use it with Merb. h2. Choosing An Application Server * Due its being threaded, Mongrel is still the king as a general purpose application server. * Use of an evented server (Thin, Ebb, Evented Mongrel) is only a viable option for applications that have very fast response times for every action (i.e. an API that serves JSON) as a long running action will queue any subsequent requests until its completion. h2. Booting Your Production Application <pre>merb -e production -c 4 --port 9000</pre> will start four Mongrels on ports 9000, 9001, 9002 and 9003 in production mode. This can be done programatically with Capistrano: <pre><code class="ruby"># config/deploy.rb set :adapter, 'mongrel' # or 'thin' set :start_port, 4000 set :processes, 4 set :log_path, "#{shared_path}/log/production.log" namespace :deploy do desc "Start Merb Instances" task :start do run "merb -a #{adapter} -e production -c #{processes} --port #{start_port} -m #{current_path} -L #{log_path}" end desc "Stop Merb Instances" task :stop do run "cd #{current_path} && merb -a #{adapter} -k all" end desc 'Custom restart task for Merb' task :restart, :roles => :app do deploy.stop deploy.start end end</code></pre> h2. Using Nginx h3. Install Nginx h4. In Debian <pre>$ sudo apt-get install nginx</pre> h4. In Archlinux Make sure you have the community repo configured in your @/etc/pacman.conf@ <pre>pacman -S nginx</pre> Once Nginx has been installed, the configuration for the merb application needs to be applied. h3. Configuring Nginx This has been split up into the general configuration and the specific virtual host for the application. First, the general configuration as shown below: <pre># /etc/nginx/nginx.conf user www-data www-data; #chowned this user/group worker_processes 4; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; tcp_nodelay on; gzip on; upstream proxy_server { server 127.0.0.1:4000; server 127.0.0.1:4001; server 127.0.0.1:4002; server 127.0.0.1:4003; } # virtual configs include /etc/nginx/conf/vhosts/app.conf; } </pre> and then the specific virtual configuration file: <pre> # /etc/nginx/conf/vhosts/app.conf server { listen 80; client_max_body_size 50M; server_name www.myservername.com; root /path/to/app/current/public; if (-f $document_root/system/maintenance.html) { rewrite ^(.*)$ /system/maintenance.html last; break; } location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect false; proxy_max_temp_file_size 0; if (-f $request_filename) { break; } if (-f $request_filename/index.html) { rewrite (.*) $1/index.html break; } if (-f $request_filename.html) { rewrite (.*) $1.html break; } if (!-f $request_filename) { proxy_pass http://proxy_server; break; } } error_page 500 502 503 504 /500.html; location = /500.html { root /path/to/app/current/public; } } </pre> h2. Configuring for a shared host If you want to run your merb app on a /prefix on your server, edit init.rb and add @c[:path_prefix] = '/prefix'@ within the @Merb::Config.use do |c|@ block.
Submit
Recent Activity
Home
was updated
Home
was updated
deploying-a-merb-application-to-a-jee-container-us
was updated
deploying-a-merb-application-to-a-jee-container-us
was updated
Merb Developers available for work
was updated
deploying-a-merb-application-to-a-jee-container-us
was updated
deploying-a-merb-application-to-a-jee-container-us
was updated
deploying-a-merb-application-to-a-jee-container-us
was updated
deploying-a-merb-application-to-a-jee-container-us
was updated
Home
was updated