Multi-Environment Configuration

Users may want multiple environments setup with different configurations for each environment, e.g. QA, Prod, Dev, etc. To setup an environment, do the following:

  1. Create a folder under CRAFTER_HOME/data/repos/site/mysite/sandbox/config/studio called env

  2. Inside the folder, create a directory called myenv (or whatever you want to call the environment)

  3. Copy the configuration file you want to override in the new environment you are setting up, inside your myenv folder following the folder structure under config/studio.

  4. Remember to commit the files copied so Studio will pick it up.

  5. In the crafter-setenv.sh file in TOMCAT/bin set the following property to desired environment:

    CRAFTER_HOME/bin/crafter-setenv.sh
    # -------------------- Configuration variables --------------------
    export CRAFTER_ENVIRONMENT=${CRAFTER_ENVIRONMENT:=myenv}
    

  6. Restart Studio

Example

Let’s take a look at an example of creating a new environment, called mycustomenv with the rte-setup-tinymce5.xml file overridden in the new environment:

  1. We’ll create a folder called env under CRAFTER_HOME/data/repos/site/mysite/sandbox/config/studio

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    data/
      repos/
        sites/
          mysite/
            sandbox/
              config/
                studio/
                  administration/
                  code-editor-config.xml
                  content-types/
                  context-nav/
                  data-sources/
                  dependency/
                  env/
                  form-control-config/
                  mime-type.xml
                  permission-mappings-config.xml
                  preview-tools/
                  role-mappings-config.xml
                  site-config.xml
                  studio_version.xml
                  targeting/
                  workflow/
    

  2. Inside the env folder, create a directory called mycustomenv

  3. We will now copy the configuration file for the rte-setup-tinymce5.xml that we want to override in the new environment we are setting up, inside our mycustomenv folder, following the folder structure under config/studio. For our example, the rte-setup-tinymce5.xml file is under config/studio/form-control-config/rte:

    env/
      mycustomenv/
        form-control-config/
          rte/
            rte-setup-tinymce5.xml
    

  4. Remember to commit the files copied so Studio will pick it up.

    ➜  sandbox git:(master) ✗ git add .
    ➜  sandbox git:(master) ✗ git commit -m "Add updated rte-setup-tinymce5.xml file for mycustomenv"
    

  5. Open the crafter-setenv.sh file in TOMCAT/bin and set the value of CRAFTER_ENVIRONMENT to the environment we setup above to make it the active environment:

    CRAFTER_HOME/bin/crafter-setenv.sh
    # -------------------- Configuration variables --------------------
    export CRAFTER_ENVIRONMENT=${CRAFTER_ENVIRONMENT:=mycustomenv}
    

  6. Restart Studio. To verify our newly setup environment, open the Sidebar and click on siteConfig, then select Configuration. Notice that the active environment mycustomenv will be displayed on top of the configurations drop-down box:

    Active Environment Displayed in Site Config Configuration