Scripts voor server management

To make working - building, testing, using - with web applications easier, I have set up what was once called "virtual servers" in Apache terms. Maintaining the configuration files and putting them in the right places became an attractive target to tackle with a bit of scripting and at the time there was a library called fabric that made it easy. I figured I could do it with other settings files too.

In addition, there were server programs that had to be stopped and restarted for testing. Building something for this that you can control using parameters (like a server name and a function to perform) was also a nice excercise.

Available tasks:

Nginx

nginx.editconf <name>

edit a file related to the server configuration

nginx.addconf <name(s)>

enable Nginx configuration for one or more (file) names

nginx.modconf <name(s)>

deploy modifications for Nginx configuration file(s); replace version

nginx.modconfa <name(s)>

modconf: backup & append version

nginx.modconfb <name(s)>

modconf: backup & replace version

nginx.newconf <name(s)>

shortcut to define and enable a new Nginx config in one go

nginx.rmconf <name(s)>

disable Nginx configuration for one or more file names

nginx.diffconf [<name(s)>]

compare named (or all) configuration files

nginx.diffconfg [<name(s)>]

compare named (or all) configuration files + show results in gui

nginx.list

list available configs

nginx.list-domains

list of virtual domains per Nginx configuration

nginx.restart

restart nginx

nginx.start

start nginx

nginx.stop

stop nginx

Apache

apache.editconf <name>

edit a file related to the server configuration

apache.addconf <name(s)>

enable Apache configuration for one or more (file) names

apache.modconf <name(s)>

deploy modifications for Apache configuration file(s), replace version

apache.modconfa <name(s)>

modconf with append (and backup)

apache.modconfb <name(s)>

modconf with backup

apache.diffconf [<name(s)>]

compare named (or all) all Apache configurations

apache.diffconfg [<name(s)>]

compare names (or all) all Apache configurations, in gui

apache.rmconf <name(s)>

disable Apache configuration for one or more file names

apache.restart

restart apache

apache.start

start apache

apache.stop

stop apache

PHP

php.restart

restart php

php.start

start php

php.stop

stop php

FTP

ftp.restart

restart vsftpd

ftp.start

start vsftpd

ftp.stop

stop vsftpd

Generieke commando's

usable for any server type. The following scripts are not for the web server itself, but for programs that manage the communication with webapplications. These reside as it were behind the web server, that functions as a kind of pass-through interface, and are also called "server programs".

server.check-all [<name(s)>]

check for server being up assuming server is started when there is a pid file. No name == all registered local servers

server.restart

restart local server

server.start

start local server

server.stop

stop local server

Specifieke (per servertype) commando's

worden door de voorgaande gebruikt maar los aanroepen is ook mogelijk

Cherrypy

cherrypy.list-servers

list of cherrypy server names

cherrypy.restart [<name(s)>]

restart cherrypy site (arg:project)

cherrypy.start [<name(s)>]

start indicated cherrypy server(s) (through cherryd)

cherrypy.stop [<name(s)>]

stop indicated cherrypy server(s)

Django

django.list-servers

list of django server names

django.restart [<name(s)>]

restart django indicated server(s)

django.start [<name(s)>]

start indicated Django server(s) using manage.py

django.stop [<name(s)>]

stop indicated Django server(s)

django.link-admin-css [<name(s)>] [--force]:

add symlink to admin CSS for Django project

django.check-admin-links

After a Python or Django upgrade, check if symlinks to admin css need to be upgraded also

Hgweb

hgweb.restart

restart local Mercurial web server

hgweb.start

start local Mercurial web server using hgweb.fcgi

hgweb.stop

stop local Mercurial web server

Plone

plone.buildout

run buildout on Plone instance (obsolete?)

plone.restart

restart Plone default instance

plone.start

start Plone default instance

plone.stop

stop Plone default instance

Trac

trac.editconf

alias for (fabsrv) editconf trac

trac.modconf

alias for (fabsrv) modconf trac

trac.restart

restart local trac server

trac.start

start local trac server

trac.stop

stop local trac server

Overig

sites.check-all

check if selected pages on all local sites are working

sites.check-all-pages

full check if all local sites are working

sites.check-pages <servername(s)>

full check if the named local sites are working

sites.check-project <projectname(s)>

check if pages for specific projects are up

sites.check-project-up <projectname(s)>

check if (frontpages for) specific projects are up

sites.check-up <servername(s)>

quick (frontpage only) check if all local sites are working

sites.list-domains

list all domains that can be checked with these routines

Andere commando's

bedoeld voor het managen van andere configuraties (bv. trac, php)

addstartup

add an init file to the system startup sequence. This is written for Ubuntu/Mint (uses update-rc.d)

editconf <name(s)>

edit a file related to a configuration

listconf

list "other" configuration files

modconf <name(s)>

deploy modifications for configuration file(s); replace version

modconfa <name(s)>

modconf: backup & append version

modconfb <name(s)>

modconf: backup & replace version

diffconf

compare all or named configuration files that can be changed from here

diffconfg

compare all or named configuration files that can be changed from here, in gui