Psuedocode for server management scripts

Along the lines of my post on the Forkolator blog on how to set up the server architecture, I’ve written out some pseudocode for scripts that I think would handle the mongrel servers and the nginx load balancer properly:

% start_nginx
get all mongrels from database
create nginx conf
start nginx

% start_mongrels testproject production 2
mongrel start get_a_free_port()
insert mongrel
pid=278112
port=8004
servername=testproject.forkolator.org
app=testproject
environment=production
mongrel start get_a_free_port()
insert mongrel …
mark server for refresh

% start_mongrels testproject development 1

% reload_nginx (runs as a daemon)
get all mongrels from database
create nginx conf
reload nginx conf

% stop_mongrels testproject production
find the mongrel processes
kill them
remove them from the database
mark the server for refresh

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: