Deployment Overview of OpenLiteSpeed with WordPress on Server¶
Prerequisites and Basic Requirements¶
To deploy the OpenLiteSpeed environment with WordPress, the following prerequisites must be met:
- Operating System: Ubuntu (compatible with
aptpackage manager). - Privileges: Root access or a user with
sudoprivileges is required to install Docker and manage system services. - Domain Configuration: A valid domain name must be configured to point to the server's IP address. The deployment script uses a dynamic domain format based on a prefix, server ID, and zone (e.g.,
{{ prefix }}{{ server_id }}.{{ zone }}). - Ports: Standard web ports (80 for HTTP, 443 for HTTPS) must be open to allow traffic for the web server and SSL certificate issuance.
- Docker: The Docker engine must be installed and running on the host system.
File and Directory Structure¶
The deployment utilizes a specific directory structure located in the root home directory. All configuration files, scripts, and container definitions are contained within this location:
- Base Directory:
/root/ols-docker-env - Repository Source: The directory is populated by cloning the
https://github.com/litespeedtech/ols-docker-env.gitrepository. - Scripts Location:
- Domain management:
/root/ols-docker-env/bin/domain.sh - Database management:
/root/ols-docker-env/bin/database.sh - Application installation:
/root/ols-docker-env/bin/appinstall.sh - SSL Certificate management:
/root/ols-docker-env/bin/acme.sh - Docker Compose: The
docker-compose.ymlfile resides in the base directory and defines the container orchestration.
Application Installation Process¶
The installation process involves cloning the repository and executing specific scripts to configure the environment, database, and application. The following steps outline the manual execution of the deployment logic:
- Update System Packages: Ensure the package cache is updated using the
aptpackage manager. - Install Docker: Install the Docker engine on the Ubuntu system.
- Clone Repository: Clone the OpenLiteSpeed Docker environment repository to the target directory:
- Start Containers: Navigate to the project directory and start the Docker containers in detached mode:
- Create Virtual Host: Execute the domain script to add the virtual host configuration. Replace the variables with the actual domain components:
- Create Database: Run the database script to initialize the database, user, and password. The script requires the domain, username, password, and database name:
- Install WordPress: Execute the application installer to deploy WordPress into the environment:
Access Rights and Security¶
Security measures are implemented through the use of Docker containers and SSL certificates.
- Container Isolation: The application runs within Docker containers, isolating the OpenLiteSpeed web server and WordPress from the host operating system.
- SSL Certificates: SSL certificates are managed using the ACME protocol via the
acme.shscript. - Certificate Installation: The ACME client is installed with an email address for notifications:
- Certificate Issuance: A certificate is issued for the specific domain:
- Firewall: Ensure that the host firewall allows incoming traffic on ports 80 and 443 to facilitate web access and certificate validation.
Databases¶
The database configuration is handled automatically during the deployment process.
- Database Type: MySQL or MariaDB (managed within the Docker environment).
- Database Name:
wordpress_db - Database User:
admin - Connection Method: The application connects to the database via the internal Docker network.
- Initialization: The database is created and configured using the
bin/database.shscript, which accepts the domain, user, password, and database name as arguments.
Docker Containers and Their Deployment¶
The entire stack is orchestrated using Docker Compose.
- Orchestration Tool: Docker Compose.
- Deployment Command: The containers are started using the
docker compose up -dcommand from the/root/ols-docker-envdirectory. - Container Lifecycle: The containers run in detached mode (
-d), allowing them to operate in the background. - Configuration Source: All container definitions, including the OpenLiteSpeed web server, WordPress application, and database, are defined in the
docker-compose.ymlfile located in the project root.
Proxy Servers¶
The OpenLiteSpeed web server acts as the primary web server and handles SSL termination.
- Web Server: OpenLiteSpeed (running inside a Docker container).
- SSL Management: SSL certificates are issued and managed by the
acme.shscript integrated into the deployment workflow. - Domain Handling: Virtual hosts are created dynamically using the
bin/domain.shscript, which configures the server to respond to the specified domain name. - Custom Domains: The deployment supports custom domains defined by the
<prefix><server_id>.<zone>format.
Starting, Stopping, and Updating¶
Service management is performed using Docker Compose commands within the project directory.
- Start Services: To start the containers after they have been stopped:
- Stop Services: To stop the running containers:
- Update Services: To update the application code or configuration, pull the latest changes from the repository and restart the containers: