Skip to content

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 apt package manager).
  • Privileges: Root access or a user with sudo privileges 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.git repository.
  • 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.yml file 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:

  1. Update System Packages: Ensure the package cache is updated using the apt package manager.
  2. Install Docker: Install the Docker engine on the Ubuntu system.
  3. Clone Repository: Clone the OpenLiteSpeed Docker environment repository to the target directory:
    git clone https://github.com/litespeedtech/ols-docker-env.git /root/ols-docker-env
    
  4. Start Containers: Navigate to the project directory and start the Docker containers in detached mode:
    cd /root/ols-docker-env
    docker compose up -d
    
  5. Create Virtual Host: Execute the domain script to add the virtual host configuration. Replace the variables with the actual domain components:
    bash bin/domain.sh --add <prefix><server_id>.<zone>
    
  6. Create Database: Run the database script to initialize the database, user, and password. The script requires the domain, username, password, and database name:
    bash bin/database.sh --domain <prefix><server_id>.<zone> --user admin --password <password> --database wordpress_db
    
  7. Install WordPress: Execute the application installer to deploy WordPress into the environment:
    ./bin/appinstall.sh --app wordpress --domain <prefix><server_id>.<zone>
    

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.sh script.
  • Certificate Installation: The ACME client is installed with an email address for notifications:
    ./bin/acme.sh --install --email <email>
    
  • Certificate Issuance: A certificate is issued for the specific domain:
    ./bin/acme.sh --domain <prefix><server_id>.<zone>
    
  • 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.sh script, 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 -d command from the /root/ols-docker-env directory.
  • 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.yml file 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.sh script integrated into the deployment workflow.
  • Domain Handling: Virtual hosts are created dynamically using the bin/domain.sh script, 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:
    cd /root/ols-docker-env
    docker compose up -d
    
  • Stop Services: To stop the running containers:
    cd /root/ols-docker-env
    docker compose down
    
  • Update Services: To update the application code or configuration, pull the latest changes from the repository and restart the containers:
    cd /root/ols-docker-env
    git pull
    docker compose up -d
    
question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×