Expand my Community achievements bar.

SOLVED

502 Bad Gateway while setup of Dispatcher in Local

Avatar

Level 5

I have setup an AEM as a Cloud Service project on local along with the Dispatcher. Initially, the dispatcher was working fine but after some days when I tried to start it again, it resulted in showing 502 Bad Gateway error. In terminal, there were messages like "Unable to connect to backend farm, no publish farms available". I tried reinstalling docker, dispatcher as well as publish instance but then also the error remained same. Is there a way to resolve this?

1 Accepted Solution

Avatar

Correct answer by
Level 8

Agree with the suggestion previous colleagues have provided.

For me, on MacBook, symlinks sometimes get broken after checkout from Git.

Here is a bash script to recreate all symlinks. Hope it helps.

 

 

project_root=$(pwd)
cd dispatcher/src/conf.d/enabled_vhosts
enabled_hosts=$(ls *.vhost)
for host in $enabled_hosts; do
	rm $host
	ln -s ../available_vhosts/$host $host
done

cd $project_root
cd dispatcher/src/conf.dispatcher.d/enabled_farms
enabled_farms=$(ls *.farm)
for farm in $enabled_farms; do
	rm $farm
	ln -s ../available_farms/$farm $farm
done

 

 

Daniel

View solution in original post

6 Replies

Avatar

Community Advisor

@nikita24tailor Do you have any farms listed under this directory - dispatcher-cloud/src/conf.dispatcher.d/enabled_farms

One reason I can think of about the error is - symlinks must be failing. The actual farm files are placed under the available_farms, and symlinks are created to refer to them in enabled_farms. Please check the files under enabled_farms; if they're missing, create symlinks.

Avatar

Level 5

I have not done any changes in the configurations yet. Default ones are only being used.

Avatar

Community Advisor

I think the default farm configs come up with symlinks pointed to available_farms, so good to check the files under the /etc/httpd/conf.dispatcher.d/enabled_farms directory in your docker instance.

 

Enable Debug logging in dispatcher and restart the dispatcher, you should see the loaded farms in the log file. 

Define DISP_LOG_LEVEL Debug

 

Avatar

Correct answer by
Level 8

Agree with the suggestion previous colleagues have provided.

For me, on MacBook, symlinks sometimes get broken after checkout from Git.

Here is a bash script to recreate all symlinks. Hope it helps.

 

 

project_root=$(pwd)
cd dispatcher/src/conf.d/enabled_vhosts
enabled_hosts=$(ls *.vhost)
for host in $enabled_hosts; do
	rm $host
	ln -s ../available_vhosts/$host $host
done

cd $project_root
cd dispatcher/src/conf.dispatcher.d/enabled_farms
enabled_farms=$(ls *.farm)
for farm in $enabled_farms; do
	rm $farm
	ln -s ../available_farms/$farm $farm
done

 

 

Daniel

Avatar

Level 2

Hi @nikita24tailor 

Did you try running validate script which comes with Dispatcher tools?

$ ./bin/validate.sh ./src

 This script validates the Dispatcher configuration in the src folder and provides a convenient way of running the three phases of the validator plugin.

 

Regards,

Amber

Avatar

Administrator

@nikita24tailor Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni