Code Monkey home page Code Monkey logo

docker-openlitespeed's Introduction

Docker Cloud Build Status Docker Image Size (tag) GitHub

Simple OpenLiteSpeed container running on MiniDeb.

This container is intended to be used as base image for OpenLiteSpeed based applications such as WordPress or Drupal. The container includes PHP 7.4 and it is set as the default handler for both LiteSpeed SAPI and the command line, and as such should be usable out of the box.

The PHP extensions bundled with the LiteSpeed have been installed.

Running

To start the container, just run something like the following:

docker 'run' \
        --detach \
        --rm \
        --env 'ADMIN_PASSWORD=secret' \
        --name 'openlitespeed' \
        --publish '80:80' \
        --publish '7080:7080' \
        'mireiawen/openlitespeed'

To set the webadmin password, use the environment variable ADMIN_PASSWORD to set it.

The container has 2 ports exposed, the HTTP port and the Web Admin interface running HTTP on 7080.

The container uses 3 volumes:

  • /tmp/lshttpd for temporary files
  • /var/log/litespeed for log files
  • /var/www/container for the web files

The public files are under the path /var/www/container/web and the service is run as www-data user and group.

There is simple health check checking that the OpenLiteSpeed server is running, but it does not do anything else such as monitor any actual application output. The server error logs are printed to the stdout, but access logs have to be fetched from the file.

docker-openlitespeed's People

Contributors

mireiawen avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-openlitespeed's Issues

Can you update please

Hello, can you update it to the latest openlitespeed version and create a branch/tag for php 8 please.

I tried doing it but i kept getting permissions error, I forced executing the entrypoint as lsadm using:
USER lsadm
CMD "/entrypoint.sh"

It fixed the error:

[ERROR] [63] Failed to open the real time report: ./.rtreport.2!

However the server kept restarting every few seconds and I dont know why

Here is the docker file giving me the permission error:

# Debian 10 base
FROM bitnami/minideb:buster

ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE="1"
ENV DEBIAN_FRONTEND="noninteractive"

# HTTP port
EXPOSE "80/tcp"

# Webadmin port (HTTPS)
EXPOSE "7080/tcp"

ENV ADMIN_PASSWORD="IfNotSet!"

# Install the entrypoint script
COPY "entrypoint.sh" "/entrypoint.sh"
RUN chmod "u=rwx,go=" "/entrypoint.sh"

# Make sure we have required tools
RUN install_packages \
	"curl" \
	"gnupg" \
	"git" \
	"zip"

# Install the Litespeed keys
RUN curl --silent --show-error \
	"http://rpms.litespeedtech.com/debian/lst_debian_repo.gpg" |\
	apt-key add -

RUN curl --silent --show-error \
	"http://rpms.litespeedtech.com/debian/lst_repo.gpg" |\
	apt-key add -

# Install the Litespeed repository
RUN \
	echo "deb http://rpms.litespeedtech.com/debian/ buster main" > "/etc/apt/sources.list.d/openlitespeed.list"

# Install the Litespeed
RUN install_packages \
	"openlitespeed" && \
	echo "cloud-docker" > "/usr/local/lsws/PLAT"

# Install PageSpeed module
RUN install_packages \
	"ols-pagespeed"

# Install the PHP
RUN install_packages \
	"lsphp80"

# Install PHP modules
RUN install_packages \
	"lsphp80-apcu" \
	"lsphp80-common" \
	"lsphp80-curl" \
	"lsphp80-igbinary" \
	"lsphp80-imagick" \
	"lsphp80-imap" \
	"lsphp80-intl" \
	"lsphp80-ldap" \
	"lsphp80-memcached" \
	"lsphp80-msgpack" \
	"lsphp80-mysql" \
	"lsphp80-opcache" \
	"lsphp80-pear" \
	"lsphp80-pgsql" \
	"lsphp80-pspell" \
	"lsphp80-sqlite3" \
	"lsphp80-tidy"

# Set the default PHP CLI
RUN ln --symbolic --force \
	"/usr/local/lsws/lsphp80/bin/lsphp" \
	"/usr/local/lsws/fcgi-bin/lsphp5"

RUN ln --symbolic --force \
	"/usr/local/lsws/lsphp80/bin/php8.0" \
	"/usr/bin/php"

# Install the certificates
RUN install_packages \
	"ca-certificates"

# Install requirements
RUN install_packages \
	"procps" \
	"tzdata"

# Clean up
RUN rm -rf "/tmp/*"
RUN rm -rf "/var/log/litespeed"

# Create the directories
RUN mkdir --parents \
	"/tmp/lshttpd/gzcache" \
	"/tmp/lshttpd/pagespeed" \
	"/tmp/lshttpd/stats" \
	"/tmp/lshttpd/swap" \
	"/tmp/lshttpd/upload" \
	"/var/log/litespeed"

# Make sure logfiles exist
RUN touch \
	"/var/log/litespeed/server.log" \
	"/var/log/litespeed/access.log" \
	"/var/log/litespeed/container-error.log" \
	"/var/log/litespeed/container-access.log"

# Make sure we have access to files
RUN chown --recursive "lsadm:lsadm" \
	"/tmp/lshttpd" \
	"/var/log/litespeed" 

# Configure the admin interface
COPY --chown="lsadm:lsadm" \
	"config/admin_config.conf" \
	"/usr/local/lsws/admin/conf/admin_config.conf"

# Configure the server
COPY --chown="lsadm:lsadm" \
	"config/httpd_config.conf" \
	"/usr/local/lsws/conf/httpd_config.conf"

# Create the virtual host folders
RUN mkdir --parents \
	"/usr/local/lsws/conf/vhosts/container" \
	"/var/www/container" \
	"/var/www/container/web" \
	"/var/www/container/tmp"

# Configure the virtual host
COPY --chown="lsadm:lsadm" \
	"config/vhconf.conf" \
	"/usr/local/lsws/conf/vhosts/container/vhconf.conf"

# Set up the virtual host configuration permissions
RUN chown --recursive "lsadm:lsadm" \
	"/usr/local/lsws/conf/vhosts/container"

# Set up the virtual host document root permissions
RUN chown --recursive "www-data:www-data" \
	"/var/www/container"

RUN chown "www-data:www-data" \
	"/var/www"

# Setup the health checking
HEALTHCHECK \
	--start-period=15s \
	--interval=1m \
	--timeout=3s \
	--retries=3 \
	CMD /usr/local/lsws/bin/lswsctrl 'status' | grep -Ee '^litespeed is running with PID [0-9]+.$'

# Define the volumes used
 VOLUME "/tmp/lshttpd" "/var/log/litespeed"

# Set the workdir and command
ENV PATH="/usr/local/lsws/bin:${PATH}"
WORKDIR "/var/www/container"
STOPSIGNAL SIGTERM
CMD "/entrypoint.sh"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.