History: Manager
Source of version: 99
Copy to clipboard
! 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)). !! Screenshot of the Tiki Manager Web interface {img type="attId" attId="84"} More info and screenshots at ((Tiki Manager Web UI)). !! 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 For now, the installation instructions are made for ClearOS so you need to adapt for your OS. Please see ((How to install Tiki Manager on ClearOS)). 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")} # 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 {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))/((dev:Convert a site installed via FTP to now use SVN|SVN)). __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 || {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: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.|| {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.|| {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} !!!! instance:copysshkey Copy the SSH key to the remote instance. {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: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: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: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. __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} !!! webmanager !!!! webmanager:enable Enable a web interface for Tiki Manager. More info at ((Tiki Manager Web UI)). __Params__ || Params | Type | Description path | option | Path to install webmanager username | option | The username to login password | option | The username's password www-user| option | The apache user (set this if other than apache) www-group | option | The apache group (set this if other than apache) restrict | option | (No value) Restrict WebManager access to localhost install | option | (No value) Proceed Tiki Manager installation (no prompt confirmation) || {CODE(caption="Option 1: Interactive setup" theme="blackboard")} php tiki-manager.php webmanager:enable {CODE} {CODE(caption="Option 2: Non-Interactive setup" theme="blackboard")} php tiki-manager.php webmanager:enable --path=/var/www/virtual/tiki-manager/html --username=admin --password=my-secret --install --no-interaction{CODE} Expect result of file system: {img type="attId" attId="96"} Once set up and running, web interface will look like this {img type="attId" attId="84"} !!!! webmanager:block Webmanager block login __Params__ || Params | Type | Description reset | option | Flag that resets the login attempts counter || {CODE(theme="blackboard")} php tiki-manager.php webmanager:block --reset {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 For ClearOS check the instructions: [https://doc.tiki.org/How-to-install-Tiki-Manager-on-ClearOS#Timeouts_during_long_running_operations] !! 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)) !! Source code The source code is managed here: https://gitlab.com/tikiwiki/tiki-manager/ !! Roadmap ((dev:Manager)) !! Related * ((Tiki Manager app for ClearOS)) * ((How to install Tiki Manager on ClearOS)) -=alias=- * (alias(Tiki Manager))