knutov / dancerctl

like apachectl for Dancer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dancerctl

dancerctl - Like apachectl for perl/Dancer apps. Small tool that can start/stop/restart Dancer apps.

Usage

dancerctl action [appname [environment]]

Where action can be

start, stop, restart
status
help
init
startall, stopall, restartall, statusall
              

environment - usually 'development' or 'production' (by default). Default environment is used if no environment specified.

Examples under not root user:

dancerctl start|stop|restart|status app [environment]
dancerctl startall|stopall|restartall|status|statusall
dancerctl help
dancerctl init appname path [force]

Examples under root(!) user: [not implemented now]

dancerctl user [action [app [environment]]]

Not implemented now, but will be in future

dancerctl setup   [not implemented]
dancerctl update  [not implemented]
dancerctl list    [not implemented]

dancerctl init

init will create config for app with default recommended values. Default config can be placed in recommended: section to /etc/dancerctl.conf otherwise the __DATA__ section of dancerctl script will be used.

dancerctl init appname path [force]
    * path counted from user dir: app -> /home/user/app
    * when 'force' the config file will be overwritten if exists.

Examples:

# example 1: 
    dancerctl init app path/to/app
# example 2: 
    cd path/to/app
    dancerctl init app `pwd`
# example 3: config will be recreated
    cd path/to/app
    dancerctl init app `pwd` force

Configs (ORDER BY priority DESC)

~/.dancerctl/$appname [environment: section]
~/.dancerctl/$appname [root param]
/etc/dancerctl.conf

Config format: YAML for the ~/.dancerctl/$appname and any ini-style (better YAML too) for the /etc/dancerctl.conf

Config example

See app.yml which should be moved to /home/user/.dancerctl/ and renamed to app.

    * NOTE! Names of parameters in config can be changed in next versions

Global %ENV params

It is possible to use to global parameters in %ENV:

DANCERCTL_CONF  - default config for dancerctl, instead of /etc/dancerctl.conf
DANCERCTL_DEBUG - enable/disable debug mode, has more priority, then in dancerctl.conf

Examples:
  export DANCERCTL_CONF=/path/to/local/dancerctl.conf
  DANCERCTL_DEBUG=1 dancerctl statusall

Install

perl 5.10, Config::Auto and YAML::Tiny are required.

curl -L http://cpanmin.us -k | perl - --self-upgrade
cpanm Config::Auto YAML::Tiny

cd ~
mkdir dancerctl
cd dancerctl
git clone git://github.com/knutov/dancerctl.git ./
alias d='~/dancerctl/dancerctl'
d help

dancerctl was tested under modern version of Ubuntu (11.04). Some parts (like 'status') may not work under different linuxes and OSes (note hardcoded slashes and format of ps lax).

You can get 'dev' branch with latest changes with

git clone git://github.com/knutov/dancerctl.git ./ -b dev  

Copyright (c) 2011, Nick Knutov, nick@knutov.com, https://github.com/knutov/dancerctl

License

BSD 2-Clause License (http://en.wikipedia.org/wiki/BSD_licenses)

About

like apachectl for Dancer


Languages

Language:Perl 100.0%