User Tools

Site Tools


projects:scriptcommander

ScriptCommander

ScriptCommander is a Ruby cgi / AJAX web web application written by Nik Wolfgramm. The application can launch svn update/switch commands and other project maintenance scripts to manage (svn enabled) web application projects.

Features

  • runs subversion info, log and switch commands
  • runs bash scripts
  • multi user support and multi project support (different users can have different projects)
  • configuration over yaml files
  • all user interventions are being logged

Installation

Application checkout from svn

Go to your desired web root and create the application directory:

mkdir ScriptCommander
mkdir ScriptCommander/htdocs

Checkout the desired release from svn.

Set ownership an permissions:

chown -R scriptcmd:scriptcmd ScriptCommander/htdocs
chmod -R 755 ScriptCommander/htdocs
chmod -R 750 ScriptCommander/htdocs/include
chmod -R 750 ScriptCommander/htdocs/config
chmod -R 750 ScriptCommander/htdocs/log

Copy example config files and adapt them to your needs:

cp ScriptCommander/htdocs/config/propjects.yml.example ScriptCommander/htdocs/config/propjects.yml
cp ScriptCommander/htdocs/config/svn.yml.example ScriptCommander/htdocs/config/svn.yml

Create a user for the application:

htpasswd -cm ScriptCommander/.htpasswd scriptcmd

Apache Setup

The host running the ScriptCommander applications needs to be setup for cgi execution of ruby files and suexec. See the following example configuration:

# scriptcmd ScriptCommander
<VirtualHost 127.0.0.1:80>
  ServerName scriptcmd.com
  DocumentRoot /var/www/ScriptCommander/htdocs
  CustomLog logs/scriptcmd.com-access_log combined
  ErrorLog logs/scriptcmd.com-error_log
  TimeOut 600
  SuexecUserGroup scriptcmd scriptcmd
  <Directory /var/www/ScriptCommander/htdocs>
    AddHandler cgi-script .rb
    Options +ExecCGI
    DirectoryIndex index.rb
    Order deny,allow
    Allow from 127.0.0.1
    AuthType Basic
    AuthName "admin.scriptcmd.com"
    AuthUserFile "/var/www/ScriptCommander/.htpasswd"
    Require valid-user scriptcmd
  </Directory>
</VirtualHost>

Enable svn commands to run on project directories

  1. user scriptcmd must have r/w rights on project dirs especially on the .svn folders
    chown -R scriptcmd:scriptcmd htdocs/
  2. Change to the project web root (scriptcmd.com OR api2.scriptcmd.com OR cms01.scriptcmd.com) and run the following first svn command
    sudo -u scriptcmd svn log --username scriptcmdadmin-reader --password "<password>" --config-dir htdocs/.svn/ htdocs/
  3. IMPORTANT: accept certificates permanently

Configure ScriptCommander

All projects are configured in the configuration file include/config.rb. An example can be found under include/config.rb.example.

SVN credential

Configure the user which has read access to the svn repositories in config/svn.yml

# configure a user which has read access your subversion repositories
username: scriptcmdadmin-reader
password: secret

Projects

Properties

name usage comment
display project display name will be shown in the menu and title
description project description short description of the project
active true OR false projects are only loaded if active
local_path local project path absolute path to the working copy
url URL of the application domain full URL with prorocol
svn_url URL of the svn repository root full URL with protocol
users users which can work on the project user name comes from HTTP basic auth
'ALL' opens project for all users
actions all actions for the project grouped under group name see /config/actions.yml for all configured actions

Configure projects in config/projects.yml. Below you see an example project configuration:

# configure all projects you wish to appear on the interface
# - the first in the list is automatically the default project
# - set "active" to false to hide it from the interface
scriptcmd.com:
  description: scriptcmd.com live site
  display: www.scriptcmd.com
  active: true
  local_path: /mnt/nas/srv/www/scriptcmd/scriptcmd.com/htdocs/
  url: http://www.scriptcmd.com/
  svn_url: https://svn.icc.scriptcmdgroup.com/repos/scriptcmd.com/
  users:
  - scriptcmd
  - example
  actions:
    subversion:
    - svn_info
    - svn_log
    - svn_list_tags

Sorting Projects / Tabs

Projects / Tabs are sorted by key, this means you can simply rename keys to have the tabs sorted in the manner you like. As example you could insert a two number digit as first values of the key:

01-project1:
 ...
02-myproject:
 ...

Trouble Shooting

Access Problems

If a local user executed svn commands directly on the server, it's possible that ScriptCommander hasn't the access rights anymore to execute commands on the project.

How to fix this issue:

  1. Go directly on the server to the specific directory
  2. Redo the following steps from above: Enable svn commands to run on project directories

Known issues

  1. If a script runs very long (> 2 min) a timeout can occur “Error: Something went wrong…”

scriptcmd

/srv/wiki.niwos.com/data/pages/projects/scriptcommander.txt · Last modified: 2009/08/15 13:00 (external edit)