LiteSpeed Offers Docker Solutions
OVERVIEW
Docker is more popular than ever these days, and this year LiteSpeed Technologies has introduced Docker images for both LiteSpeed Enterprise and OpenLiteSpeed web servers. Additionally, we’ve made WordPress app bundles available in GitHub repos for each server image, along with a Magento app bundle for our Enterprise image. With LiteSpeed Docker solutions, you can easily set up High Performance WordPress or Magento with HTTP/3 protocol support, and developers can run on multiple platforms like Linux or Windows.
Available Images
We have made LiteSpeed Enterprise and OpenLiteSpeed Images available on Docker Hub.
Deploy LiteSpeed
You can deploy either of the LiteSpeed images on Docker in less than a minute.
Here we’ll use OpenLiteSpeed as an example, and assume you already have Docker installed.
Download the Image from Docker Hub
docker pull litespeedtech/openlitespeed:latest
Start a Container
docker run -d --name openlitespeed -p 7080:7080 -p 80:80 -p 443:443 -it litespeedtech/openlitespeed:latest
TIP: You can eliminate -p 7080:7080
from the command if you don’t need WebAdmin access.
Add a sample page
The server should start running successfully, and you should be able to log into the container. Add some files you want to display with the following command:
docker exec -it openlitespeed bash
Your default WORKDIR
should be /var/www/vhosts/
, since the default document root path is /var/www/vhosts/localhost/html
. Simply add the following command to index.php
, and then verify it from the browser with a public server IP address on both HTTP and HTTPS:
echo '<?php phpinfo();' > localhost/html/index.php
Deploy High-Performance WordPress with LiteSpeed
To start a high-performance WordPress-with-LiteSpeed-Cache solution, you can choose to use one of the following containers:
We’ll use WordPress + OpenLiteSpeed as an example, and assume you already have Docker and Docker Compose installed.
Download the Open Source from GitHub
Clone this repository or copy the files from this repository into a new folder:
git clone https://github.com/litespeedtech/ols-docker-env.git
Change the Default Values (Optional)
Edit the .env
file to update the demo site domain, default MySQL user, and password. Feel free to check the Docker Hub Tag page if you want to update the default LiteSpeed Enterprise, OpenLiteSpeed, or PHP versions.
Start the Multicontainer
Open a terminal, cd
to the folder in which docker-compose.yml
is saved, and run:
docker-compose up -d
Start Your First WordPress site
After running the following command, you should be able to access the WordPress installation page with the configured domain. If there is no change in the .env
file, then the default domain is https://localhost
.
bash bin/demosite.sh
For more CLI usage information please check our documentation which covers:
- Setting the WebAdmin Password
- Creating a Domain and Virtual Host
- Creating a Database
- Installing a WordPress Site
- Applying a Let’s Encrypt Certificate
- Updating the Web Server
- Applying OWASP ModSecurity
Deploy High-Performance Magento with LiteMage
To start a high-performance Magento-with-LiteMage-Cache solution, you can use the following container:
We’ll assume you already have Docker and Docker Compose installed.
As of version 2.4, Magento requires Elasticsearch to be the catalog search engine, we recommend you have 4GB RAM on the server. If you are using a system with less than 4GB, we recommend you create a swap file, otherwise your upgrade might fail.
Download the Open Source from GitHub
Clone this repository or copy the files from this repository into a new folder:
git clone https://github.com/litespeedtech/lsws-magento-docker-env.git
Change the Default Values (Optional)
Edit the .env
file to update the demo site domain, default MySQL user, and password. Feel free to check the Docker Hub Tag page if you want to update the default LiteSpeed Enterprise, or PHP versions.
Start the Multicontainer
Open a terminal, cd
to the folder in which docker-compose.yml
is saved, and run:
docker-compose up -d
Start Your First Magento site
After running the following command, you should be able to access the Magento page with the configured domain. If there is no change in the .env
file, then the default domain is https://localhost
.
bash bin/demosite.sh
If you want to see Magento with sample data, simply add [-S
, --sample
] to apply:
bash bin/demosite.sh -S
Videos
- OpenLiteSpeed Docker One-Click Installation Part 1/2
- OpenLiteSpeed Docker One-Click Installation Part 2/2
Customization
Build Your Own Web Server Version
Sometimes you may want to install more packages from the default image, or some other web server or PHP version which is not officially provided. You can build an image based on an existing image. Here’s how:
- Download the dockerfile project
- CD into the project directory
- Edit the Dockerfile if necessary
- Build, feeling free to substitute server and PHP versions to fit your needs
For example:
git clone https://github.com/litespeedtech/lsws-dockerfiles.git cd lsws-dockerfiles/template bash build.sh -L 5.4.9 -P lsphp74
or
git clone https://github.com/litespeedtech/ols-dockerfiles.git cd ols-dockerfiles/template bash build.sh -O 1.6.15 -P lsphp74
Extend Existing Images
If you want to customize the image by adding some packages, e.g. lsphp74-pspell
, just extend it with a Dockerfile:
FROM litespeedtech/openlitespeed:latest RUN apt-get update && apt-get install lsphp74-pspell -y
Conclusions
LiteSpeed Docker solutions allow you to start a pure LSWS or OLS web server on Docker, or start WP + LiteSpeed / Magento + LiteSpeed Docker solutions easily. You can also customize or extend the image whenever you need to. Our Docker solutions are still in a very early release stage, so feel free to raise an issue if you have any suggestions or problems. Contributions are always welcome.
Special thanks to our friend Lars Hagen. Lars is a DevOps enthusiast, with a passion for Docker and everything in the cloud. He helped us lay out the foundation for building good, robust Docker images, which is why we now have these high-end Docker images to support and use today.
Comments