JEEN / Rex

A framework for server orchestration and to simplify system administration

Home Page:http://rexify.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

With (R)?ex you can manage all your boxes from a central point through the complete process of configuration management and software deployment.

Dependencies

Usage

A small example:

Rexfile

user "root";
password "root";
pass_auth;

group "frontend" => "frontend[01..09]", "varnish[01..04]";


desc "Show Unix version";
task "uname", "server[1..9]", sub {
    say run "uname -a";
};

desc "Write into a file";
task "write", group => "frontend", sub {
   file "/path/on/the/remote/machine",
      content => "Hello World!",
      mode    => 600,
      owner   => "root",
      group   => "root";
};

Commandline

  • Run commands directly from command line

    bash# rex -e 'say run "uptime";' -H "frontend[01..10] middleware[01..05]" -u root -p password
  • List all known Tasks

    bash# rex -T
    Tasks
      uname                     Show Unix version
  • Run Task uname

    bash# rex uname
    Running task: uname
    Connecting to server1 (root)
    Linux mango 2.6.27-openvz-briullov.1-r4 #1 SMP Tue Nov 24 23:25:52 CET 2009 x86_64 Intel(R) Pentium(R) D CPU 2.80GHz GenuineIntel GNU/Linux
    Running task: uname
    Connecting to server2 (root)
    Linux debian01 2.6.26-2-amd64 #1 SMP Tue Aug 31 09:11:22 UTC 2010 x86_64 GNU/Linux

Master/Agent

See https://github.com/krimdomu/Rex-Server for more information.

Create a new project on the master

rexify myproject
cd myproject

Edit the Rexfile.

use lib 'lib';
use Rex::myproject;

# put your server in this group
group "fe" => "fe[01..05]";
group "mw" => "mw[01..04]";

desc "Deploy Frontend Server";
task "deploy-fe", group => 'fe', sub {

  needs Rex::myproject 'fe';

};

desc "Deploy Middleware Server";
task "deploy-mw", group => 'mw', sub {

  needs Rex::myproject 'mw';

};

Edit the file lib/Rex/myproject.pm

package Rex::myproject 

use Rex::Commands;
use Rex::Commands::Run;
use Rex::Commands::Pkg;

task "fe", sub {

   install package => [
         'apache2',
         'php5'
      ];

};

task 'mw', sub {

   install package => [
         'tomcat6',
         'apache2',
         'libapache-mod_jk'
      ];

};

1;

Now start the rex-master server. The server will bind on any device and port 7345 (tcp)

# debug mode (foreground)
rex-master -d

# daemon mode (background)
rex-master -b

# see all the options with rex-master --help

And start the agents on your servers.

# see all the options with rex-agent --help

# debug mode (foreground)
# this will start the agent with:
#        -s your-rex-server = the master server
#        -i 5               = 5 seconds interval
#        -f                 = foreground
#        -d                 = debug mode
#        -c                 = cache dir (this directory must be writable)
rex-agent -s your-rex-server -i 5 -f -d -c /tmp/cache

Please test and reports bugs :) Any kind of feedback is welcome.

About

A framework for server orchestration and to simplify system administration

http://rexify.org/

License:GNU General Public License v3.0


Languages

Language:Perl 100.0%