How to do it...

Once we are logged in to one of the manager nodes, the first thing we need to do is create some Swarm secrets for our database passwords:

$ echo "DbP@SSwod1" | docker secret create root_db_password -
$ echo "myJ000mlaPw" | docker secret create jm_db_password -

Let's confirm that we added them correctly:

$ docker secret ls

They look good. Let's create a custom overlay network so that our services can talk with each other over an encrypted connection on the cluster:

$ docker network create -d overlay joomla
$ docker network ls

Now, we are ready to add our services. Joomla! requires a database, so we are going to create a MariaDB service, and we will use the network and secrets that we created earlier for our passwords:

$ docker service create 
--name mariadb
--replicas 1
--constraint=node.role==manager
--network joomla
--secret source=root_db_password,target=root_db_password
--secret source=jm_db_password,target=jm_db_password
-e MYSQL_ROOT_PASSWORD_FILE=/run/secrets/root_db_password
-e MYSQL_PASSWORD_FILE=/run/secrets/jm_db_password
-e MYSQL_USER=joomla
-e MYSQL_DATABASE=joomla
mariadb:10.3

Now that we have all of our dependencies created, we can add our Joomla! service. We will use the same network as before, but you will notice that we are passing the database password as an environment variable instead of using the Docker Secret we created earlier. This is because the Joomla! image does not currently support secrets, but hopefully support will be added in the near future, and we can switch it to use the secret at that time:

$ docker service create 
--name joomla
--constraint=node.role==manager
--replicas 1
--network joomla
--publish 80:80
-e JOOMLA_DB_USER=joomla
-e JOOMLA_DB_PASSWORD="myJ000mlaPw"
-e JOOMLA_DB_HOST=mariadb
-e JOOMLA_DB_NAME=joomla
joomla:3.8

We should now have two services up and running. Let's check:

$ docker service ls

They look good. Let's see whether we can connect to the service. If you remember, when we deployed Docker for Azure, there were some outputs. Two of those outputs were APPURL and DEFAULTDNSTARGET. The first one is the load balancer URL, while the other is the public IP address for the stack. You can use those values when configuring your DNS records for your site:

If you enter one of the aforementioned addresses into a web browser, you should be able to see the Joomla! configuration page. If so, our installation was successful:

If you are not going to be completing the configuration wizard right away, please remove or stop the service, or else someone else could come by and do it for you, and take over your Joomla! install.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.109.93