Skip over navigation
Documentation

Maintenance Commands

Once you are connected to the OroCloud server you can run a series of maintenance commands to handle the following maintenance operations:

Review the List OroCloud Maintenance Management Commands

To list the available OroCloud maintenance management commands, run orocloud-cli without parameters.

Warning

OroCloud maintenance commands may affect the application performance. Please use them with extreme care and contact the OroCloud or Oro Support team for any questions.

Locks

Any time the orocloud-cli command runs with any argument or options, the maintenance agent is locked to prevent simultaneous execution of itself. This is required to avoid cases when different users may execute commands that may lead to environment corruption, e.g. when different users run deploy and upgrade at the same time. If this happens, a warning message is displayed.

As an example:

1
2
3
WARNING!
Another `orocloud-cli` instance is already running PID `2860`.
Nov 01 12:00:01 ocrm-prod-app maintenance_user: upgrade -vv --log ~/upgrade.log
  • PID `2860` – the currently running command process identifier.
  • Nov 01 12:00:01 – the date and time when the command has started.
  • ocrm-prod-app – the name of the cloud node instance.
  • maintenance_user – the name of the user who runs the command.
  • upgrade -vv –log ~/upgrade.log – the orocloud-cli command argument and options being used.

Note

When you need to check the current maintenance agent version or list all available commands, running orocloud-cli command without any arguments is allowed even when locked.

Note

When the currently running command has finished or stopped with a warning or a notice, the maintenance agent is automatically unlocked.

Deploy

To deploy Oro application in the OroCloud environment with default installation parameters, run the orocloud-cli deploy command

Upgrade

During the Oro application upgrade, the Oro cloud maintenance tool pulls the new version of the application source code from the repository (either from new tag or branch) and runs the oro:platform:update command to launch upgrade and any data migrations.

Warning

It is recommended to create a backup before launching an upgrade. If the upgrade does not succeed, you can roll back the application to the previous state and sustain all the data and configuration.

To upgrade an Oro application, you can use the following modes:

Warning

With the rolling upgrade, source upgrade the Oro application is not forced into the maintenance mode; it runs and stays available for users during the entire upgrade process. This method is safe only when the database does not change during the upgrade, or the versions before and after the upgrade are compatible with the old and new database structure simultaneously. Usually these are upgrades to minor versions.

Upgrade With Downtime

To upgrade the Oro application, run the upgrade command:

1
orocloud-cli upgrade

Note

You will be prompted to enter a tag or branch to clone the application source file from. Use valid tag or branch from the Oro application repository, for example, the 1.6 branch or the 1.6.1 tag.

This command executes the following operations:

  1. Enables the maintenance mode
  2. Checks out the application code from the provided tag or branch of the configured repository
  3. Installs the external dependencies via the composer install
  4. Performs oro:platform:update
  5. Launches a cache warmup

Once the cache warmup is complete, the maintenance mode is turned off and the upgraded application is ready for use.

Upgrade With Zero Downtime (Rolling Upgrade)

To perform Oro application upgrade with zero downtime, run the upgrade:rolling command:

1
orocloud-cli upgrade:rolling

Note

You will be prompted to enter a tag or branch to clone the application source file. Use valid tag or branch from the Oro application repository (for example, the 1.6 branch or the 1.6.1 tag).

This command does not enable maintenance mode. In the normal operation mode, this command executes the following operations:

  1. Checks out the code from a tag or branch of the configured repository
  2. Installs the external dependencies via the composer install
  3. Performs oro:platform:update
  4. Launches a cache warmup
  5. Restarts the related services (consumers, cron, WebSocket, etc).

Upgrade With Zero Downtime (Source Upgrade)

To perform Oro application upgrade with zero downtime, run the upgrade:source command:

1
orocloud-cli upgrade:source

Note

You will be prompted to enter a tag or branch to clone the application source file. Use valid tag or branch from the Oro application repository (for example, the 1.6 branch or the 1.6.1 tag).

The purpose of this command is to deploy code changes (without updating dependencies) as quickly as possible. The difference between this command and original upgrade:

  1. dependencies are not updated
  2. oro:platform:update is not executed
  3. cache:clear is executed optionally (add option skip-cache-rebuild if you do not need to rebuild cache with the new release)

Backup

Once you start using Oro application, you can set up a regular backup process.

Backup Everything

To backup the application state, run the backup:create command:

1
orocloud-cli  backup:create [--label=my-backup]

–label is an optional parameter for any comments related to the backup

The List of Existing Backups

To view the list of the backups, run backup:list command:

1
orocloud-cli  backup:list

The command output is similar to the following:

1
2
3
4
5
6
7
8
9
➤ Executing task backup:list
+-----------------+-----------------------+
| DATE            | LABEL                 |
+-----------------+-----------------------+
| 2018-11-14-1725 | backup_before_upgrade |
| 2018-11-12-1425 | -                     |
| 2018-11-10-1025 | initial_deploy        |
+-----------------+-----------------------+
[localhost] Total 3 items.

If the list is longer than one page, use the optional page parameter to switch between pages (e.g., page=2).

By default, the command returns 25 backup records per page. To modify the number of records per page, use the optional per-page parameter (e.g. per-page=50).

Restore

Restore Everything

To restore the information from backup, run the backup:restore command:

1
orocloud-cli  backup:restore {backup_date}

Note

The {backup_date} argument is the one of the available backups listed in backup:list command output, e.g. 2018-11-12-1425.

The command enables the maintenance mode and restores the application. Once restoration is complete, the maintenance mode is turned off.

Create a Sanitized Backup

To share the sanitized data with the OroCloud and OroSupport team, create a sanitized backup using the following command:

1
orocloud-cli backup:create:sanitized

The resulting backup is not encrypted and is located next to the ordinary encrypted backups.

To review the list of available sanitized backups, their creation timestamps and the precise location they are saved to, run:

1
orocloud-cli backup:list:sanitized

Once you have identified the backup file you need, download it using:

1
scp oro_cloud_username@oro_cloud_hostname:/path/to/the/backup/file target_username@target_hostname:/path/to/the/target/backup/file

See Sanitizing Configuration for details on how to configure the sanitizing scope and strategy.

Application Commands

Run application commands via the app:console, for example:

1
orocloud-cli app:console oro:user:list

To pass a command that contains arguments or options, wrap the command in quotes.

1
orocloud-cli app:console "oro:message-queue:consume --memory-limit=512 --time-limit='+30 seconds'"

If a command contains quotes and is wrapped in the same quotes type, the inner quotes must be escaped with \.

1
orocloud-cli app:console "oro:message-queue:consume --memory-limit=512 --time-limit=\"+30 seconds\""

By default, the app:console command runs in silent mode, which means that the output from the application is shown after the command completion. To execute an application command interactively, e.g. to monitor command execution in real time, you may be required to debug consumer execution. For this, add the -vvv option (it increases maintenance agent verbosity to DEBUG level).

1
orocloud-cli app:console "oro:message-queue:consume --memory-limit=512" -vvv

Application Cache

Sometimes you may require to clear the application cache (for example, after applying a patch, or changing a configuration). This can be done with the cache:rebuild command that rebuilds the application cache without downtime. This command does the following:

  • Stops Consumer and Cron jobs
  • Prepares Redis cache storage
  • Clears and warms up the application cache
  • Switches Redis storage
  • Restarts PHP FPM
  • Starts Consumer and Cron.
1
orocloud-cli cache:rebuild [--force] [--skip-session-flush]

Note

Since the cache:rebuild operation requires the Consumer and Cron jobs to be stopped, a confirmation message is displayed before execution.

  • –force is optional, it allows to skip execution confirmation.
  • –skip-session-flush is optional, it allows to skip session data deletion (e.g. logged-in users are not logged out after command completion).

Media Upload

Sometimes you may require to upload media files that relate to custom CMS page(s) or products to a specific public or import_export directory. This can be done with the media:upload command that allows to upload media files e.g. svg | ttf | woff | woff2 | jpg | jpeg | jp2 | jxr | webp | gif | png | ico | css | scss | pdf | rtf | js to the [public|web]/media/uploads/ or the [app|var]/import_export/product_images/ directory.

Usage examples:

Show command description and help:

1
orocloud-cli media:upload --help
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Description:
  Uploads media content from the given source to a selected destination [ public | products ]. Allowed file types: [ svg | ttf | woff | woff2 | jpg | jpeg | jp2 | jxr | webp | gif | png | ico | css | scss | pdf | rtf | js ]

Usage:
  media:upload [options] [--] [<source> [<destination>]]

Arguments:
  source                Media source directory full path, e.g. `/tmp/media/`
  destination           Media destination location. Allowed values: [ public | products ]

Options:
      --log=LOG         Log to file
      --force           Causes the media source directory content be physically moved to destination.
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

The following command transfers media files from the ~/media directory into the destination directory which will be asked. The command is executed in DRY-RUN mode.

1
orocloud-cli media:upload ~/media
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
➤ Executing task media:upload
Please select media destination location:
  [public  ] media/uploads/
  [products] import_export/product_images/
 > products
[localhost] sending incremental file list
./
2a508b3.jpg
36cb536.png
7946a9a.js
e72b1f9.jpg
e72b1fa.ico
e72b1fb.css
subdirectory/
subdirectory/6b6855e.svg
subdirectory/7946a9a.js

sent 282 bytes  received 50 bytes  664.00 bytes/sec
total size is 950.04K  speedup is 2,861.58 (DRY RUN)
[localhost]
  Media transfer executed in DRY-RUN mode.
  Please check output and if everything is fine - execute the command with `--force` flag.
✔ Ok

The following command transfers media files from the ~/media directory into the destination directory which will be asked. The command is executed in the FORCED mode.

1
orocloud-cli media:upload ~/media --force
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
➤ Executing task media:upload
Please select media destination location:
  [public  ] media/uploads/
  [products] import_export/product_images/
 > products
[localhost] sending incremental file list
./
2a508b3.jpg
36cb536.png
7946a9a.js
e72b1f9.jpg
e72b1fa.ico
e72b1fb.css
subdirectory/
subdirectory/6b6855e.svg
subdirectory/7946a9a.js

sent 950.90K bytes  received 202 bytes  1.90M bytes/sec
total size is 950.04K  speedup is 1.00
[localhost] Media successfully transferred.
✔ Ok

The following command transfers media files from the ~/media directory into the destination directory which is provided as argument. The command is executed in the FORCED mode.

1
orocloud-cli media:upload ~/media public --force
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
➤ Executing task media:upload
[localhost] sending incremental file list
./
    2a508b3.jpg
    36cb536.png
    7946a9a.js
    e72b1f9.jpg
    e72b1fa.ico
    e72b1fb.css
    subdirectory/
    subdirectory/6b6855e.svg
    subdirectory/7946a9a.js

sent 950.90K bytes  received 202 bytes  1.90M bytes/sec
total size is 950.04K  speedup is 1.00
[localhost] Media successfully transferred.
✔ Ok
{code}

Note

The files in the source directory always overwrite the same files in the destination directory.

Note

Please always use undescores instead of spaces in the source directory name.

Browse maintained versions:3.11.6

You will be redirected to [title]. Would you like to continue?

Yes No
sso for www.magecore.comsso for oroinc.desso for oroinc.fr
Back to top