Login | Register
My pages Projects Community openCollabNet

autoinst
Wiki: ExampleSetup

Edit this page | Links to this page | Page information | Attachments | Refresh page

 

Example Autoinst Setup

This example assumes that Autoinst has already been installed. For instructions on installation, please see the InstallationGuide.

Configuring Autoinst

After Autoinst has been installed, your system has the Autoinst Python modules installed, and the client programs 'ai', 'aiadmin', and 'aiupdate' installed. However, there is not yet a configuration, a repository, or a web server setup.

Autoinst's default configuration location is /etc/autoinst.conf. So for our example, after installing Autoinst, we create /etc/autoinst.conf with the following contents:

# /etc/autoinst.conf

[admin]
autoinst_path=/var/autoinst

[repository]
repository_path=/var/autoinst/repository
repository_authz=/var/autoinst/authz.conf

[logging]
type=file
file=/var/autoinst/autoinst.log
level=info

This directs Autoinst to use '/var/autoinst' as its working directory, and to put the Subversion repository in /var/autoinst/repository. It also directs Autoinst to use authz.conf, but that file doesn't exist yet (we'll create it later).

Creating the Repository

Now we are ready to create the repository. Running as the super-user, we run the following command:

$ aiadmin create
Create a new repository in /var/autoinst/repository? [y/N]: y

Setting up Apache

Now, we setup Apache to serve the Subversion repository according to these instructions:

In our case, we setup the following:

<Location /svn>
 DAV svn
 SVNParentPath /var/autoinst/repository
 AuthzSVNAccessFile /var/autoinst/authz.conf

 # only authenticated users may access the repository
 Require valid-user

 # how to authenticate a user
 AuthType Basic
 AuthName "Subversion repository"
 AuthUserFile /var/autoinst/passwd

In order for Apache to work, we have to create /var/autoinst/authz.conf and /var/autoinst/htpasswd. So we create those files:

First we create a passwd file with two users, 'admin', and 'testuser'.

$ htpasswd -c passwd admin
New password: 
Re-type new password: 
Adding password for user admin
$ htpasswd passwd 'testuser'
New password: 
Re-type new password: 
Adding password for user testuser

And then we create /var/autoinst/authz.conf, where we let 'testuser' edit anything on a branch, but not touch /trunk or /tags:

[/]
* = r
admin = rw

[/branches]
* = r
testuser = rw

Next, we setup the Autoinst API server by adding the following section to httpd.conf:

<Location /autoinst>
  AddHandler cgi-script .cgi
  Options +ExecCGI
  AuthType Basic
  AuthName "Autoinst"
  AuthUserFile /var/autoinst/passwd
  Require valid-user
</Location>

Alias /autoinst/api /var/www/cgi-bin/api.cgi

And then we copy autoinst/server/api.cgi from the Autoinst source package into '/var/www/cgi-bin'. If you want higher performance, you can attempt a mod_wsgi setup.

Now Apache should be ready to go! You can run 'apachectl start' or 'service httpd start' (depending on your setup) in order to start it up. To test it (assuming you're browsing from the same machine you've setup), navigate to http://localhost/svn and http://localhost/autoinst, and you should be prompted to provide a username and password. Try the 'admin' username and password and see if things work OK.

Testing the Autoinst API and tools

Now we are ready to test the Autoinst tools.

Try the following from the command line:

$ ai -d http://localhost/autoinst/api list hosts
Enter username for Autoinst at localhost: admin
Enter password for admin in Autoinst at localhost: 

Nothing should be listed, because we haven't set anything up in the repository!

At this point you have a working Autoinst server installation and are ready to move onto setup hosts, groups, profiles, and actions.

ExampleSetup (last edited 2009-02-25 00:23:34 -0800 by ?mlum)