Example of managing system-specific settings

This topic discusses how to manage default locale and static file optimization settings in your integration system. Static file optimization means merging and minifying JavaScript and Cascading Style Sheets, and minifying HTML templates.

Static file optimization should be disabled in the Integration environment (where you’re testing) and enabled in Staging and Production environments.

These particular settings provide an example of how the optimization procedure works. You can use the same procedure to manage and optimize any available settings.

This example shows how to use the recommended procedure for managing the configuration:

  1. Change the configuration in the Integration environment Admin panel.
  2. Create config.local.php and transfer it to your local system.
  3. Push config.local.php to the branch and Integration environment.
  4. Verify your settings are not editable in the Admin panel. Any configurations exported to config.local.php make those fields in the Admin panel read-only and disabled for edits.
  5. Change settings again.
    1. Delete config.local.php on the Integration environment.
    2. Change configuration settings on the Integration environment.
    3. Re-create and push the updated config.local.php to the Integration environment.

Required role

To complete these configuration management tasks, you must have at a minimum a project reader role with environment administrator privileges.

Configuration settings you can change

The following table shows the configuration settings affected by the bin/magento magento-cloud:scd-dump command. These are the configuration settings that you can manage in Git.

Description Path in Magento Admin (omitting Stores > Configuration)
Store locale General > General, Locale Options > Locale
Static asset signing Advanced > Developer, Static Files Settings > Static Files Signing
Server-side or client-side LESS compilation Advanced > Developer, Frontend Developer Workflow > Workflow type
HTML minification Advanced > Developer, Template Settings > Minify Html
JavaScript minification Advanced > Developer, JavaScript Settings > (several options)
CSS minification Advanced > Developer, CSS Settings > Merge CSS Files and Minify CSS Files
Disable modules output Advanced > Advanced > Disable Modules Output

Get started

Complete the following instructions prior to modifying and updating configuration settings.

Synchronize your local with master

The following steps use Magento and Git CLI commands. To synchronize your local system with the master branch:

  1. On your local system, switch to the Magento file system owner.
  2. Log in to your Magento Enterprise Cloud Edition project.

    magento-cloud login
    
  3. Switch to the project root directory.
  4. List branches to locate the current branch. An astericks marks the checked out branch.

    git branch
    
  5. If necessary, merge changes in the current branch with the master branch.
  6. Switch to the master branch locally.

    magento-cloud environment:checkout master
    
  7. Pull updated code.

    git pull origin master
    

Find Admin login information

To find login information for the Integration environment Admin panel:

  1. Log in to your local system as the Magento file system owner.
  2. Find the Integration environment URL and Admin credentials:

    magento-cloud environment:url
    magento-cloud variable:list
    
  3. Using the preceding information, log in to the Integration environment Admin panel.

Step 1: Change configurations in the Integration Admin panel

This section discusses how to change the locale for the Default Config and also how to change static file optimization settings in the integration server. You can change different settings if you wish; see List of system-specific configuration settings for details.

To change locale and static file optimization settings:

  1. Log in to the Integration environment Admin panel. For URL and credentials, see Find Admin login information.
  2. Click Stores > Settings > Configuration > General > General.
  3. In the right pane, expand Locale Options.
  4. From the Locale list, change the locale. You can change it back later.

    The following figure shows an example.

    Change the locale

  5. Click Save Config.
  6. In the left navigation pane, click Advanced > Developer.
  7. In the right pane, expand Template Settings.
  8. Clear the Use default value check box next to the Minify Html list.
  9. From the Minify Html list, click No.
  10. In the right pane, expand CSS Settings.
  11. From the Merge CSS Files list, click No.
  12. From the Minify CSS Files list, click No.

    The following figure shows an example.

    Set static file optimization settings

  13. Click Save Config.
  14. If prompted, flush the Magento cache.
  15. Log out of the Magento Admin.

Step 2: Create config.local.php and transfer it to your local system

This step creates the config.local.php configuration file on the Integration environment using a command you run on your local machine.

This procedure corresponds to step B, 1–2 of our recommended procedure. After you create config.local.php, transfer it to your local system so you can add it to Git.

To create config.local.php on the Integration environment:

  1. On your local system, find the integration server’s SSH URL.

    magento-cloud environment:ssh --pipe
    
  2. Create config.local.php on the integration server.

    ssh -k <SSH URL> "php bin/magento magento-cloud:scd-dump"
    

    For example,

    ssh -k itnu84v4m4e5k-master-ouhx5wq@ssh.us.magentosite.cloud "php bin/magento magento-cloud:scd-dump"
    
  3. If you haven’t done so already, change to the project root directory.
  4. Transfer config.local.php to your local system.

    rsync <SSH URL>:app/etc/config.local.php ./app/etc/config.local.php
    

The following snippet from config.local.php shows an example of changing the default locale to en_GB and changing static file optimization settings:

 'general' =>
      array (
        'locale' =>
        array (
          'code' => 'en_GB',
          'timezone' => 'UTC',
        ),

        ... more ...

 'dev' =>
      'template' =>
        array (
          'allow_symlink' => '0',
          'minify_html' => '0',
        ),

        ... more ...

        'js' =>
        array (
          'merge_files' => '0',
          'enable_js_bundling' => '0',
          'minify_files' => '0',
        ),
        'css' =>
        array (
          'merge_css_files' => '0',
          'minify_files' => '0',
        ),

Step 3: Push config.local.php to Integration

Now that you’ve created config.local.php and transferred it to your local system, commit it to Git and push it to your integration server. This procedure corresponds to step B, 3—4 of our recommended procedure.

git add app/etc/config.local.php && git commit -m "Add system-specific configuration" && git push origin master

Wait for deployment to complete.

Step 4: Verify your configuration changes

After you push config.local.php to your Integration environment, any values you changed should be unavailable in the Magento Admin.

In this example, the modified default locale and static file optimization settings should not be editable in the Admin. These configuration settings are set in config.local.php.

To verify your configuration changes:

  1. If you haven’t done so already, log out of the Integration Admin.
  2. Log back in to the Integration Admin.

    For URL and credentials, see Find Admin login information.

  3. Click Stores > Settings > Configuration > General > General.
  4. In the right pane, expand Locale Options.

    Notice several fields cannot be edited, as shown in the following sample. These configuration settings are maintained by config.local.php.

    Can't edit certain values in the Admin

  5. In the left navigation pane, click Advanced > Developer.
  6. In the right pane, expand Template Settings, JavaScript Settings, and CSS Settings.

    Notice several fields cannot be edited, as shown in the following sample. These configuration settings are maintained by config.local.php.

    Can't edit certain values in the Admin

  7. Log out of the Magento Admin.

Step 5: Change system-specific configuration settings

This section discusses how to change system-specific settings. Our recommended procedure is to make the changes on the Integration environment and repeat the process of creating config.local.php and pushing it back to Integration.

For this example, we’ll use static file optimization settings.

Delete config.local.php on Integration

Before you can change settings on the Integration environment, delete app/etc/config.local.php. With this file removed, all configuration settings are available to modify in the Admin. Any non-default setting in config.local.php is uneditable in the Admin.

To delete config.local.php:

  1. On your local system, make sure you’re on the master branch.
  2. SSH to the integration server:

    magento-cloud ssh
    
  3. Delete config.local.php.

    rm app/etc/config.local.php
    
  4. Close the SSH tunnel.

    exit
    

Change configuration values in Integration

To change values in the Integration environment Admin:

  1. If you haven’t done so already, log out of the Integration Admin.
  2. Log in to the Integration Admin.

    For URL and credentials, see Find Admin login information.

  3. Click Stores > Settings > Configuration > Advanced > Developer.
  4. In the right pane, expand Template Settings.
  5. Clear the Use default value check box next to the Minify Html list.
  6. From the Minify Html list, click Yes.
  7. In the right pane, expand CSS Settings.
  8. From the Merge CSS Files list, click Yes.
  9. From the Minify CSS Files list, click Yes.

    The following figure shows an example.

    Set static file optimization settings

  10. Click Save Config.
  11. If prompted, flush the Magento cache.
  12. Log out of the Magento Admin.

Add the changes to a new version of config.local.php

  1. On your local system, find the integration server’s SSH URL.

    magento-cloud environment:ssh --pipe
    
  2. Create config.local.php on the integration server.

    ssh -k <SSH URL> "php bin/magento magento-cloud:scd-dump"
    

    For example,

    ssh -k itnu84v4m4e5k-master-ouhx5wq@ssh.us.magentosite.cloud "php bin/magento magento-cloud:scd-dump"
    
  3. If you haven’t done so already, change to the project root directory.
  4. Transfer config.local.php to your local system.

    rsync <SSH URL>:app/etc/config.local.php ./app/etc/config.local.php
    

Push the changes to Git

To push your changes, enter the following command:

git add app/etc/config.local.php && git commit -m "Add system-specific configuration" && git push origin master

Wait for deployment to complete.

Optionally verify the changes, and verify that configuration values are not editable in the Admin.