The advantage is the capability to install different versions of Joomla for tests/development or data retrieval from older backups.
Goals
- be able to install a Joomla website on a machine.
It can be a server or a local machine for tests - set up a Joomla website procedure
Install Docker
Docker settings
Joomla need a database to work and the DB itself need to be run in a docker container, thus is necessary to have an "external" volume in order to save the DB itself and not lose it if the DB container is shut down.
On a server will be from the root, on a local machine will be under the user.
- /dockerPS/joomla/site1/mysql --> database for Joomla site1
- /dockerPS/joomla/site1/site --> where the site1 will reside
Notes
- image : it defines what version of Joomla is used. As in the example will be the latest stable
- ports: every Joomla website should use a different port
- volumes: set up the path for the dockerPS - for local installations, use ~/dockerPS, for server installations use /dockerPS
- JOOMLA_DB_PASSWORD: it defines the password to be used in the DB, it must match te MYSQL_ROOT_PASSWORD in the joomladb section
The same password will be asked in the Joomla installation process
The database will be present in the ~/dockerPS/joomla/site1/mysql directory
Installing Joomla
Connection to the DB from outside
To do so use any MySQL client, in my case I did use DBeaver and created a connection for MySql.
Since the port is not enabled on the router, only local computers will be able to connect with the DB.
Leaving empty the Database field will show all the database present in the server.
I left all the rest of the fields as defaults.
Setting up the site
To do so is enough to go on a browser and point to the server IP on the port specified, in our case 8015.
DB settings
- Host name : joomladb
- Username : root
- Password : <password_for_db> (the one defined in the yml file)
- Database Name : joomladb
Other settings
Resources
- TechRepublic : How to deploy Joomla on docker
- dockerHub : Joomla (login to dockerHub first)
- Hamro Dev : Joomla Docker tutorial
- JoomlaShine Blog : How to set up HTTPS on Joomla
tf:~$ docker run -d --name joomladb -v mysql-data:/var/lib/mysql --network joomla-network -e "MYSQL_ROOT_PASSWORD=bauBAUmici0mici0" -e MYSQL_USER=joomla -e "MYSQL_PASSWORD=bauBAUmici0mici0" -e "MYSQL_DATABASE=joomla" mysql:5.7
aff17ec30c27252a6fbf9a349717b207d5b254e19d74a69eceb6b845a41cfe97
tf:~$ docker volume create joomla-data
joomla-data
tf:~$ docker run -d --name joomla -p 8005:80 -v joomla-data:/var/www/html --network joomla-network -e JOOMLA_DB_HOST=joomladb -e JOOMLA_DB_USER=joomla -e JOOMLA_DB_PASSWORD=bauBAUmici0mici0 joomla
85a3043b9088dada55ca12ee3bf191db54c53238aa2f19b9f4392f5158796d02
tf:~$
No comments:
Post a Comment