Cloud Manager - dispatcher config deploy for different environments | Community
Skip to main content
August 6, 2020
Solved

Cloud Manager - dispatcher config deploy for different environments

  • August 6, 2020
  • 5 replies
  • 3330 views

Our current setup has a set of dispatcher config files for our stage environment (only stage domains, rewrites, etc), and a different set for our prod environment.  In moving over to the Cloud Manager for deployments, it looks like we only get one subdirectory/module for the dispatcher.  Does this mean we need to merge these two different sets of configs together?  

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Nupur_Jain

Hi @a74048191r 

 

With Cloud Manager in picture, the apache/dispatcher files are maintained in code, which means you will have to keep one set of files. You can have domain specific rewrites if general rewrites does not work lwith rewrite conditions like:

RewriteCond %{HTTP_HOST} ^myproject-stg\.mycompany\.com$
OR 

RewriteCond %{HTTP_HOST} ^myproject-prod\.mycompany\.com$

 

Also, Use environment variables for dispatcher renderers IP etc like

 

/0 {
/hostname "${PUBLISH_IP}"
/port "${PUBLISH_PORT}"
/timeout "10000"
}

 

Read more from documentation specifying role of each file maintained. https://docs.adobe.com/content/help/en/experience-manager-cloud-manager/using/getting-started/dispatcher-configurations.html

 

Hope it helps!

Thanks!

Nupur

5 replies

Shashi_Mulugu
Community Advisor
Community Advisor
August 6, 2020

@a74048191r From your question, i see that you are using Cloud manager to deploy dispatcher files, here are the few pointers:

  • You should not hardcode any domains specific to environment either in dispatcher or apache files. Everything has to be driven from environment variables.
  • Speak to your AMS CSE to help you with environment variables.
  • Rewrite rules or other filters/configurations should be same for Stage and Production.
vanegi
Adobe Employee
Adobe Employee
August 7, 2020

Hi @a74048191r,

Upon deployment to a dispatcher Instance, the contents of two directories - conf and conf.d will overwrite the contents of these directories on the Dispatcher instance. Since web server and Dispatcher configuration files frequently require environment-specific information, in order for this capability to be used correctly, you will first need to work with your Customer Success Engineers (CSE) to set these environment variables in /etc/sysconfig/httpd.

 

Please follow the steps below to complete the initial process:
  1. Obtain current production configuration files from your CSE.
  2. Remove hard-coded environment-specific data (for example, publish renderer IP) and replace with variables.
  3. Define required variables in key-value pairs for each target Dispatcher and request your CSE to add to /etc/sysconfig/httpd on each instance.
  4. Test the updated configurations on your stage environment, then request your CSE to deploy to production.
  5. Commit files to Git Repository .
  6. Deploy through Cloud Manager.
 

Thanks!!

Nupur_Jain
Adobe Employee
Nupur_JainAdobe EmployeeAccepted solution
Adobe Employee
August 7, 2020

Hi @a74048191r 

 

With Cloud Manager in picture, the apache/dispatcher files are maintained in code, which means you will have to keep one set of files. You can have domain specific rewrites if general rewrites does not work lwith rewrite conditions like:

RewriteCond %{HTTP_HOST} ^myproject-stg\.mycompany\.com$
OR 

RewriteCond %{HTTP_HOST} ^myproject-prod\.mycompany\.com$

 

Also, Use environment variables for dispatcher renderers IP etc like

 

/0 {
/hostname "${PUBLISH_IP}"
/port "${PUBLISH_PORT}"
/timeout "10000"
}

 

Read more from documentation specifying role of each file maintained. https://docs.adobe.com/content/help/en/experience-manager-cloud-manager/using/getting-started/dispatcher-configurations.html

 

Hope it helps!

Thanks!

Nupur

Level 3
February 22, 2022

How would you use environment variables to let's say disable cache for your dev environment.  Does this apply to AEM as a cloud service or only AMS.

 @nupur_jain 

@arunpatidar 

cc: @1202249 

 

arunpatidar
Community Advisor
Community Advisor
August 10, 2020

I think, you can use Environment variables to setup different dispatcher file for different environments.

 

like

 

<IfModule disp_apache2.c> ## location of the configuration file. eg: 'conf/dispatcher.any' <If "req('Host') != 'stage'"> // or some other condition DispatcherConfig conf.dispatcher.d/dispatcher_stg.any </If> <Else> DispatcherConfig conf.dispatcher.d/dispatcher.any </Else> . . . </IfModule disp_apache2.c>

 

Arun Patidar
August 10, 2020
Thanks. I'll give this a try!
Level 6
January 19, 2021

hi folks,

I have the same issue and I'm following this thread.

If I put this in /etc/sysconfig/httpd, DISP_RUN_MODE="dev", can I use it in the

<IfModule disp_apache2.c> section of dispatcher_vhost.conf ?

I made 3 /etc/conf.d/variables/ var files ending in .dev.vars, ...stage.vars, ...prod.vars

 

I want to Include one of the files depending on DISP_RUN_MODE.  Should I use <IfDefine> or <If> ?  Are there any other apache modules I need for this to work? Do I need to use PassEnv ?

 

thanks

Fiona

April 14, 2021