Webserver with Mongrel

Posted by stoyan Tue, 14 Nov 2006 05:49:00 GMT

After seen a small webservers in Perl and Ruby here is my try with using Mongrel :

Start an webserver on all interfaces (0.0.0.0), port 3002, serving static pages from ./html/ directory:
require 'mongrel'

config = Mongrel::Configurator.new :host => "0.0.0.0", :port => 3002 do
  listener { uri "/", :handler => Mongrel::DirHandler.new("html/") }
  trap("INT") { stop }
  run
end

config.join
And with adding some statistics (on http://.../status/ URL):
#!/usr/bin/env ruby
require 'rubygems'
require 'mongrel'
require 'yaml'

stats = Mongrel::StatisticsFilter.new(:sample_rate => 1)

config = Mongrel::Configurator.new :host => "0.0.0.0", :port => 3002 do
  listener do
    uri "/", :handler => Mongrel::DirHandler.new("html/")
    uri "/", :handler => stats
    uri "/status", :handler => Mongrel::StatusHandler.new(:stats_filter => stats)
  end

  trap("INT") { stop }
  run
end

puts "Mongrel running on 0.0.0.0:3002 with docroot ./html/" 
config.join

I’m using it for serving static pages, generated with Rote – pretty fast ;)

Posted in Programing, SysAdmin, Ruby | no comments

nginx notes

Posted by stoyan Fri, 25 Aug 2006 09:59:00 GMT

I put some notes for nginx on my wiki .

The rails system administration is like waves – somebody found a new software and the community just fulfill it. Maybe there must be some name for this effect. Something like digg-effect but maybe Rails wave hahaha.

First there was lighttpd , now nginx comming. Maybe your piece of code will be the next. Are your ready? ;)

Posted in SysAdmin, Ruby | no comments

Typo with installer

Posted by stoyan Fri, 07 Jul 2006 04:54:00 GMT

Without a lot of noise there is a new version of everybody’s favourite blog engine – Typo. It including also an installer, which lets us following the no-step3-way :
$ gem install typo
$ typo install /tmp/typo
Like always with RoR, there is no step 3 ;) you have you blog ready to go.

What else give us the new Typo:

  • no need to downgrade your Rails environment – working without problems with the current Rails version
  • production ready – the new installer making mass-producing pretty easy – creating database(sqlite3 by default), choosing the random port etc.
  • Mongrel friendly – it started mongrel_rails, not webrick. Can be changed from installer/rails_installer_defaults.yml
  • jabber and email notifications – that one is pretty good I think. I need to study more the implementation.

Posted in Programing, SysAdmin, Ruby | no comments

ActiveMailer sending via GMail

Posted by stoyan Tue, 27 Jun 2006 08:03:00 GMT

On the previous Kansai Rails Conference in Asiyagawa somebody asked me about using GMail (smtp+ssl or tls) with Rails ActiveMailer. Didn’t find solution until now but ‘dza-dza-dzaaaaaaan’ (hahaha i’m not so smart, all credits going to entombedvirus ):

Send email with ActionMailer through TLS only SMTP server

So for Debian (Ubuntu):

Install msmtp (light SMTP client with support for server profiles)

$ sudo apt-get install msmtp

Create/edit ~/.msmtprc

account gmail
host smtp.gmail.com
auth on
user <your_account>@gmail.com
password <your_password>
tls on
tls_starttls on
from <your_account>@gmail.com
maildomain gmail.com
account default : gmail

Stop msmtp complaining about permissions

$ chmod 600 ~/.msmtprc

Add on the bottom of yourrailsapp/config/environment.rb (and comment another ActionMailer::Base.delivery_method settings if exists)

ActionMailer::Base.delivery_method = :msmtp

module ActionMailer
  class Base
    def perform_delivery_msmtp(mail)
      IO.popen("/usr/bin/msmtp -t -C /<path_to>/.msmtprc -a gmail --", "w") do
 |sm|
        sm.puts(mail.encoded.gsub(/\r/, ''))
        sm.flush
      end
    end
  end
end

Do not forget to fix the exact path to your .msmtprc in the source above.

Posted in SysAdmin, Ruby | no comments

WebDAV Ruby On Rails Plugin

Posted by stoyan Sun, 25 Jun 2006 17:20:00 GMT

Via liverail.net :

I’m releasing the first version of the RailsDAV plugin . What does RailsDAV do. Well it allows people to create Ruby On Rails controllers which will respond to WebDAV requests and expose functionality as a file-system.

Uhoo, finally. Now I can access my Rails applications not only with browser, but also mount them from the OS X Finger or like Windows Network Disks.

Pretty cool. I’m waiting also for the changes in the Rails itself, to support PUT and DELETE in addition to GET and POST, changes DHH promised to us in Tokyo.

Posted in Ruby, SysAdmin | no comments

Litespeed+mongrel+HTTPS

Posted by stoyan Tue, 20 Jun 2006 06:12:00 GMT

Great news from LiteSpeed Technologiesafter a post to the forum they have ”X-Forwarded-Proto: https” AUTOMATICALY added to the headers, when proxing requests, initially comming via HTTPS. Now Rails applications are not confused, when doing redirects for HTTPS. Good to be added to Litespeed+Mongrel docs .

The litespeed-2.1.17 is already available for download (even still there is no announce).

Posted in Ruby, SysAdmin | no comments

Rails "one-click" installer for Debian Sarge

Posted by stoyan Fri, 16 Jun 2006 02:32:00 GMT

- Add to your /etc/apt/sources.list :
deb http://rails.netlab.jp/debian sarge rails
- Install Rails
$ sudo apt-get update
$ sudo apt-get install rails
- There is no step 3 ;)

And if your question is “who the hack made this package?”, it’s NaCl – the company where Matz is working :)

Posted in SysAdmin, Ruby | 2 comments

Distribute your Rails application as a Gem

Posted by stoyan Tue, 30 May 2006 01:30:00 GMT

1. Install fossilize plugin
$ ./script/plugin source http://opensvn.csie.org/mmediasys/trunk/rails/plugins/
$ ./script/plugin install fossilize
2. Create the default script and configuration for your application
# will create config/application.yml and bin/my_rails_app
$ ./script/generate fossilize MyRailsApp

3. Edit config/application.yml if needed (author name, email, gem version etc.)

4. Generate the gem (in pkg/ directory)
# will produce pkg/my_rails_app-x.y.z.gem
$ rake package
5. Usage
$ gem install my_rails_app
$ my_rails_app /path/to/install

Posted in SysAdmin, Gems, Ruby | no comments

Gmail for your domain

Posted by stoyan Fri, 12 May 2006 06:38:00 GMT

Gmail for your domain just rocks! After 1 or 2 weeks of waiting you can have the latest on the web 2.0 email market for your own domain (personal or the company one). I already have my Gmail-based family webmail ;) Still moving the whole stuff from the @gmail accounts is in front…Hope there is some tool for easy transfer between accounts – emails, labels, filters etc.

Posted in Personal, SysAdmin | no comments

Steve Kemp’s software – i like it

Posted by stoyan Tue, 02 May 2006 02:22:00 GMT

Found very good site: steve.org.uk

Some interesting stuff:

  • Argo — Xen Monitor / Control Panel. Simple, extensible, framework for controling a host running multiple Xen instances. Exactly what I need for the company.
  • lua-httpd — simple, but pretty good Lua http server. Even have support for vhosts!
  • Fortress — a simple script-based security scanner. C++ code, but tests should be written in Lua.

Steve Kemp have also very interesting weblog .

Posted in Programing, SysAdmin | no comments

Older posts: 1 2 3 ... 5

Powered
Ruby Blogs Directory
Performa
Box.net Refer