Loading...
 
Skip to main content

Tiki Manager

Tiki Manager permits you to manage various instances of Tiki. You can install, upgrade, backup, clone, check the file integrity and do various other things. This can be done on the same server or a remote server. Most actions can be run unattended on a cron job. It can be used via the command line or a web interface.

Tiki Manager supercedes TRIM.

Coming to Tiki25: Tiki Manager Package

Requirements

  • SQLite3 for data storage
  • PHP 7.4+ with Command-line access (CLI). (Before 2023-07-04, it required PHP 7.1

It uses the Symfony Console Component.

    • It uses Composer for dependency management.
  • Git
  • Standard server tools like rsync, unzip, etc.
  • It's been developed on GNU/Linux, and designed to work anywhere PHP, SQLite and Git are available (Windows, MacOS, *BSD, etc.)


You can use Check to verify that your server can run Tiki or Tiki Manager

Installation

These are general instructions for Linux. You may need to adapt for your operating system. See also Additional configuration below.

At a high level:

  1. Use Server Check to review and get all the server dependencies
  2. Get code from Git in a non-web accessible directory: https://gitlab.com/tikiwiki/tiki-manager.git
  3. Run Tiki Manager with php tiki-manager.php to complete set up. It will instruct you how to do so (ex.: run Composer to get PHP dependencies)


Example commands (that worked for me on Debian 9 )

Install Tiki Manager
Copy to clipboard
# Navigate to your working directory (__Do not install in a web accessible directory__) and run the following git command $ git clone --depth 1 --branch master https://gitlab.com/tikiwiki/tiki-manager.git # Navigate to the tiki-manager directory with "cd tiki-manager" # Then run the following. On first run, it will finish the setup (Fetch Composer and get PHP dependencies, Create the SQLite database, etc.) $ php tiki-manager.php manager:info

Documentation

Here is a brief explanation of the basic commands that can be used. All commands follow a wizard pattern.

For more help, you can add --help to any command as in this example
Copy to clipboard
php tiki-manager.php instance:create --help

instance

instance:create

Adds an instance to be managed by Tiki Manager, which can mean either:

  • create a fresh Tiki instance (including a database) fetching files from Git (and optionally SVN)
  • or detect an existing Tiki installed via Git or Subversion (SVN) and "adopt" it.
  • You may need to convert your Tiki instance from FTP to Git.


Params

Params Type Description
blank option Blank Instance
type option Instance connection type
host option Remote host name
port option Remote port number
user option Remote User
pass option Remote password
url option Instance web URL
name option Instance name
email option Instance contact email
webroot option Instance web root
tempdir option Instance temporary directory
branch option Instance branch
backup-user option Instance backup user
backup-group option Instance backup group
backup-permission option Instance backup permission
db-host option Instance database host
db-user option Instance database user
db-pass option Instance database password
db-prefix option Instance database prefix (creates an user and database)
db-name option Instance database name (when db-prefix is not used)

Copy to clipboard
php tiki-manager.php instance:create

Non interactive command:

Copy to clipboard
php tiki-manager.php instance:create --type=local --url=http://manager.tiki.org --name=manager.tiki.org --email=manager@example.org --webroot=/www/manager --tempdir=/tmp/trim_temp --branch=branches/19.x --backup-user=www-data --backup-group=www-data --backup-permission=750 --db-host=localhost --db-user=root --db-pass=secret --db-prefix=manager

instance:list

Copy to clipboard
php tiki-manager.php instance:list

Params Type Description
json option Instance list in a parsable format

instance:access

Opens a shell to the remote host.
Since Tiki Manager manages all your connections, using this command simply avoids needing to remember passwords.

Params

Params Type Description
instances option List of instance IDs or Names to be checked, separated by comma (,)

Copy to clipboard
php tiki-manager.php instance:access

instance:backup

Tiki Manager performs a complete backup of the Tiki instance.
The backup includes all files (using rsync for efficient bandwidth management) on remote host (including user files and files stored out of the web root) and a dump of the database. Each backup is archived in the backup/archive folder as a .tar.bz2 file, where Tiki Manager is installed.
The backup file contains:

  • manifest.txt: Indicates where folders were located on the remote host
  • database_dump.sql: Self-explanatory
  • [a-f0-9]{32}: Folders named using a hash. Content of the folders on remote host. The manifest.txt file lists these hashes.


Params

Params Type Description
instances option List of instance IDs or Names to be checked, separated by comma (,)
exclude option Used with --instances=all, a list of instance IDs to exclude from backup
email option Email addresses to notify for backup failures (comma separated)
max-backups option Max number of backups to keep by instance

Copy to clipboard
php tiki-manager.php instance:backup

instance:blank

Like instance:create but it doesn't actually add a Tiki. It just creates an instance that can be used to restore or clone another instance.

Copy to clipboard
php tiki-manager.php instance:blank

Copy to clipboard
php tiki-manager.php instance:create blank

instance:checkout

CheckoutCommand: allow checking out a specific Git branch and revision for main Tiki codebase or local checkouts of themes, for example. Original commit.

Params

Params Type Description
instance accepts one instance ID
folder either specify 'tiki' to update main Tiki codebase or a subfolder (e.g. themes/XYZ) - folder might exist or not exist. If it exists - it must be a Git checkout. In this case, the specified branch/revision will be checked out. If it doesn't exist, you should also specify a URL and it will be cloned into that folder.
url url of the Git repo - only used if checking out a new folder (e.g. checking out a new theme on a fresh Tiki)
branch the branch name. It is a type field currently but we can make it a dropdown with all available remote branches - will need some time to code. A suitable task for a little advanced junior.
revision optionally specify a commit ID/tag to checkout a specific revision

Copy to clipboard
php tiki-manager.php instance:checkout


This useful for A theme managed in Git

instance:clone

Makes another identical copy of Tiki. This is basically a combination of make backup and make restore in one operation.
The destination instance can be blank or another configured and managed Tiki Instance. Be very careful, when using existing another Tiki Instance, as the data here will be wiped and replaced by the data from the source instance.

As two Tiki instances with the same settings (ex.: both point to the same Elasticsearch index can cause issues), recommended reading: Divergent Preferences in Staging Development Production

The following are excluded from the cloning process:

  • db/local.php (the database access info needs to point to another database)
  • the .ini.php file (if any) used for System Configuration



Params

Params Type Description
mode parameter Check if is a clone or upgrade
check option Check files checksum. Only used in mode upgrade.
source option Source instance.
target option Destination instance(s).
branch option The instance branch to clone.
skip-reindex option Skip rebuilding index step. (Only in upgrade mode).
skip-cache-warmup option Skip generating cache step. (Only in upgrade mode).
live-reindex option Set instance maintenance off and after perform index rebuild.
direct option Use rsync to copy files between local instances.
keep-backup option Source instance backup is not deleted before the process finished.
use-last-backup option Use source instance last created backup.
db-host option Target instance database host
db-user option Target instance database user
db-pass option Target instance database password
db-prefix option Target instance database prefix (creates an user and database)
db-name option Target instance database name (when db-prefix is not used)
stash option Saves your local modifications, and try to apply after update/upgrade.
timeout option Modify the default command execution timeout from 3600 seconds to a custom value.
ignore-requirements option Ignore version requirements. Allows to sele ct non-supported branches, useful for testing.
only-data option Clone only database and data files. Skip cloning code.
only-code option Clone only code files. Skip cloning database.

Copy to clipboard
php tiki-manager.php instance:clone

instance:cloneandredact

This command allows you to clone an instance and redact the clone,
make a clone of an instance and redact it.

Params

Params Type Description
instances option List of instance IDs to be redacted, separated by comma (,).

Copy to clipboard
php tiki-manager.php instance:cloneandredact

instance:cloneandupgrade

Like instance:clone but with an extra upgrade operation.

As two Tiki instances with the same settings (ex.: both point to the same Elasticsearch index can cause issues), recommended reading: Divergent Preferences in Staging Development Production

The following are excluded from the cloning process:

  • db/local.php (the database access info needs to point to another database)
  • the .ini.php file (if any) used for System Configuration


Params

Params Type Description
mode parameter Check if is a clone or upgrade.
check option Check files checksum. Only used in mode upgrade.
skip-reindex option Skip rebuilding index step.
skip-cache-warmup option Skip generating cache step.
live-reindex option Set instance maintenance off and after perform index rebuild.
direct option Use rsync to copy files between local instances.
keep-backup option Source instance backup is not deleted before the process finished.
use-last-backup option Use source instance last created backup.db-host option Target instance database host
source option Use a certain source instance, ID or name.
target option Use a certain target instance, ID or name.
branch option The branch (version) used for the upgrade i.e the branch you want to upgrade to.
db-host option Target instance database host.
db-user option Target instance database user.
db-pass option Target instance database password.
db-prefix option Target instance database prefix (creates an user and database).
db-name option Target instance database name (when db-prefix is not used).
stash option Saves your local modifications, and try to apply after update/upgrade.
timeout option Modify the default command execution timeout from 3600 seconds to a custom value

Copy to clipboard
php tiki-manager.php instance:cloneandupgrade

instance:console

Allow to run any Console command from Tiki.

Copy to clipboard
php tiki-manager.php instance:console


Example to clear cache (it will request the instance ID):

Copy to clipboard
php tiki-manager.php instance:console --command="cache:clear all"


Example with chosen instance:

Copy to clipboard
php tiki-manager.php instance:console --instances=5 --command="cache:clear all"

instance:copysshkey

Copy the SSH key to the remote instance. This is used as part of other commands but can be used as standalone as well - copies the Tiki Manager SSH key to the remote machine by asking you for the password to connect to, so Tiki Manager can authenticate via its public/private key pair and skip asking for passwords on all subsequent operations.

Copy to clipboard
php tiki-manager.php instance:copysshkey

instance:delete

Delete the instance via the command line (you could also do via the web interface). This does NOT delete your Tiki. It just deletes the instance connection to it.

Copy to clipboard
php tiki-manager.php instance:delete

instance:detect

Detect Tiki branch or tag, and PHP version. For debugging purposes. Also useful if you manually proceeded to svn switch and Tiki Manager needs to update its internal database about a Tiki instance.

Copy to clipboard
php tiki-manager.php instance:detect

instance:edit

Permits to modify an instance.

Copy to clipboard
php tiki-manager.php instance:edit

instance:fixpermissions

Run setup.sh on the remote host using automated parameters. It should work in most cases. If the command proposed my setup.sh without parameters or super user rights are required, you should connect to the remote host manually using `instance:access`.

Copy to clipboard
php tiki-manager.php instance:fixpermissions

instance:import

Import an instance to the instances list, if detects a Tiki instance, and it’s not yet managed by Tiki Manager.

Params

Params Type Description
type option Instance connection type
host option Remote host name
port option Remote port number
user option Remote User
pass option Remote password
url option Instance web URL
name option Instance name
email option Instance contact email
webroot option Instance web root
tempdir option Instance temporary directory

Copy to clipboard
php tiki-manager.php instance:import

Non interactive command:

Copy to clipboard
php tiki-manager.php instance:import --type=local --url=http://manager.tiki.org --name=manager.tiki.org --email=manager@example.org --webroot=/www/manager --tempdir=/tmp/trim_temp

instance:maintenance

Put instances under maintenance or live mode.

Copy to clipboard
php tiki-manager.php instance:maintenance

instance:patch

https://gitlab.com/tikiwiki/tiki-manager/-/merge_requests/271

instance:patch:list

Copy to clipboard
php tiki-manager.php instance:patch:list

instance:patch:delete

Copy to clipboard
php tiki-manager.php instance:patch:delete

instance:patch:apply

Copy to clipboard
php tiki-manager.php instance:patch:apply

--instances=INSTANCES List of instance IDs to apply the patch on, separated by comma (,)
--package=PACKAGE Composer package name or 'tiki' if it is a MR to the Tiki codebase
--url=URL Url of the patch, e.g. https://gitlab.com/tikiwiki/tiki/-/merge_requests/1374.patch


Both GitLab and GitHub support patch and diff outputs of Merge/Pull requests:


Example:

Copy to clipboard
php tiki-manager.php instance:patch:apply https://gitlab.com/tikiwiki/tiki/-/merge_requests/1245.patch


instance:profile:apply

Apply a profile to an instance.

Copy to clipboard
php tiki-manager.php instance:profile:apply

instance:restore

Restore on a blank installation. Ref: instance:blank If you have data files that are not stored in the database, you should use the ideal scenario for data file storage and relative paths.

Copy to clipboard
php tiki-manager.php instance:restore

instance:revert

Revert a particular instance working dir to its original branch state (aka git hard reset). Thus, it removes any applied patches

Copy to clipboard
php tiki-manager.php instance:revert

instance:setup-scheduler-cron

This command allows you to enable the cron to run the schedulers

Copy to clipboard
php tiki-manager.php instance:setup-scheduler-cron


Itcan be used interactively or without interaction. Ex.:

Copy to clipboard
php tiki-manager.php instance:setup-scheduler-cron -i 1 --time="*/10 * * * *"

Possible options:

Copy to clipboard
--update // Update existing cronjob --enable // Uncomment the # from the cronjob line --disable // Comment with # the cronjob line --check // Just check if there is cronjob configured


The command will not work for instances running Windows.

instance:stats

Extract stats (KPIs) from selected instances as csv. Optionally that information can be pushed to another Tiki instance.

Params

Params Type Description
instances option all or list instances to fetch KPI, separated by comma (,). Default is all
exclude option List of instance IDs to be excluded, separated by comma (,)
file option File name to output the stats. Required when --push-to is used.
push-to option Instance ID to push collected instance stats

Copy to clipboard
# Display all instance stats php tiki-manager.php instance:stats
Copy to clipboard
# Save stats to a csv file php tiki-manager.php instance:stats --instances=all --file=instance_stats.csv
Copy to clipboard
# Upload instances stats to another tiki instance # Using TIKI_ROOT will match instance webroot php tiki-manager.php instance:stats --instances=all --exclude=1 --file=TIKI_ROOT/temp/instance_stats.csv --push-to=1

instance:update

  • Does a dry-run first, and aborts on any conflicts
  • Updates to latest code in that branch (or trunk) using svn up and thus merging any changes
  • And all operations should be done after updating the code
    • Updates the file hashes accordingly. The hash verification/update may prompt with some files containing conflicts if modifications were made on the instance.
    • Performs the database update.
    • Runs setup and Composer,
    • Clears cache
    • Rebuilds search index


During the update process, the instance is disabled using a .htaccess file (previous one is preserved), making the site unavailable until the update is completed.

Params

Params Type Description
mode parameter Check if is an auto or switch mode
instances option List of instance IDs or Names to be checked, separated by comma (,)
branch option Instance branch to update
check option Check files checksum.
skip-reindex option Skip rebuilding index step.
skip-cache-warmup option Skip generating cache step.
live-reindex option Set instance maintenance off and after perform index rebuild.
email option Email address to notify in case of failure. Use , (comma) to separate multiple email addresses.
lag option Time delay commits by X number of days. Useful for avoiding newly introduced bugs in automated updates.
stash option Saves your local modifications, and try to apply after update/upgrade
ignore-requirements option Ignore version requirements. Allows to select non-supported branches, useful for testing.

Copy to clipboard
php tiki-manager.php instance:update

instance:upgrade

Similar to update. Requests for the branch to switch to over the update. You will have several choices of branches. Please note that you should NOT downgrade as Tiki doesn't support a downgrade database script. An upgrade is a one-way street! You should make a backup before you upgrade so you can return to this version if issues arise.

If you choose to do a manual upgrade (with svn switch).

Params

Params Type Description
check option Skip files checksum check for a faster result. Files checksum change won\'t be saved on the DB.
instances option List of instance IDs to be updated, separated by comma (,).
branch option The branch (version) you want to upgrade to
skip-reindex option Skip rebuilding index step.
skip-cache-warmup option Skip generating cache step.
live-reindex option Set instance maintenance off and after perform index rebuild.
lag option Time delay commits by X number of days. Useful for avoiding newly introduced bugs in automated updates.
stash option Saves your local modifications, and try to apply after update/upgrade.
ignore-requirements option Ignore version requirements. Allows to select non-supported branches, useful for testing.

Copy to clipboard
php tiki-manager.php instance:upgrade

instance:verify

This is equivalent to a secdb check, except that it's safer because it's made from a trusted host and will take your custom modifications on host into consideration. Upon first run, the check will ask where it should fetch the hashes from.
Params

Params Type Description
instances option List of instance IDs or Names to be checked, separated by comma (,)
update-from option Action related to how checksums are performed. Accepted values - current or source.
Copy to clipboard
php tiki-manager.php instance:verify

instance:watch

This command perform the Hash check (instance:verify). The script will prompt for a contact email address to notify with the log in the case of a suspicious file change (which could be an intrusion or someone who legitimately changed a file on the server).

Params

Params Type Description
email option Email address to contact.
exclude option List of instance IDs to be excluded, separated by comma (,)

Copy to clipboard
php tiki-manager.php instance:watch

backups

backups:setup

Same as manager:setup-backups.

Copy to clipboard
php tiki-manager.php backups:setup

backups:delete

Delete Tiki Manager backups folder and contents. This folder contains the backups of instances managed by Tiki Manager.

Copy to clipboard
php tiki-manager.php backups:delete

backup:ignore:add

Add one or more paths to the list of ignored paths when doing backups. Helpful to avoid adding to thebackup big files or files being backup in a different way.

Params

Params Type Description
instance option Id of the instance you want to change the ignore list
path parameter One or more paths to ignore

Copy to clipboard
php tiki-manager.php backup:ignore:add -i|--instance <InstanceId> <path> [<path>]

backup:ignore:list

Add one or more paths to the list of ignored paths when doing backups. Helpful to avoid adding to thebackup big files or files being backup in a different way.

Params

Params Type Description
instance option Id of the instance you want to see the ignore list, if not provided, will list all instances

Copy to clipboard
php tiki-manager.php backup:ignore:list [-i|--instance <InstanceId>]

backup:ignore:remove

Add one or more paths to the list of ignored paths when doing backups. Helpful to avoid adding to thebackup big files or files being backup in a different way.

Params

Params Type Description
instance option Id of the instance you want to change the ignore list
all option If the option --all is provided all ignore paths are removed for this instance
path parameter One or more existing ignore paths to remove

Copy to clipboard
php tiki-manager.php backup:ignore:remove -i|--instance <InstanceId> [ --all | <path> [<path>] ]

cache

cache:clear

Delete Tiki Manager cache folder. Useful for development.

Copy to clipboard
php tiki-manager.php cache:clear


database

database:delete

  • Delete Tiki Manager database. Useful for development.
Copy to clipboard
php tiki-manager.php database:delete

database:view

  • View Tiki Manager database. For debug purposes and useful for development.
Copy to clipboard
php tiki-manager.php database:view

logs

logs:clear

Clear Tiki Manager logs folder.

Copy to clipboard
php tiki-manager.php logs:clear

manager

manager:info

  • Display running OS, PHP version and binary used by Tiki Manager
Copy to clipboard
php tiki-manager.php manager:info

manager:check

  • Check OS requirements to execute Tiki Manager
Copy to clipboard
php tiki-manager.php manager:check

manager:report

  • Reports, and send reports to a Tiki instance using Data Channels.
Copy to clipboard
php tiki-manager.php manager:report

manager:setup-clone

  • Setup a cronjob to perform instance clone.
Copy to clipboard
php tiki-manager.php manager:setup-clone

manager:test-send-email

  • Test send email.
Copy to clipboard
php tiki-manager.php manager:test-send-email

tiki:versions

  • Shows all versions of Tiki.
Copy to clipboard
php tiki-manager.php tiki:versions


Params

Params Type Description
instance option When provided, will only return versions of tiki compatible with that instance (taking into consideration the instance PHP version)
upgrade option When used together with instance, will display only versions compatibles with the instance and that are an upgrade from the current instance version. If instance is not used, then is ignore.
phpexec option When provided the version returned by that PHP binary will be used to filter the list of compatible versions. When instance is also defined, this parameter is ignored.
format option Allows to output the information as table (default) or simple, the later allows easier integration with script as it outputs the values only
file option when set, instead of generating the output to the screen, the version list will be written to the file provided.

manager:reset

  • Delete Tiki Manager backup, cache, and log files. Useful for development.
Copy to clipboard
php tiki-manager.php manager:reset

manager:setup-backups

Set-up a cronjob to perform automatic instance(s) backups (instance:backup) every day at a specific time. The script will prompt for the time which the cron should run at and the instances that will be ignored by these automatic backups (all instances are selected by default).

  • Automatic backups cronjob should not run at the same time as the "manager:setup-update" cron job command. Make sure you pick different run times.


Params

Params ParamsType Description
time option Time to trigger the instance(s) backup using the format <hours>:<minutes>
exclude option List of instance IDs to be excluded from the backup, separated by comma (,)
email option Email address to report backup failures (multiple emails must be separated by comma (,)).
max-backups option Max number of backups to keep by instance

Copy to clipboard
php tiki-manager.php manager:setup-backups

manager:setup-update

Set-up a cron job to perform automatic instance(s) update (instance:update) every day at a specific time. The script will prompt for the time which the cron should run at and the instances that will be affected by this automatic update.

Params

Params ParamsType Description
time option Time to trigger the instance(s) update using the format <hours>:<minutes>
instances option List of instance IDs or Names to be checked, separated by comma (,)
email option Email address to report update failures (multiple emails must be separated by comma (,))

Copy to clipboard
php tiki-manager.php manager:setup-update

manager:setup-watch

Set-up a cron job on the Tiki Manager master to perform the Hash check (instance:verify) automatically every day. The script will prompt for a contact email address to notify with the log in the case of a suspicious file change (which could be an intrusion or someone who legitimately changed a file on the server) and the time at which the script should run.

Params

Params Type Description
email option Email address to contact.
time option The time update should run.
exclude option List of instance IDs to be excluded, separated by comma (,)

Copy to clipboard
php tiki-manager.php manager:setup-watch

manager:update

Update Tiki Manager to the latest version available. This updates the PHP code from Git, and updates the Composer dependencies.

Params

Params Short Type Description
--check -c option Only checks if there is new version available for update.
--yes -y option Say yes to update

Copy to clipboard
php tiki-manager.php manager:update --check
Copy to clipboard
php tiki-manager.php manager:update -y


For installations (without Phar or Git), to enable update, add the following file .version to the Tiki-Manager root.

Copy to clipboard
{"version":"bf63ffa", "date":"2020-05-03T23:32:58+01:00"}


Additional configuration


To easily configure the Tiki Manager application, copy `.env.dist` file to `.env` and insert your configurations for the uncommented (#) entries.

Version Control System

Tiki Manager by default uses git and public repository. If you want to use SVN (but you shouldn't as SVN is no longer supported) as your default vcs or another repository please use the following lines in your .env file.

Copy to clipboard
DEFAULT_VCS=svn GIT_TIKIWIKI_URI=<CUSTOM_GIT_REPOSITORY_URL> SVN_TIKIWIKI_URI=<CUSTOM_SVN_REPOSITORY_URL>

Behind proxy or without internet connection


Tiki Manager is able to use Tiki's distributed version packages as an alternative when there is no connection to external servers like GitLab or SourceForge.

Setting the default VCS to src, Tiki Manager will use existing packages in the data/tiki_src folder (default).

Copy to clipboard
DEFAULT_VCS=src


Download the distributed Tiki packages, from https://sourceforge.net/projects/tikiwiki/files/, and save them into data/tiki_src folder.

Email settings

To configure Tiki Manager email sender address add the following line to your .env file.

Copy to clipboard
FROM_EMAIL_ADDRESS=<SENDER_EMAIL_ADDRESS>

Configure SMTP Server

By default Tiki Manager uses sendmail to send email notifications. If you intend to use SMTP instead add the following lines to your .env file.

Copy to clipboard
SMTP_HOST=<SERVER_ADDRESS> SMTP_PORT=<SERVER_PORT> SMTP_USER=(optional if authentication is required) SMTP_PASS=(optional if authentication is required)

Web Manager settings

If you want to setup a default folder to install your web manager or apache user:group are different than apache:apache you can add the following settings to your .env file.

Copy to clipboard
WWW_PATH=<WEB_MANAGER_FOLDER> WWW_USER=<APACHE_USER> WWW_GROUP=<APACHE_GROUP>


To change the maximum number of failed login attempts on Web Manager, add the following setting to your .env file.

Copy to clipboard
MAX_FAILED_LOGIN_ATTEMPTS=<NUMBER>

Timeouts during long running operations


During long operations (like clone or clone and upgrade) you may receive an HTTP error code 503 with a message "Service Unavailable", you can increase Apache's proxy timeout to a more suitable value.
To do that at the Virtual Host level (so it's only enabled for tiki manager) you need to do the following:

Add the Apache directive ProxyTimeout to Tiki Managers VirtualHost configuration file.
Example: ProxyTimeout 300 will set the proxy timeout to 5 minutes

Hooks


Tiki Manager since 2024-02-08 supports hook system, to execute scripts (shell scripts) before or after the command.
This can be useful to execute a backup encryption or move backups to different folders or even trigger notifications.

Every command can have a pre and post scripts.

See more context in the feature request: https://gitlab.com/tikiwiki/tiki-manager/-/issues/22

Adding a hook


To add a script to be executed before or after the command, you need to add the script file into the folder following this structure:
/hooks/<command>/<action>/<filename>.sh

Command is the name of the command being executed, replace : with -

In this example lets create a post execution hook for instance:create command
The path will be /hooks/instance-create/post/notify.sh

Hook variables


Each command can register different variables. Commands that do interact with instances will add the instances properties.

Copy to clipboard
INSTANCE_IDS # A list with the instances ids, that are available in the environment variables (comma separated) INSTANCE_TYPE_<INSTANCE_ID> INSTANCE_VCS_TYPE_<INSTANCE_ID> INSTANCE_NAME_<INSTANCE_ID> INSTANCE_WEBROOT_<INSTANCE_ID> INSTANCE_WEBURL_<INSTANCE_ID> INSTANCE_TEMPDIR_<INSTANCE_ID> INSTANCE_PHPEXEC_<INSTANCE_ID> INSTANCE_PHPVERSION_<INSTANCE_ID> INSTANCE_BACKUP_USER_<INSTANCE_ID> INSTANCE_BACKUP_GROUP_<INSTANCE_ID> INSTANCE_BACKUP_PERM_<INSTANCE_ID> INSTANCE_BRANCH_<INSTANCE_ID> INSTANCE_LAST_ACTION_<INSTANCE_ID> INSTANCE_LAST_ACTION_DATE_<INSTANCE_ID>

Additional vars per command


instance:patch:apply

Copy to clipboard
INSTANCE_BACKUP_FILE_<INSTANCE_ID> PATCH_PACKAGE PATCH_URL


instance:backup

Copy to clipboard
INSTANCE_BACKUP_FILE_<INSTANCE_ID>


instance:clone

Copy to clipboard
SOURCE_INSTANCE_ID SOURCE_INSTANCE_BACKUP


instance:maintenance

Copy to clipboard
INSTANCE_MAINTENANCE_STATUS_<INSTANCE_ID>


instance:profile:apply

Copy to clipboard
INSTANCE_PROFILE


instance:setup-scheduler-cron

Copy to clipboard
INSTANCE_JOB_ENABLED_<INSTANCE_ID> INSTANCE_JOB_TIME_<INSTANCE_ID> INSTANCE_JOB_COMMAND_<INSTANCE_ID>


instance:stats

Copy to clipboard
INSTANCE_STATS_<INSTANCE_ID>


instance:upgrade

Copy to clipboard
INSTANCE_PREVIOUS_BRANCH_<INSTANCE_ID>


instance:watch

Copy to clipboard
INSTANCE_REVISION_<INSTANCE_ID> INSTANCE_REVISION_ERROR_<INSTANCE_ID>


Other Notes

Tiki Manager vs MultiTiki

Using the instance:console command in Tiki Manager you can access the multitiki commands in the remote instance, like this. Assuming we are using instance #42 and the virtual domain is example.com, and each branch is in the same directory (i.e. tiki/branches/20.x and tiki/branches/21.x in this instance.

Details

[+]

Troubleshooting

If you have weird errors and/or an inability to update, it could be

  • that Tiki Manager dependencies are messed up. Just delete the vendor/ directory and try again (Tiki Manager will re-download them)
  • you have modified code. You can check with git status and git diff

Source code

The source code is managed here:
https://gitlab.com/tikiwiki/tiki-manager/

Debugging

  • You can enable TRIM_DEBUG in .env. See .env.dist as a reference.

Roadmap

alias

Attached files

ID Name Comment Uploaded Size Downloads
96 2020-12-05-manager-web-interface-with-pre-existing-index-html-file.png Marc Laporte 40.56 Kb 248
84 2019-05-15-tiki-manager-web-gui.png Marc Laporte 28.19 Kb 127