Skip to content

CLI setup

Nicholas K. Dionysopoulos edited this page Jul 18, 2023 · 4 revisions

IMPORTANT! This installation method is meant for expert users only.

You can install Akeeba Panopticon using the command-line, e.g. as part of a deployment using Ansible, Puppet, etc. It can also come in handy if the person installing Panopticon does not have access to the web interface itself, e.g. a contractor deploying Panopticon to an Intranet over a tunnelled SSH connection.

Below, you can find the discrete installation steps and the relevant commands.

Create a configuration file

Before you start installing Akeeba Panopticon you need to create a MySQL database, and a user which can access it. The database user needs to have the following privileges on this database: ALTER, CREATE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EXECUTE, INDEX, INSERT, LOCK TABLES, REFERENCES, SELECT, SHOW VIEW, UPDATE.

Then, you need to run the following command:

php cli/panopticon.php config:create --driver mysqli --host localhost --user USER --password PASS --name DBNAME \
    --prefix "ak_"

The driver can be one of mysqli (using the PHP mysqli / mysqlnd extension) or pdomysql (using the PHP pdo extension).

The rest of the parameters are your database connection parameters.

The prefix must be one to five lowercase alphanumeric characters (a-z, 0-9) followed by an underscore. It does not have any special meaning. It's used to allow Panopticon to be installed alongside other software sharing the same database.

Upon successful execution of this command the config.php file will be created in Panopticon's installation root.

Create the database tables

Run the command

php cli/panopticon.php database:update

This will automatically connect to the database and create the necessary database tables.

Tip: You can use the same command after updating Panopticon to update the database tables, if necessary. The database:update command is idempotent.

Create an administrator user

You need to create a user to access Akeeba Panopticon's web interface. For example:

php cli/panopticon.php user:create --username=admin --password="MyP@s5w0rD" --name "Super Administrator" --email="foo@example.com"

Tip: If you omit the --password parameter you will be asked to type in your password. If you are using an automation script you can feed the password and a newline character to STDIN (standard input) in this case. This is a more secure alternative to having your password logged in the deployment log.

Update the CRON jobs timing settings

Assuming that you will be running the Panopticon CRON jobs from a CLI context, run the following command:

php cli/panopticon.php config:maxtime:test

You will then need to run:

php cli/panopticon.php config:set max_execution 180
php cli/panopticon.php config:set finished_setup true

the number (180 in the example) being the maximum number of seconds reported by the previous command.

Set up the CRON job

Finally, set up a CRON job which runs every minute. For example, add the following to your crontab file:

* * * * * /path/to/php /path/to/panopticon/cli/panopticon.php task:run

where /path/to/php is the absolute path to the PHP-CLI executable and /path/to/panopticon is the absolute path to where Panopticon has been installed.

Tip: You can automate the creation of the CRON job using the following shell code:

crontab -u myuser -l > mycron
echo "* * * * * /path/to/php /path/to/panopticon/cli/panopticon.php task:run" >> mycron
crontab -u myuser mycron
rm mycron

where myuser is the username under which you want the CRON job to run, /path/to/php is the absolute path to the PHP-CLI executable, and /path/to/panopticon is the absolute path to where Panopticon has been installed.

Clone this wiki locally