Expand my Community achievements bar.

SOLVED

Cloud Manager - dispatcher config deploy for different environments

Avatar

Level 2

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?  

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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/dispat...

 

Hope it helps!

Thanks!

Nupur

View solution in original post

8 Replies

Avatar

Community Advisor

@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.

Avatar

Employee

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!!

Avatar

Correct answer by
Community Advisor

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/dispat...

 

Hope it helps!

Thanks!

Nupur

Avatar

Level 3

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: @Deleted Account 

 

Avatar

Community Advisor

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

Avatar

Level 7

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