Deployment Overview of WordPress + WooCommerce plugin on Server¶
Prerequisites and Basic Requirements¶
The application requires a Debian-based operating system. The following prerequisites must be met for a successful deployment:
-
Privileges: Root or sudo access is required to install packages and manage Docker containers.
-
Packages: The following system utilities are installed:
lsb-release,apt-transport-https,vim,htop, andzip. -
Ports:
-
Port
80(Internal) -
Port
443(External/HTTPS)
FQDN of the final panel on the hostkey.in domain¶
The application is accessible via a specific subdomain template based on your server ID.
| Parameter | Value |
|---|---|
| Prefix | wp |
| Domain | hostkey.in |
| Full template | wp{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
The deployment utilizes specific directories for application data, configuration, and certificates:
-
/data/wordpress: Main WordPress application files and plugins. -
/root/wordpress: Contains the Docker Compose orchestration file. -
/data/nginx/user_conf.d/: Stores Nginx virtual host configurations. -
/data/nginx/nginx-certbot.env: Environment configuration for the proxy service.
Application installation process¶
The installation follows a multi-step process involving system preparation, plugin deployment, and container orchestration:
-
System Preparation: The package manager is updated, and necessary dependencies (
lsb-release,apt-transport-https, etc.) are installed. -
Plugin Deployment:
-
The WooCommerce plugin (version 8.7.0) is downloaded from the official WordPress repository.
-
The zip file is extracted to a temporary directory.
-
The extracted folder is moved into the
/data/wordpress/wp-content/plugins/directory to ensure it is available to the application. -
Orchestration Setup:
-
A Docker Compose configuration is generated in
/root/wordpress/compose.yml. -
An Nginx configuration file is created in
/data/nginx/user_conf.d/to handle SSL termination and routing. -
Container Deployment: The application services are started using
docker compose up -d.
Access Rights and Security¶
-
Directory Permissions:
-
/data/wordpressis owned by user ID33(standard for web services) with mode0755. -
/root/wordpressis restricted to the root user with mode0640. -
Network Security: The WordPress application container listens on
127.0.0.1:9000, ensuring it is not directly accessible from the external network, only via the local proxy.
Databases¶
The application uses a MariaDB database managed within a Docker container.
| Parameter | Value |
|---|---|
| Database Name | wordpress |
| Database User | wordpress |
| Connection Host | mariadb (internal Docker network) |
| Storage Location | Managed via Docker volume mariadb_data |
Docker Containers and Their Deployment¶
The application is deployed using a Docker Compose setup consisting of three primary services:
MariaDB¶
-
Image:
bitnami/mariadb:latest -
Restart Policy:
unless-stopped -
Volumes:
mariadb_data:/bitnami/mariadb -
Environment Variables:
-
MARIADB_USER=wordpress -
MARIADB_DATABASE=wordpress -
MARIADB_PASSWORD(set during installation) -
MARIADB_ROOT_PASSWORD(set during installation)
WordPress¶
-
Image:
docker.io/wordpress:php8.2-fpm -
Restart Policy:
unless-stopped -
Ports:
127.0.0.1:9000:9000 -
Volumes:
/data/wordpress:/var/www/html -
Environment Variables:
-
MYSQL_ROOT_PASSWORD(set during installation) -
WORDPRESS_DB_PASSWORD(set during installation) -
WORDPRESS_DB_HOST=mariadb -
WORDPRESS_DB_USER=wordpress -
WORDPRESS_DB_NAME=wordpress
Nginx Proxy (with Certbot)¶
-
Image:
jonasal/nginx-certbot:latest -
Restart Policy:
unless-stopped -
Network Mode:
host -
Volumes:
-
nginx_secrets:/etc/letsencrypt -
/data/nginx/user_conf.d:/etc/nginx/user_conf.d -
/data/wordpress:/var/www/html -
Environment Variables:
Application Update Instructions¶
To update the main application, navigate to the deployment directory and pull the latest images: