wiki:Infrastructure/AdminScripts

Version 5 (modified by GaretJax, 19 months ago) (diff)

--

Note: this page is still under construction!

Fabric administration scripts

This page describes how to use the Fabric-based administration scripts to manage services running on twistedmatrix.com.

Getting the tools

The first step is to install the needed libraries and tools. I'm using virtualenv and virtualenvwrapper in this guide, you are free to install everything on your stock python.

mkvirtualenv env_name
workon env_name
pip install fabric
git clone <address not known yet> tmadmin # May be svn or bzr as well
cd tmadmin

You can now list all available tasks by calling:

fab --list
Collection of utilities to automate the administration of Twisted's
infrastructure. Use this utility to install, update and start/stop/restart
services running on twistedmatrix.com.

Available commands:

    dns.install
    dns.restart
    dns.start
    dns.stop
    dns.update
    ...

Client configuration

Before being able to run any task, we need to configure the tool to work with Twisted's infrastructure and your login user. All configuration directives are contained in the config.py file. The base installation ships with a sample configuration file in config.py.sample. Copy it over and start editing it:

cp config.py.sample config.py
vim config.py

The two main directives to change are the HOSTS and USER ones. The first contains a list of hosts you want to administer, while the second one is, well, your ssh user to access the previously defined hosts. All found uppercase variables are lowercased and set as attributes of Fabric's env global variable. This means that any configuration directive recognized by Fabric can be defined in the config.py file as well.

Note: your user has to be at least in the service-admin group on the servers you want to manage in order to be able to start/stop/restart and update services. If you want to be able to install new services or give permissions to other users to manage them, your user has to be able to gain root access as well.

Server configuration conventions

Directory structure

Users, groups and privileges

Init scripts

Available tools

How to start/stop/restart services

How to update existing services

How to install new services

How to give service administration privileges to another user

How to setup a new server from scratch

Adding additional tools or modifying existing ones