Skip to content

adminstock/htan-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTAN.Runner

Daemon to run and manage FastCGI processes, mainly fastcgi-mono-server.

Features

  • Automatic start and stop FastCGI processes;
  • Recovering processes;
  • Designed as service;
  • Starting the process on behalf of any user;
  • Support for event processing start and stop individual processes;
  • Threads based.

License

HTAN.Runner is licensed under the Apache License Version 2.0.

Requirements

  • Debian 7 or 8;
  • Mono >= 4.2.2.

NOTE: Earlier versions have not been tested.

Install

You can use the automatic installation through HTAN:

su -l root
chmod u=rx,g=rx /usr/lib/htan/installers/htan-runner
/usr/lib/htan/installers/htan-runner

Or installation through install.sh:

su -l root
chmod u=rx,g=rx ./install.sh
./install.sh

Uninstall

To remove daemon use command:

sudo update-rc.d -f htan-runner remove && sudo rm -r /etc/init.d/htan-runner

Using

The principle work of HTAN.Runner is similar to Nginx or Apache.

Create in the folder /etc/htan/app-available configuration files for your applications.

For example, file /etc/htan/app-available/example.conf:

<configuration>
  <fastCGI>
    <add address="unix:/tmp/example.org" command="fastcgi-mono-server4" />
  </fastCGI>
  <commands>
    <add name="fastcgi-mono-server4" 
         exec="fastcgi-mono-server4" 
         arguments="/applications=/:/home/example.org/www/ /socket={socket} /multiplex=True /verbose=True" 
    />
  </commands>
</configuration>

To activate the application, create a symbolic link:

sudo ln -s /etc/htan/app-available/example.conf /etc/htan/app-enabled

For the changes to take effect, restart htan-runner:

sudo service htan-runner reload

Structure of configuration files

The configuration files must be in XML format.

Recommended to use the extension .conf for file names.

All nodes must be in the root node configuration.

fastCGI

The fastCGI node contains a list of addresses to start.

Parameter Description
address Specifies the address to listen on.
Valid values are "pipe", "unix", and "tcp".
For example: unix:/tmp/example.org, tcp:127.0.0.1:9100.
The address will be replaced by substituted for the marker {socket} in the specified command.
command Command or command name (<commands />) which should be run via start-stop-daemon.
For example:
  • myCommandName
  • /usr/bin/fastcgi-mono-server4 /applications=/:/home/example/www/ /socket={socket}
beforeStartingCommand
(optional)
Command, command name or URL to be executed before executing the command.
For example:
  • myCommandName
  • echo "Starting..." >> custom.log
  • http://api.foxtools.ru/v2/QR.html?mode=Auto&text=Hello+world%21&details=1
afterStartingCommand
(optional)
Command, command name or URL to be executed after starting the command.
For example:
  • myCommandName
  • echo "Started" >> custom.log
  • http://example.org/
beforeStoppingCommand
(optional)
Command, command name or URL to be executed before stopping.
afterStoppingCommand
(optional)
Command, command name or URL to be executed after stopping.
stoppingTimeout
(optional)
Maximum waiting time stopping the process (in seconds). Default: 10 seconds.

commands

The commands node contains a list of available commands.

Parameter Description
name Command name. Any convenient set of characters.
For example: myCommandName.
exec Command line to be executed.
For example:
  • service nginx reload
  • echo "Hello world!" | mail -s "Test message" -t "[email protected]"
  • /usr/bin/fastcgi-mono-server4
  • /usr/bin/fastcgi-mono-server4 /applications=/:/home/example/www/ /socket={socket}
  • echo "Any command"
arguments
(optional)
Additional arguments that will be passed to the command.
For example:
  • -n -e
  • /applications=/:/home/example/www/ /socket={socket}
user
(optional)
User name under which the command is executed.
Default: root.
group
(optional)
Group name under which the command is executed.
Default: root.

Disable application

To disable the application, just to remove a symbolic link and restart the service:

sudo rm /etc/htan/app-enabled/example.conf
sudo service htan-runner reload

Log

Log of the program can be found at: /var/log/htan/runner.log

See Also