Skip to content

Commit

Permalink
docker sites
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Dec 18, 2023
1 parent d2cc487 commit d660450
Show file tree
Hide file tree
Showing 10 changed files with 575 additions and 75 deletions.
41 changes: 41 additions & 0 deletions dockerManager/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Use Debian as the base image
FROM debian:11.0

# Install required dependencies
RUN apt-get update && \
apt-get install -y wget gnupg ca-certificates

# Install OpenLiteSpeed
RUN wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash

RUN apt-get install -y openlitespeed

# Install PHP and required PHP extensions for WordPress
RUN apt-get install -y lsphp82*

###

RUN rm -rf /usr/local/lsws/Example/html/*

# Install WP CLI

RUN wget https://github.com/wp-cli/wp-cli/releases/download/v2.7.1/wp-cli-2.7.1.phar
RUN chmod +x wp-cli-2.7.1.phar
RUN mv wp-cli-2.7.1.phar /usr/bin/wp

## set up vh conf

RUN rm -f /usr/local/lsws/conf/vhosts/Example/vhconf.conf
COPY ./vhconf.conf /usr/local/lsws/conf/vhosts/Example/vhconf.conf

# Expose necessary ports
EXPOSE 8088

# Copy entrypoint script
COPY entrypoint.sh /usr/local/bin/entrypoint.sh

# Set execute permissions
RUN chmod +x /usr/local/bin/entrypoint.sh

# Define entrypoint
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
29 changes: 29 additions & 0 deletions dockerManager/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3.8'

services:
wordpress:
image: cyberpanel/openlitespeed:latest
ports:
- "8000:8088"
# - "443:443"
environment:
DB_NAME: "wordpress"
DB_USER: "wpuser"
DB_PASSWORD: "wppassword"
WP_ADMIN_EMAIL: "[email protected]"
WP_ADMIN_USER: "admin"
WP_ADMIN_PASSWORD: "adminpass"
WP_URL: docker.cyberpanel.net
DB_Host: mariadb:3306
SITE_NAME: "CyberPanel Docker Site"
depends_on:
- mariadb
mariadb:
image: mariadb
restart: always
environment:
ALLOW_EMPTY_PASSWORD=no
MYSQL_DATABASE: 'wordpress'
MYSQL_USER: 'wpuser'
MYSQL_PASSWORD: 'wppassword'
MYSQL_ROOT_PASSWORD: 'rootpassword'
31 changes: 31 additions & 0 deletions dockerManager/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Environment variables for WordPress installation
DB_NAME=${DB_NAME:-"wordpress"}
DB_USER=${DB_USER:-"wpuser"}
DB_PASSWORD=${DB_PASSWORD:-"wppassword"}
WP_ADMIN_EMAIL=${WP_ADMIN_EMAIL:-"[email protected]"}
WP_ADMIN_USER=${WP_ADMIN_USER:-"admin"}
WP_ADMIN_PASSWORD=${WP_ADMIN_PASSWORD:-"adminpass"}
WP_URL=${WP_URL:-"docker.cyberpanel.net"}
DB_Host=${DB_Host:-"mariadb:3306"}
SITE_NAME=${SITE_NAME:-"CyberPanel Site"}

# Install WordPress using WP CLI
/usr/local/lsws/lsphp82/bin/php /usr/bin/wp core download --path=/usr/local/lsws/Example/html --allow-root

# Set up WP config
/usr/local/lsws/lsphp82/bin/php /usr/bin/wp core config --dbname="$DB_NAME" --dbuser="$DB_USER" --dbpass="$DB_PASSWORD" --path="/usr/local/lsws/Example/html" --dbhost="$DB_Host" --skip-check --allow-root

# Install WordPress
/usr/local/lsws/lsphp82/bin/php /usr/bin/wp core install --title="$SITE_NAME" --url="$WP_URL" --title="My WordPress Site" --admin_user="$WP_ADMIN_USER" --admin_password="$WP_ADMIN_PASSWORD" --admin_email="$WP_ADMIN_EMAIL" --path="/usr/local/lsws/Example/html" --skip-email --allow-root

### Install LSCache plugin

/usr/local/lsws/lsphp82/bin/php /usr/bin/wp plugin install litespeed-cache --allow-root --path="/usr/local/lsws/Example/html"

# Start OpenLiteSpeed
/usr/local/lsws/bin/lswsctrl start

# Keep container running
tail -f /dev/null
100 changes: 100 additions & 0 deletions dockerManager/vhconf.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
docRoot $VH_ROOT/html/
enableGzip 1


context / {
allowBrowse 1
location $DOC_ROOT/
rewrite {
RewriteFile .htaccess
}
}

expires {
enableExpires 1
}

index {
indexFiles index.php
autoIndex 0
useServer 0
}

errorPage 404{
url /error404.html
}

errorlog $VH_ROOT/logs/error.log{
logLevel DEBUG
rollingSize 10M
useServer 1
}

accessLog $VH_ROOT/logs/access.log{
compressArchive 0
logReferer 1
keepDays 30
rollingSize 10M
logUserAgent 1
useServer 0
}

rewrite {
enable 1
logLevel 0
}

hotlinkCtrl {
suffixes gif, jpeg, jpg
allowedHosts
allowDirectAccess 1
enableHotlinkCtrl 0
onlySelf 1
}

accessControl {
deny
allow *
}

realm SampleProtectedArea {
userDB {
cacheTimeout 60
maxCacheSize 200
location conf/vhosts/$VH_NAME/htpasswd
}

groupDB {
cacheTimeout 60
maxCacheSize 200
location conf/vhosts/$VH_NAME/htgroup
}
}

general {
enableContextAC 0
}

scripthandler {
add lsapi:cyberpanel php
}

extprocessor cyberpanel {
type lsapi
address UDS://tmp/lshttpd/cyberpanel.sock
maxConns 10
env LSAPI_CHILDREN=10
initTimeout 600
retryTimeout 0
persistConn 1
pcKeepAliveTimeout 1
respBuffer 0
autoStart 1
path /usr/local/lsws/lsphp82/bin/lsphp
# extUser nobody
# extGroup nobody
memSoftLimit 2047M
memHardLimit 2047M
procSoftLimit 400
procHardLimit 500
}
Loading

0 comments on commit d660450

Please sign in to comment.