Loading...
 
Skip to main content

History: Manager

Preview of version: 118

SVN updates (for all versions of Tiki) will stop in January 2023. This coincides with when Tiki18 reaches end of life. However, even if you use another version (like Tiki 21x) from SVN, you will stop getting updates because the Git and SVN combined workflow will be retired. You should get your updates from Git. See also: Tiki Version control history.

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.1+ with Command-line access (CLI). 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
# Create a directory called tiki-manager (you can pick another name) $ mkdir tiki-manager # Move into this new directory $ cd tiki-manager # Fetch Tiki Manager directly from sources. The last period/dot (.) indicates to put files in current directory (vs creating a new directory) $ git clone --depth 1 --branch master https://gitlab.com/tikiwiki/tiki-manager.git . # 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: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.
Copy to clipboard
php tiki-manager.php instance:check

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

Note that this command only works on Tiki instances and those of type Git.

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

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.
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)

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

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 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).

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


Example with chosen instance:

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

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

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.

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 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.

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

instance:verify

Verify an instance (same as check)

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

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 (,)

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


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: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: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 (,)

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 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

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/

Roadmap

Manager

alias

History

Advanced
Information Version
Rodriguez Nyiringabo 146
rjsmelo 145
rjsmelo 144
Marc Laporte 143
Marc Laporte 142
Marc Laporte 141
Marc Laporte 140
Marc Laporte 139
Rodriguez Nyiringabo 138
Rodriguez Nyiringabo 137
Marc Laporte bye 136
Marc Laporte PHP 7.4 is still somewhat old 135
ibrahim mussa 134
ibrahim mussa 133
Marc Laporte Add link 132
Marc Laporte 131
Marc Laporte Thank you Ricardo 130
Marc Laporte 129
Nasser Added missing commands. 128
Marc Laporte 127
Marc Laporte Thank you Ricardo 126
Marc Laporte 125
Jorge Sá Pereira Hooks documentation 124
Marc Laporte New hooks feature 123
Marc Laporte Adding missing docs 122
Ndiwayesu 121
Ndiwayesu 120
Ndiwayesu 119
Marc Laporte New troubleshooting section 118
Marc Laporte 117
Marc Laporte 116
Marc Laporte 115
Marc Laporte instance:checkout 114
Marc Laporte Thank you Victor 113
Marc Laporte https://gitlab.com/tikiwiki/tiki-manager/-/merge_requests/323 112
Marc Laporte Stop promoting something that will soon disappear 111
Marc Laporte 110
Marc Laporte Adding an example 109
Marc Laporte 108
Marc Laporte 107
Marc Laporte 106
Marc Laporte 105
Marc Laporte We are phasing out SVN 104
Marc Laporte More goodies! https://gitlab.com/tikiwiki/tiki-manager/-/merge_requests/251 103
Horia N. Added source, target and branch options for cloneandupgrade 102
Marc Laporte Relevant info. 101
Jorge Sá Pereira Update clone operations options 100
Marc Laporte 99
Marc Laporte instance:list 98
Marc Laporte 97