History: Manager
Source of version: 131
Copy to clipboard
{include page="SVN deprecation notice"} ! 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 * [https://www.sqlite.org/|SQLite3] for data storage * PHP 7.1+ with Command-line access (CLI). It uses the [https://symfony.com/doc/current/components/console.html|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 ((Tiki Check|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|Additional configuration] below. At a high level: # Use ((Check|Server Check)) to review and get all the server dependencies # Get code from Git in a non-web accessible directory: https://gitlab.com/tikiwiki/tiki-manager.git # 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 {sign user="jonnybradley" datetime="2020-03-23T17:55:28+00:00"}) {CODE(caption="Install Tiki Manager" colors="shell" theme="default")} # 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 {CODE} !! Documentation Here is a brief explanation of the basic commands that can be used. All commands follow a wizard pattern. {CODE(theme="blackboard" caption="For more help, you can add --help to any command as in this example")}php tiki-manager.php instance:create --help {CODE} !!! 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 ((dev:Convert a site installed via FTP to now use Git|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)|| {CODE(theme="blackboard")} php tiki-manager.php instance:create {CODE} Non interactive command: {CODE(theme="blackboard")} 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 {CODE} !!!! instance:list {CODE(theme="blackboard")} php tiki-manager.php instance:list {CODE} || 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 (,) || {CODE(theme="blackboard")} php tiki-manager.php instance:access {CODE} !!!! 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 * ~np~[a-f0-9]{32}~/np~: 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 || {CODE(theme="blackboard")} php tiki-manager.php instance:backup {CODE} !!!! 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. {CODE(theme="blackboard")} php tiki-manager.php instance:blank {CODE} {CODE(theme="blackboard")} php tiki-manager.php instance:create blank {CODE} !!!! instance:check 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. || {CODE(theme="blackboard")} php tiki-manager.php instance:check {CODE} !!!! instance:checkout CheckoutCommand: allow checking out a specific Git branch and revision for main Tiki codebase or local checkouts of themes, for example. [https://gitlab.com/tikiwiki/tiki-manager/-/merge_requests/315|Original commit]. __Params__ || Params | Type | Description instance | accepts one instance ID folder | either specify 'tiki' to update main Tiki co debase 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 || Note that this command only works on Tiki instances and those of type Git. {CODE(theme="blackboard")} php tiki-manager.php instance:checkout {CODE} !!!! 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: ((dev: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 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) 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. || {CODE(theme="blackboard")} php tiki-manager.php instance:clone {CODE} !!!! 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: ((dev: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 used for the upgrade. 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). || {CODE(theme="blackboard")} php tiki-manager.php instance:cloneandupgrade {CODE} !!!! instance:console Allow to run any ((Console)) command from Tiki. {CODE(theme="blackboard")} php tiki-manager.php instance:console {CODE} Example to clear cache (it will request the instance ID): {CODE(theme="blackboard")} php tiki-manager.php instance:console --command="cache:clear all"{CODE} Example with chosen instance: {CODE(theme="blackboard")}php tiki-manager.php instance:console --instances=5 --command="cache:clear all"{CODE} !!!! 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. {CODE(theme="blackboard")} php tiki-manager.php instance:copysshkey {CODE} !!!! 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. {CODE(theme="blackboard")} php tiki-manager.php instance:delete {CODE} !!!! 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. {CODE(theme="blackboard")} php tiki-manager.php instance:detect {CODE} !!!! instance:edit Permits to modify an instance. {CODE(theme="blackboard")} php tiki-manager.php instance:edit {CODE} !!!! 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`. {CODE(theme="blackboard")} php tiki-manager.php instance:fixpermissions {CODE} !!!! 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 || {CODE(theme="blackboard")} php tiki-manager.php instance:import {CODE} Non interactive command: {CODE(theme="blackboard")} 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 {CODE} !!!! instance:maintenance Put instances under maintenance or live mode. {CODE(theme="blackboard")} php tiki-manager.php instance:maintenance {CODE} !!! instance:patch https://gitlab.com/tikiwiki/tiki-manager/-/merge_requests/271 !!!! instance:patch:list {CODE(theme="blackboard")} php tiki-manager.php instance:patch:list {CODE} !!!! instance:patch:delete {CODE(theme="blackboard")} php tiki-manager.php instance:patch:delete {CODE} !!!! instance:patch:apply {CODE(theme="blackboard")} php tiki-manager.php instance:patch:apply {CODE} || --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 co debase --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: * https://patch-diff.githubusercontent.com/raw/jasonmunro/cypht/pull/548.patch * https://patch-diff.githubusercontent.com/raw/fintech-systems/virtualmin-api/pull/19.diff * https://gitlab.com/tikiwiki/tiki/-/merge_requests/1245.patch Example: {CODE(theme="blackboard")} php tiki-manager.php instance:patch:apply https://gitlab.com/tikiwiki/tiki/-/merge_requests/1245.patch {CODE} !!!! instance:profile:apply Apply a profile to an instance. {CODE(theme="blackboard")} php tiki-manager.php instance:profile:apply {CODE} !!!! 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. {CODE(theme="blackboard")} php tiki-manager.php instance:restore {CODE} !!!! instance:revert Revert a particular instance working dir to its original branch state (aka git hard reset). Thus, it removes any applied patches {CODE(theme="blackboard")} php tiki-manager.php instance:revert {CODE} !!!! instance:setup-scheduler-cron This command allows you to enable the cron to run the ((Scheduler|schedulers)) {CODE(theme="blackboard")} php tiki-manager.php instance:setup-scheduler-cron {CODE} Itcan be used interactively or without interaction. Ex.: {CODE()} php tiki-manager.php instance:setup-scheduler-cron -i 1 --time="*/10 * * * *"{CODE} Possible options: {CODE()}--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{CODE} 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 || {CODE(theme="blackboard")} # Display all instance stats php tiki-manager.php instance:stats {CODE} {CODE(theme="blackboard")} # Save stats to a csv file php tiki-manager.php instance:stats --instances=all --file=instance_stats.csv {CODE} {CODE(theme="blackboard")} # 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 {CODE} !!!! 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.|| {CODE(theme="blackboard")} php tiki-manager.php instance:update {CODE} !!!! 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 | 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. lag | option | Time delay commits by X number of days. Useful for avoiding newly introduced bugs in automated updates.|| {CODE(theme="blackboard")} php tiki-manager.php instance:upgrade {CODE} !!!! instance:verify Verify an instance (same as check) {CODE(theme="blackboard")} php tiki-manager.php instance:verify {CODE} !!!! instance:watch This command perform the Hash check (instance:check). 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 (,) || {CODE(theme="blackboard")} php tiki-manager.php instance:watch {CODE} !!! backups !!!! backups:setup Same as [#manager:setup-backups|manager:setup-backups]. {CODE(theme="blackboard")} php tiki-manager.php backups:setup {CODE} !!!! backups:delete Delete Tiki Manager backups folder and contents. This folder contains the backups of instances managed by Tiki Manager. {CODE(theme="blackboard")} php tiki-manager.php backups:delete {CODE} !!! cache !!!! cache:clear Delete Tiki Manager cache folder. Useful for development. {CODE(theme="blackboard")} php tiki-manager.php cache:clear {CODE} !!! database !!!! database:delete * Delete Tiki Manager database. Useful for development. {CODE(theme="blackboard")} php tiki-manager.php database:delete {CODE} !!!! database:view * View Tiki Manager database. For debug purposes and useful for development. {CODE(theme="blackboard")} php tiki-manager.php database:view {CODE} !!! logs !!!! logs:clear Clear Tiki Manager logs folder. {CODE(theme="blackboard")} php tiki-manager.php logs:clear {CODE} !!! manager !!!! manager:info * Display running OS, PHP version and binary used by Tiki Manager {CODE(theme="blackboard")} php tiki-manager.php manager:info {CODE} !!!! manager:check * Check OS requirements to execute Tiki Manager {CODE(theme="blackboard")} php tiki-manager.php manager:check {CODE} !!!! manager:report * Reports, and send reports to a Tiki instance using Data Channels. {CODE(theme="blackboard")} php tiki-manager.php manager:report {CODE} !!!! manager:setup-clone * Setup a cronjob to perform instance clone. {CODE(theme="blackboard")} php tiki-manager.php manager:setup-clone {CODE} !!!! manager:test-send-email * Test send email. {CODE(theme="blackboard")} php tiki-manager.php manager:test-send-email {CODE} !!!! tiki:versions * Shows all versions of Tiki. {CODE(theme="blackboard")} php tiki-manager.php tiki:versions {CODE} !!!! manager:reset * Delete Tiki Manager backup, cache, and log files. Useful for development. {CODE(theme="blackboard")} php tiki-manager.php manager:reset {CODE} !!!! 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 || {CODE(theme="blackboard")} php tiki-manager.php manager:setup-backups {CODE} !!!! 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 (,)) || {CODE(theme="blackboard")} php tiki-manager.php manager:setup-update {CODE} !!!! manager:setup-watch Set-up a cron job on the Tiki Manager master to perform the Hash check (instance:check) 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 (,) || {CODE(theme="blackboard")} php tiki-manager.php manager:setup-watch {CODE} !!!! 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|| {CODE(theme="blackboard")} php tiki-manager.php manager:update --check {CODE} {CODE(theme="blackboard")} php tiki-manager.php manager:update -y {CODE} For installations (without Phar or Git), to enable update, add the following file -+.version+- to the Tiki-Manager root. {CODE(theme="blackboard")} {"version":"bf63ffa", "date":"2020-05-03T23:32:58+01:00"} {CODE} !!! 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 as your default vcs or another repository please use the following lines in your .env file. {CODE(theme="blackboard")} DEFAULT_VCS=svn GIT_TIKIWIKI_URI=<CUSTOM_GIT_REPOSITORY_URL> SVN_TIKIWIKI_URI=<CUSTOM_SVN_REPOSITORY_URL> {CODE} !!!! 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). {CODE(theme="blackboard")} DEFAULT_VCS=src {CODE} 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. {CODE(theme="blackboard")} FROM_EMAIL_ADDRESS=<SENDER_EMAIL_ADDRESS> {CODE} !!!!! 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. {CODE(theme="blackboard")} SMTP_HOST=<SERVER_ADDRESS> SMTP_PORT=<SERVER_PORT> SMTP_USER=(optional if authentication is required) SMTP_PASS=(optional if authentication is required) {CODE} !!!! 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. {CODE(theme="blackboard")} WWW_PATH=<WEB_MANAGER_FOLDER> WWW_USER=<APACHE_USER> WWW_GROUP=<APACHE_GROUP> {CODE} To change the maximum number of failed login attempts on Web Manager, add the following setting to your .env file. {CODE(theme="blackboard")} MAX_FAILED_LOGIN_ATTEMPTS=<NUMBER> {CODE} !!! 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 [https://gitlab.com/tikiwiki/tiki-manager/-/merge_requests/341|since 2022-09-21] 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. !!! 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. {CODE()} 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> {CODE} !!!! Additional vars per command __instance:patch:apply__ {CODE()} INSTANCE_BACKUP_FILE_<INSTANCE_ID> PATCH_PACKAGE PATCH_URL {CODE} __instance:backup__ {CODE()} INSTANCE_BACKUP_FILE_<INSTANCE_ID> {CODE} __instance:clone__ {CODE()} SOURCE_INSTANCE_ID SOURCE_INSTANCE_BACKUP {CODE} __instance:maintenance__ {CODE()} INSTANCE_MAINTENANCE_STATUS_<INSTANCE_ID> {CODE} __instance:profile:apply__ {CODE()} INSTANCE_PROFILE {CODE} __instance:setup-scheduler-cron__ {CODE()} INSTANCE_JOB_ENABLED_<INSTANCE_ID> INSTANCE_JOB_TIME_<INSTANCE_ID> INSTANCE_JOB_COMMAND_<INSTANCE_ID> {CODE} __instance:stats__ {CODE()} INSTANCE_STATS_<INSTANCE_ID> {CODE} __instance:upgrade__ {CODE()} INSTANCE_PREVIOUS_BRANCH_<INSTANCE_ID> {CODE} __instance:watch__ {CODE()} INSTANCE_REVISION_<INSTANCE_ID> INSTANCE_REVISION_ERROR_<INSTANCE_ID> {CODE} !! 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 To list the domains in the 20.x tiki use: {CODE(colors="shell")}$ php tiki-manager.php instance:console -i42 -c'multitiki:list ../20.x' Calling command in tiki-dev/21.x Result: example.com staging.example.com other.example.com {CODE} And then to preview moving one from there to the 21.x instance use: {CODE(colors="shell")}$ php tiki-manager.php instance:console -i42 -c'multitiki:move example.com ../20.x' Calling command in tiki-dev/21.x Result: Will move: /home/auser/tiki/branches/20.x/db/example.com to /home/auser/tiki/branches/21.x/db/example.com Will move: /home/auser/tiki/branches/20.x/dump/example.com to /home/auser/tiki/branches/21.x/dump/example.com Will move: /home/auser/tiki/branches/20.x/img/wiki/example.com to /home/auser/tiki/branches/21.x/img/wiki/example.com Will move: /home/auser/tiki/branches/20.x/img/wiki_up/example.com to /home/auser/tiki/branches/21.x/img/wiki_up/example.com Will move: /home/auser/tiki/branches/20.x/img/trackers/example.com to /home/auser/tiki/branches/21.x/img/trackers/example.com Will move: /home/auser/tiki/branches/20.x/modules/cache/example.com to /home/auser/tiki/branches/21.x/modules/cache/example.com Will move: /home/auser/tiki/branches/20.x/temp/example.com to /home/auser/tiki/branches/21.x/temp/example.com Will move: /home/auser/tiki/branches/20.x/temp/cache/example.com to /home/auser/tiki/branches/21.x/temp/cache/example.com Will move: /home/auser/tiki/branches/20.x/temp/public/example.com to /home/auser/tiki/branches/21.x/temp/public/example.com Will move: /home/auser/tiki/branches/20.x/templates/example.com to /home/auser/tiki/branches/21.x/templates/example.com Will move: /home/auser/tiki/branches/20.x/themes/example.com to /home/auser/tiki/branches/21.x/themes/example.com Will move: /home/auser/tiki/branches/20.x/whelp/example.com to /home/auser/tiki/branches/21.x/whelp/example.com Will move: /home/auser/tiki/branches/20.x/mods/example.com to /home/auser/tiki/branches/21.x/mods/example.com Will move: /home/auser/tiki/branches/20.x/files/example.com to /home/auser/tiki/branches/21.x/files/example.com Will move: /home/auser/tiki/branches/20.x/tiki_tests/tests/example.com to /home/auser/tiki/branches/21.x/tiki_tests/tests/example.com Use --confirm to perform moves {CODE} More info here: ((MultiTiki)) !! 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/ !! Roadmap ((dev:Manager)) !! Related * https://wikisuite.org/Virtualmin-Tiki-Manager -=alias=- * (alias(Tiki Manager))