Skip to content

Commit

Permalink
Merge pull request #124 from joglomedia/2.x.x
Browse files Browse the repository at this point in the history
2.5.0 Get Well Soon, Earth!
  • Loading branch information
joglomedia authored Jan 11, 2022
2 parents d942507 + cd43f2a commit 6edf44c
Show file tree
Hide file tree
Showing 55 changed files with 779 additions and 4,081 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
sed -i "s/AUTO_REMOVE=false/AUTO_REMOVE=true/g" .env
sed -i "s/FORCE_REMOVE=false/FORCE_REMOVE=true/g" .env
sed -i "s/LEMPER_ADMIN_EMAIL=\"[email protected]\"/LEMPER_ADMIN_EMAIL=\"[email protected]\"/g" .env
sed -i "s/NGINX_INSTALLER="source"/NGINX_INSTALLER="repo"/g" .env
sed -i "s/INSTALL_PHP_LOADER=false/INSTALL_PHP_LOADER=true/g" .env
sed -i "s/PHP_LOADER=\"none\"/PHP_LOADER=\"ioncube\"/g" .env
sed -i "s/IMAGEMAGICK_INSTALLER=\"source\"/IMAGEMAGICK_INSTALLER=\"repo\"/g" .env
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# [L]inux [E]ngine-X [M]ariaDB [P]HP Install[ER]

<p align="center">
<img src="/.github/assets/lemper-logo.svg?raw=true" alt="Serverd by LEMPer Stack © @joglomedia"/>
<img src="/.github/assets/lemper-logo.svg?raw=true" alt="Served by LEMPer Stack © @joglomedia"/>
</p>

<p align="center">
Expand All @@ -14,7 +14,7 @@
</p>

<p align="center">
LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in Bash script. This is just a small toolset (a bunch collection of scripts) that usually I use to deploy and manage LEMP stack on Debian/Ubuntu server. LEMPer is crafted to support wide-range PHP framework & CMS. It is available as <em>Free Alternative</em> to control panel such as cPanel, Plesk, CloudWays, Ploi, RunCloud, ServerPilot, etc.
LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in Bash script, also known as LEMP / LNMP installer. This is just a small toolset (a bunch collection of scripts) that I use to deploy and manage LEMP stack on Debian and Ubuntu server. LEMPer is crafted to support wide-range PHP framework & CMS. It is available as <em>Free Alternative</em> to the paid control panel such as cPanel, Plesk, CloudWays, Ploi, RunCloud, ServerPilot, etc.
</p>

## Features
Expand All @@ -27,7 +27,7 @@ LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in
* Support HTTP/2 natively for your secure website.
* Free SSL certificates from [Let's Encrypt](https://letsencrypt.org/).
* Get an A+ grade on several SSL Security Test ([Qualys SSL Labs](https://www.ssllabs.com/ssltest/analyze.html?d=masedi.net), [ImmuniWeb](https://www.immuniweb.com/ssl/?id=bVrykFnK), and Wormly).
* Multiple PHP versions 5.6 [EOL], 7.0 [EOL], 7.1 [EOL], 7.2 [EOL], 7.3 [SFO], 7.4, 8.0 from [Ondrej's repository](https://launchpad.net/~ondrej/+archive/ubuntu/php).
* Multiple PHP versions 5.6 [EOL], 7.0 [EOL], 7.1 [EOL], 7.2 [EOL], 7.3 [SFO], 7.4, 8.0, 8.1 from [Ondrej's repository](https://launchpad.net/~ondrej/+archive/ubuntu/php).
* Run PHP as user who own the file (Multi-user isolation via FPM pool). Feel the faster Nginx with secure multi-user environment like a top-notch shared hosting.
* Supported PHP Framework and CMS:
* Vanilla PHP: default,
Expand All @@ -40,6 +40,7 @@ LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in
* NoSQL database with MongoDB.
* In-memory database with Redis.
* Memory cache with Memcached.
* FTP server with VSFTPD or Pure-FTPd.
* [Adminer](https://www.adminer.org/) web-based SQL & MongoDB database manager (PhpMyAdmin replacement).
* [phpRedisAdmin](https://github.com/erikdubbelboer/phpRedisAdmin) web-based Redis database manager.
* [phpMemcachedAdmin](https://github.com/elijaa/phpmemcachedadmin) web-based Memcached manager.
Expand Down Expand Up @@ -124,23 +125,23 @@ sudo lemper-cli manage --help
sudo lemper-cli help
```

Note: Lemper CLI will automagically add a new PHP-FPM user's pool configuration if it doesn't exists. You must add the user account first.
Note: LEMPer CLI automagically add a new PHP-FPM user's pool configuration if it doesn't exists. You must add the user account first.

### Web-based Administration

You can access pre-installed web-based administration tools here
You can access pre-installed web-based administration tools here.

```bash
http://YOUR_IP_ADDRESS:8082/lcp/
```

Adminer (Web-based SQL database managemer)
Adminer (Web-based SQL database manager)

```bash
http://YOUR_DOMAIN_NAME:8082/lcp/dbadmin
```

TinyFileManager (Web-based file managemer)
TinyFileManager (Web-based file manager)

```bash
http://YOUR_DOMAIN_NAME:8082/lcp/filemanager
Expand All @@ -161,7 +162,7 @@ Add your feature [request here](https://github.com/joglomedia/LEMPer/issues/new)

## Security Vulnerabilities and Bugs

If you discover any security vulnerability or any bug within _LEMPer Stack_, please open an issue.
If you discover any security vulnerability or any bug within _LEMPer Stack_, please open an [issue](https://github.com/joglomedia/LEMPer/issues/new).

## Contributing

Expand Down Expand Up @@ -204,16 +205,16 @@ Made with [contributors-img](https://contrib.rocks).

### Financial Contributors

You can support us using any of the methods below:
You can support development by using any of the methods below:

**[Buy Me a Bottle of Milk or a Cup of Coffee](https://paypal.me/masedi) !!**

## Licence

LEMPer stack is open-source project licensed under the GNU GPLv3 license.
LEMPer Stack is open-source project licensed under the GNU GPLv3 license.

## Copyright

(c) 2014-2021 | [MasEDI.Net](https://masedi.net/)
(c) 2014-2022 | [MasEDI.Net](https://masedi.net/)

### Enjoy LEMPer Stack ;)
125 changes: 111 additions & 14 deletions bin/lemper-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,108 @@ set -e
PROG_NAME=$(basename "$0")
PROG_VER="2.x.x"

# May need to run this as sudo!
if [[ "$(id -u)" -ne 0 ]]; then
echo "This command can only be run by root."
# Test mode.
DRYRUN=false

# Color decorator.
RED=91
GREEN=92
YELLOW=93

##
# Helper Functions.
##
function begin_color() {
color="${1}"
echo -e -n "\e[${color}m"
}

function end_color() {
echo -e -n "\e[0m"
}

function echo_color() {
color="${1}"
shift
begin_color "${color}"
echo "$@"
end_color
}

function status() {
echo_color "${GREEN}" "$@"
}

function warning() {
echo_color "${YELLOW}" "$@"
}

function success() {
echo_color "${GREEN}" -n "Success: " >&2
echo "$@" >&2
}

function info() {
echo_color "${YELLOW}" -n "Info: " >&2
echo "$@" >&2
}

function error() {
echo_color "${RED}" -n "Error: " >&2
echo "$@" >&2
}

# Prints an error message and exits with an error code.
function fail() {
error "$@"
#echo >&2
echo "For usage information, run this script with --help" >&2
exit 1
fi
}

function echo_ok() {
echo_color "${GREEN}" "OK"
}

function echo_warn() {
echo_color "${YELLOW}" "WARN"
}

function echo_err() {
echo_color "${RED}" "ERROR"
}

# Export LEMPer stack configuration.
# Run command.
function run() {
if "${DRYRUN}"; then
echo_color "${YELLOW}" -n "would run "
echo "$@"
else
if ! "$@"; then
local CMDSTR="$*"
error "Failure running '${CMDSTR}', exiting."
exit 1
fi
fi
}

# Make sure only root can run this script.
function requires_root() {
if [[ "$(id -u)" -ne 0 ]]; then
if ! hash sudo 2>/dev/null; then
echo "${PROG_NAME} command must be run as 'root' or with sudo."
exit 1
else
#echo "Switching to root user to run this script."
sudo -E "$0" "$@"
exit 0
fi
fi
}

requires_root "$@"

# Export LEMPer Stack configuration.
if [[ -f "/etc/lemper/lemper.conf" ]]; then
# Clean environemnt first.
# shellcheck source=/etc/lemper/lemper.conf
Expand All @@ -39,8 +134,8 @@ if [[ -f "/etc/lemper/lemper.conf" ]]; then
# shellcheck disable=SC1091
source <(grep -v '^#' /etc/lemper/lemper.conf | grep -v '^\[' | sed -E 's|^(.+)=(.*)$|: ${\1=\2}; export \1|g')
else
echo "LEMPer stack configuration required, but the file doesn't exist."
echo "It should be created during installation process and placed under '/etc/lemper/lemper.conf'"
echo "LEMPer Stack configuration required, but the file doesn't exist."
echo "It should be created during installation process and placed under '/etc/lemper/lemper.conf'."
exit 1
fi

Expand All @@ -49,13 +144,13 @@ LEMPER_USERNAME=${LEMPER_USERNAME:-"lemper"}
LEMPER_PASSWORD=${LEMPER_PASSWORD:-""}
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-""}

# CLI plugins directory.
# Set CLI plugins directory.
CLI_PLUGINS_DIR="/etc/lemper/cli-plugins"

##
# Show usage
# output to STDERR.
#
##
function cmd_help() {
cat <<- EOL
${PROG_NAME} ${PROG_VER}
Expand All @@ -76,19 +171,19 @@ EOL

##
# Show version.
#
##
function cmd_version() {
echo "${PROG_NAME} version $PROG_VER"
}

##
# Main LEMPer CLI Wrapper
#
# Main LEMPer CLI Wrapper.
##
function init_lemper_cli() {
# Check command line arguments.
if [[ -n "${1}" ]]; then
CMD="${1}"
shift # Pass the remaining arguments to the next function.
shift # Pass the remaining arguments as sub-command options (parameters).

case ${CMD} in
help | -h | --help)
Expand All @@ -101,7 +196,9 @@ function init_lemper_cli() {
;;
*)
if [[ -x "${CLI_PLUGINS_DIR}/lemper-${CMD}" ]]; then
"${CLI_PLUGINS_DIR}/lemper-${CMD}" "$@"
# Source the plugin executable file.
# shellcheck disable=SC1090
. "${CLI_PLUGINS_DIR}/lemper-${CMD}" "$@"
exit 0
else
echo "${PROG_NAME}: '${CMD}' is not ${PROG_NAME} command."
Expand Down
13 changes: 13 additions & 0 deletions etc/logrotate.d/php5.6-fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/var/log/php5.6-fpm.log /home/*/logs/php/php5.6-fpm.log {
rotate 12
weekly
missingok
notifempty
compress
delaycompress
postrotate
if [ -x /usr/lib/php/php5.6-fpm-reopenlogs ]; then
/usr/lib/php/php5.6-fpm-reopenlogs;
fi
endscript
}
13 changes: 13 additions & 0 deletions etc/logrotate.d/php7.0-fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/var/log/php7.0-fpm.log /home/*/logs/php/php7.0-fpm.log {
rotate 12
weekly
missingok
notifempty
compress
delaycompress
postrotate
if [ -x /usr/lib/php/php7.0-fpm-reopenlogs ]; then
/usr/lib/php/php7.0-fpm-reopenlogs;
fi
endscript
}
13 changes: 13 additions & 0 deletions etc/logrotate.d/php7.1-fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/var/log/php7.1-fpm.log /home/*/logs/php/php7.1-fpm.log {
rotate 12
weekly
missingok
notifempty
compress
delaycompress
postrotate
if [ -x /usr/lib/php/php7.1-fpm-reopenlogs ]; then
/usr/lib/php/php7.1-fpm-reopenlogs;
fi
endscript
}
13 changes: 13 additions & 0 deletions etc/logrotate.d/php7.2-fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/var/log/php7.2-fpm.log /home/*/logs/php/php7.2-fpm.log {
rotate 12
weekly
missingok
notifempty
compress
delaycompress
postrotate
if [ -x /usr/lib/php/php7.2-fpm-reopenlogs ]; then
/usr/lib/php/php7.2-fpm-reopenlogs;
fi
endscript
}
13 changes: 13 additions & 0 deletions etc/logrotate.d/php7.3-fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/var/log/php7.3-fpm.log /home/*/logs/php/php7.3-fpm.log {
rotate 12
weekly
missingok
notifempty
compress
delaycompress
postrotate
if [ -x /usr/lib/php/php7.3-fpm-reopenlogs ]; then
/usr/lib/php/php7.3-fpm-reopenlogs;
fi
endscript
}
13 changes: 13 additions & 0 deletions etc/logrotate.d/php7.4-fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/var/log/php7.4-fpm.log /home/*/logs/php/php7.4-fpm.log {
rotate 12
weekly
missingok
notifempty
compress
delaycompress
postrotate
if [ -x /usr/lib/php/php7.4-fpm-reopenlogs ]; then
/usr/lib/php/php7.4-fpm-reopenlogs;
fi
endscript
}
13 changes: 13 additions & 0 deletions etc/logrotate.d/php8.0-fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/var/log/php8.0-fpm.log /home/*/logs/php/php8.0-fpm.log {
rotate 12
weekly
missingok
notifempty
compress
delaycompress
postrotate
if [ -x /usr/lib/php/php8.0-fpm-reopenlogs ]; then
/usr/lib/php/php8.0-fpm-reopenlogs;
fi
endscript
}
13 changes: 13 additions & 0 deletions etc/logrotate.d/php8.1-fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/var/log/php8.1-fpm.log /home/*/logs/php/php8.1-fpm.log {
rotate 12
weekly
missingok
notifempty
compress
delaycompress
postrotate
if [ -x /usr/lib/php/php8.1-fpm-reopenlogs ]; then
/usr/lib/php/php8.1-fpm-reopenlogs;
fi
endscript
}
Loading

0 comments on commit 6edf44c

Please sign in to comment.