[TOOL] HestiaCP Companion

I needed a simple app to help me generates templates for PHP-FPM and manage wildcard certificates, but I use Cloudflare for manage dns, so I built this simple CLI app.

Features:

  • Manage a wildcard certificates with an external DNS provider (supports Cloudflare and Gandi for now)
  • PHP-FPM template generation
  • Generates reverse proxy templates for http, https and unix sockets

Needless to say, the tool is far from mature and still pretty much beta, any suggestion, bugreport, feature and PRs are highly appreciated.

I would like to introduce those features upstream someday, this was a good chance to start digging inside the HestiaCP codebase.

2 Likes

Good job! Can you be more specific about the tool?

I mean, it’s pretty much in the list :smile:

Is a CLI app made in php, where you can generate fpm templates, specifying workers, timeout etc for now, that are automatically placed inside HestaCP directories, so you can select it on the panel for the website you want.
Same thing for the reverse proxy templates.

The wildcard certs manager: so hestiacp does not let you generate LE certificates for wildcards domains that are not managed by hestia dns server himself, so this is an external way overcome this limitation: it will handle the request and renewal, installation, and so on.

2 Likes

Thanks for the info @sergix44.
Can you list all commands available?

$ php ./hcpc; echo " ";for i in $(php ./hcpc  | sed -r '/^$/d' | tail -n +3 | awk '{print $1}');do echo -e "## Command $i\n\n";php ./hcpc help $i; echo "";done

  HestiaCP Companion  2.0.2

  USAGE:  <command> [options] [arguments]

  php-template             Makes a custom PHP-FPM template
  reverse-proxy            Install templates to create reverse proxy sites
  self-update              Allows to self-update a build application

  certificate:add-wildcard Save a new wildcard domain to the system
  certificate:remove       Remove a certificate from the hcpc subsystem
  certificate:renew        Renew certificates that are about to expire

  hestia:add-cron          Add a cron to HestiaCP to invoke the hpcp scheduler
 
## Command php-template


Description:
  Makes a custom PHP-FPM template

Usage:
  php-template [options] [--] [<name>]

Arguments:
  name                                            [default: "custom"]

Options:
      --phpVersion[=PHPVERSION]                  
      --maxChildren[=MAXCHILDREN]                 [default: "10"]
      --processIdleTimeout[=PROCESSIDLETIMEOUT]   [default: "5"]
      --maxRequests[=MAXREQUESTS]                 [default: "10000"]
  -h, --help                                     Display help for the given command. When no command is given display help for the list command
  -q, --quiet                                    Do not output any message
  -V, --version                                  Display this application version
      --ansi|--no-ansi                           Force (or disable --no-ansi) ANSI output
  -n, --no-interaction                           Do not ask any interactive question
      --env[=ENV]                                The environment the command should run under
  -v|vv|vvv, --verbose                           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

## Command reverse-proxy


Description:
  Install templates to create reverse proxy sites

Usage:
  reverse-proxy

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

## Command self-update


Description:
  Allows to self-update a build application

Usage:
  self-update

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

## Command certificate:add-wildcard


Description:
  Save a new wildcard domain to the system

Usage:
  certificate:add-wildcard

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

## Command certificate:remove


Description:
  Remove a certificate from the hcpc subsystem

Usage:
  certificate:remove

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

## Command certificate:renew


Description:
  Renew certificates that are about to expire

Usage:
  certificate:renew

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

## Command hestia:add-cron


Description:
  Add a cron to HestiaCP to invoke the hpcp scheduler

Usage:
  hestia:add-cron

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

1 Like

Very well written! Thanks again.

Hello, thanks for this tool.
Can you explain the installation & usage please ?

Hi @monsieurnoob

You can find this on the GitHub page of the project.
https://github.com/SergiX44/hestiacp-companion?tab=readme-ov-file

1 Like

Hello, thanks for your reply.
I’ve make php ./hcpc reverse-proxy but insite HestiaCP site, i’ve no reverse proxy field.

What’s difference between http_reverse_proxy and https_reverse_proxy ?
If i need to redirect to https server, do i need to choose https_reverse_proxy (and http_reverse_proxy for http server) ?
If all is work, you’ll save my life and maaaaaaany times !
Best regards

Since hestia doesnt support adding custom fields, the template exploits the proxy extension fields:

http/https/unix depends on the protocol that the proxied app is listening
The template works for nginx+apache configs, since with just nginx there is no proxy ext config to be used sadly

1 Like