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 integration (where you’re testing) and enabled in staging and production.

These particular settings are discussed only to explain how the procedure works; you can use the same procedure to manage any available settings.

This example shows how to:

  1. Change the configuration in the integration server’s Admin.
  2. Create config.local.php and transfer it to your local system.
  3. Push config.local.php to the integration server
  4. Verify your settings are not editable in the Admin.
  5. Change settings again.
    1. Delete config.local.php on the integration server.
    2. Change configuration settings on the integration server.
    3. Re-create and push the updated config.local.php to the integration server.

Required role

To complete the tasks discussed in this topic, you must have at minimum a project reader role with environment administrator privileges.

Configuration settings you can change

The following table shows the configuration settings affected by the magento app:config:scd-dump command. These are the configuration settings 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

Prerequisite

Before you continue, make sure you review our recommended procedure for managing the configuration.

Get started

Step 1: Synchronize with master

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. Find the current 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
    

Step 2: Find Admin login information

To find login information for the integration server Admin:

  1. Log in to your local system as the Magento file system owner.
  2. Find the integration server URL and Admin login information:

    magento-cloud environment:url
    magento-cloud variable:list
    
  3. Using the preceding information, log in to the integration server’s Admin.

Step 1: Change the configuration in the integration server Admin

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 server Admin with the information you found in Step 2: 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 section discusses how to create config.local.php on the integration server 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 server:

  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 app:config:scd-dump"
    

    For example,

    ssh -k itnu84v4m4e5k-master-ouhx5wq@ssh.us.magentosite.cloud "php bin/magento app:config: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 show 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 the integration server

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 server, any values you changed should be unavailable in the Magento Admin.

In this example, the default locale and static file optimization settings should not be editable in the Admin.

To verify your configuration changes:

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

    You can find login information as discussed in Step 2: 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.

    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.

    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 server and repeat the process of creating config.local.php and pushing it back to the integration server.

For this example, we’ll use static file optimization settings. If you’ve already changed those settings, you can use this procedure to set other options of your choosing.

Delete config.local.php on the integration server

Before you can change settings on the integration server, you should delete app/etc/config.local.php so all settings are available 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 the integration server Admin

To change values in the Admin:

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

    You can find login information as discussed in Step 2: 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 app:config:scd-dump"
    

    For example,

    ssh -k itnu84v4m4e5k-master-ouhx5wq@ssh.us.magentosite.cloud "php bin/magento app:config: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 the changes are not editable in the Admin.