0

14 PHP containers php_1, ..., php_14 and 14 NGINX containers nginx_1, ..., nginx_14 are running on a server. The PHP container php_i is only connected to nginx_i and all NGINX containers are connected via a shared external network. Therefore php_i can see nginx_i and nginx_i can see every nginx_j.

A new requirement has been added to the system, and we need to have a global Elasticsearch for all projects, allowing all PHP projects to write on this single Elasticsearch instance, which is going to be installed via Docker.

To accomplish this task, the following methods have come to my mind, but I'm unsure which one is the best approach.

  1. Install an isolated Elasticsearch instance and publish its port, say 9200:9200, on the host, and in PHP configuration I set the IP of the host, say 172.17.0.1, and port 9200
  2. I can create a dedicated external network for connecting PHP to Elasticsearch, and include this dedicated network in the networks directive of the docker-compose file.

I would like to know which method is the best practice.

1 Answer 1

0
#!/bin/bash # Define paths and variables WILDFLY_HOME=/opt/wildfly CLI_SCRIPT=/tmp/cli-commands.cli # Create a CLI script file cat << EOF > $CLI_SCRIPT # Start an embedded host controller with a local domain configuration embed-host-controller --jboss-home=$WILDFLY_HOME --domain-config=domain.xml --host-config=host.xml # Navigate to the host configuration cd /host=master # Configure the domain controller connection /host=master/core-service=management/service=remote-domain-controller:write-attribute(name=host,name=master) # Here you can add more commands to configure server groups, servers, etc. # For example: /server-group=main-server-group:write-attribute(name=profile,value=full-ha) /server-group=main-server-group:write-attribute(name=socket-binding-group,value=full-sockets) # Save the changes :shutdown --restart=true # Exit the CLI exit EOF # Execute the CLI script with embedded host controller $WILDFLY_HOME/bin/jboss-cli.sh --file=$CLI_SCRIPT # Clean up the temporary script file rm $CLI_SCRIPT 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.