Skip to content

Deployment Overview of Joomla on Server

Prerequisites and Basic Requirements

The deployment requires a Linux-based operating system with Docker installed and configured. The following components are necessary for the system to function:

  • Root privileges or sudo access to manage Docker containers and system directories.
  • A valid domain name configured to point to the server's IP address.
  • Port 80 and 443 must be open for web traffic and SSL certificate management.
  • Port 3306 is exposed for the MySQL database service.
  • Port 8080 is used internally for the proxy pass configuration.

File and Directory Structure

The application and its supporting services utilize specific directories for configuration, data storage, and certificates:

  • /root/nginx: Contains the Docker Compose configuration file for the proxy server.
  • /root/nginx/compose.yml: The main orchestration file for the Nginx and Certbot services.
  • /data/nginx/user_conf.d: Stores custom Nginx configuration files, including host-specific settings.
  • /data/nginx/nginx-certbot.env: Environment file containing configuration variables for the Nginx-Certbot service.
  • /etc/letsencrypt: Mount point for SSL certificates managed by Certbot.
  • /var/www/html: The internal volume mount point for Joomla application files within the container.
  • /var/lib/mysql: The internal volume mount point for MySQL database files within the container.

Application Installation Process

The Joomla application and its dependencies are deployed using Docker containers. The installation involves pulling specific images and starting containers with defined environment variables and volume mappings.

  • MySQL Container:
  • Image: mysql (version defined by the mysql_image variable).
  • Container Name: Defined by the mysql_container_name variable.
  • Configuration:
    • Root password set via MYSQL_ROOT_PASSWORD.
    • Database name set via MYSQL_DATABASE.
    • Application user set via MYSQL_USER and MYSQL_PASSWORD.
  • Data Persistence: Uses a named volume mysql_data mounted to /var/lib/mysql.
  • Restart Policy: Set to always.

  • Joomla Container:

  • Image: joomla (version defined by the joomla_image variable).
  • Container Name: Defined by the joomla_container_name variable.
  • Configuration:
    • Database Host: Linked to the MySQL container name.
    • Database Name: Matches the MYSQL_DATABASE variable.
    • Database User: Matches the MYSQL_USER variable.
    • Database Password: Matches the MYSQL_PASSWORD variable.
  • Data Persistence: Uses a named volume joomla_data mounted to /var/www/html.
  • Port Mapping: Host port {{ joomla_port }} maps to container port 80.
  • Restart Policy: Set to always.

Docker Containers and Their Deployment

The system utilizes Docker to run the application stack. The deployment process involves starting the MySQL and Joomla containers with specific environment variables and volume mounts.

  • MySQL Deployment:
  • The container is started with the mysql image.
  • Environment variables are passed to configure the database root password, database name, and user credentials.
  • The container exposes port 3306 on the host.
  • A named volume mysql_data ensures database persistence.

  • Joomla Deployment:

  • The container is started with the joomla image.
  • Environment variables JOOMLA_DB_HOST, JOOMLA_DB_NAME, JOOMLA_DB_USER, and JOOMLA_DB_PASSWORD are configured to connect to the MySQL container.
  • The container is linked to the MySQL container using the alias mysql.
  • A named volume joomla_data ensures application file persistence.
  • The container maps the host port {{ joomla_port }} to the internal port 80.

Proxy Servers

A reverse proxy is deployed using Nginx and Certbot to handle incoming web traffic and manage SSL certificates.

  • Service Image: jonasal/nginx-certbot:latest.
  • Restart Policy: unless-stopped.
  • Network Mode: host.
  • Configuration:
  • The service uses an environment file located at /data/nginx/nginx-certbot.env.
  • The CERTBOT_EMAIL is set to [email protected] for certificate notifications.
  • The nginx_secrets volume is mounted to /etc/letsencrypt to store SSL certificates.
  • The directory /data/nginx/user_conf.d is mounted to /etc/nginx/user_conf.d for custom configurations.
  • Proxy Configuration:
  • A custom configuration file is generated at /data/nginx/user_conf.d/{{ prefix }}{{ server_id }}.hostkey.in.conf.
  • The proxy_pass directive is configured to forward requests to http://127.0.0.1:8080.

Starting, Stopping, and Updating

The proxy services are managed using Docker Compose commands executed from the /root/nginx directory.

  • Starting the Proxy:
  • Execute the command docker compose up -d within the /root/nginx directory to start the Nginx and Certbot containers in detached mode.
  • Updating the Proxy:
  • To apply changes to the configuration, update the compose.yml file or the environment variables, then re-run the docker compose up -d command.
  • Stopping the Proxy:
  • Execute docker compose down within the /root/nginx directory to stop and remove the proxy containers.

For the application containers (MySQL and Joomla), standard Docker commands are used:

  • Start: docker start <container_name>
  • Stop: docker stop <container_name>
  • Restart: docker restart <container_name>
  • Update: Pull the latest image using docker pull <image_name> and restart the container.
question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×