All Projects → adhocore → docker-lemp

adhocore / docker-lemp

Licence: MIT license
A single container LEMP complete fullstack with latest release of PHP7.4.33, 8.0.26 & 8.1.13/8.2RC and MySQL, nginx, PostgreSQL, phalcon, swoole, mailcatcher, beanstalkd, elasticsearch, memcached, redis, adminer and all you ever need; on top alpine3.15

Programming Languages

Dockerfile
14818 projects
shell
77523 projects
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to docker-lemp

laravel-username-generator
Automatically generate usernames for Laravel User Model
Stars: ✭ 37 (-65.09%)
Mutual labels:  php8, php74
session
Aplus Framework Session Library
Stars: ✭ 170 (+60.38%)
Mutual labels:  memcached, php8
php-json-schema-model-generator
Creates (immutable) PHP model classes from JSON-Schema files including all validation rules as PHP code
Stars: ✭ 36 (-66.04%)
Mutual labels:  php8, php74
php-currency-api
Standardized wrapper for popular currency rate APIs. Currently supports FixerIO, CurrencyLayer, Open Exchange Rates and Exchange Rates API.
Stars: ✭ 17 (-83.96%)
Mutual labels:  php8, php74
Phpfastcache
A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
Stars: ✭ 2,171 (+1948.11%)
Mutual labels:  memcached, php8
mdserver-web
Simple Linux Panel
Stars: ✭ 1,064 (+903.77%)
Mutual labels:  memcached, php74
alpine-php-fpm
Lightweight and optimised PHP-FPM (PHP 7.4, 8.0, 8.1) Docker images with essential extensions on top of latest Alpine Linux.
Stars: ✭ 53 (-50%)
Mutual labels:  alpine-linux, php8
resiliency
A modern PHP library that allows you to make resilient calls to external services 🔁
Stars: ✭ 79 (-25.47%)
Mutual labels:  php8, php74
Oneinstack
OneinStack - A PHP/JAVA Deployment Tool
Stars: ✭ 1,983 (+1770.75%)
Mutual labels:  memcached, lemp
Centminmod
CentOS Shell menu based Nginx LEMP web stack auto installer (GPLv3 licensed)
Stars: ✭ 519 (+389.62%)
Mutual labels:  memcached, lemp
Lnmp
LEMP stack/LAMP stack/LNMP stack installation scripts for CentOS/Redhat Debian and Ubuntu
Stars: ✭ 2,488 (+2247.17%)
Mutual labels:  memcached, lemp
cache
Aplus Framework Cache Library
Stars: ✭ 18 (-83.02%)
Mutual labels:  memcached, php8
istio-workspace
Safely develop and test on any Kubernetes cluster without affecting others.
Stars: ✭ 55 (-48.11%)
Mutual labels:  local-development
laradhoc
Laradhoc is a Docker-based basic LEMP development environment designed for Laravel applications.
Stars: ✭ 82 (-22.64%)
Mutual labels:  lemp
darknet
php ffi darknet
Stars: ✭ 21 (-80.19%)
Mutual labels:  php8
NALib
General purpose C sourcecode collection
Stars: ✭ 16 (-84.91%)
Mutual labels:  stack
Nutgram
The Telegram bot framework that doesn't drive you nuts.
Stars: ✭ 206 (+94.34%)
Mutual labels:  php8
BasicExercises
📘 Personal basic practice test playground.
Stars: ✭ 84 (-20.75%)
Mutual labels:  stack
crossword
The game is implemented as an example of scalable and high load architecture combined with modern software development practices
Stars: ✭ 56 (-47.17%)
Mutual labels:  php8
Attack-Shell
Attack Shell a.k.a. Ani-Shell is a simple PHP shell with some unique features like Mass Mailer, a simple Web-Server Fuzzer, Dosser, Back Connect, Bind Shell, Back Connect, Auto Rooter etc.
Stars: ✭ 15 (-85.85%)
Mutual labels:  alpine-linux

docker-lemp

Docker build Donate 15 Donate 25 Donate 50 Tweet

Do not use this LEMP in Production. For production, use adhocore/phpfpm then compose a stack using individual nginx, redis, mysql etc images.

adhocore/lemp is a minimal single container LEMP full stack for local development.

If you want to use PHP7.4 on LEMP stack then head over to adhocore/lemp:7.4.

It is quick jumpstart for onboarding you into docker based development. The download size is just about ~360MB which is tiny considering how much tools and stuffs it contains.

The docker container adhocore/lemp is composed of:

Name Version Port
adminer 4.8.1 80
alpine 3.15 -
beanstalkd 1.12 11300
elasticsearch 6.4.3 9200,9300
mailcatcher 0.7.1 88,25
memcached 1.6.12 11211
MySQL* 5.7 3306
nginx 1.20.2 80
phalcon 5.0.3 -
PHP8.2~ 8.2RC4 9000
PHP8.1+ 8.1.11 9000
PHP8.0+ 8.0.24 9000
PHP7.4+ 7.4.32 9000
PostgreSQL 14.5 5432
rabbitmq^ 3.8.* 5672
redis 6.2.7 6379
swoole 4.8.9 -

*: Actually MariaDB 10.6.9.

~: RC version can be used for test/dev but not production.

+: Different image tags each viz 8.2, :8.1, :8.0 and :7.4.

Usage

Install docker in your machine. Also recommended to install docker-compose.

# pull latest image
docker pull adhocore/lemp:8.1

# or with PHP8.0
docker pull adhocore/lemp:8.0

# or if you use php 7.4, replace 8.0 with 7.4:
docker pull adhocore/lemp:7.4

# tryout php 8.2rc
docker pull adhocore/lemp:8.1

# Go to your project root then run
docker run -p 8080:80 -p 8888:88 -v `pwd`:/var/www/html --name lemp -d adhocore/lemp:8.0

# In windows, you would use %cd% instead of `pwd`
docker run -p 8080:80 -p 8888:88 -v %cd%:/var/www/html --name lemp -d adhocore/lemp:8.0

# If you want to setup MySQL credentials, pass env vars
docker run -p 8080:80 -p 8888:88 -v `pwd`:/var/www/html \
  -e MYSQL_ROOT_PASSWORD=1234567890 -e MYSQL_DATABASE=appdb \
  -e MYSQL_USER=dbuser -e MYSQL_PASSWORD=123456 \
  --name lemp -d adhocore/lemp:8.1
  # for postgres you can pass in similar env as for mysql but with PGSQL_ prefix

After running container as above, you will be able to browse localhost:8080!

The database adminer will be available for mysql and postgres.

The mailcatcher will be available at localhost:8888 which displays mails in realtime.

Stop container

To stop the container, you would run:

docker stop lemp

(Re)Start container

You dont have to always do docker run as in above unless you removed or lost your lemp container.

Instead, you can just start when needed:

docker start lemp

PRO If you develop multiple apps, you can create multiple lemp containers with different names.

eg: docker run -p 8081:80 -v $(pwd):/var/www/html --name new-lemp -d adhocore/lemp:8.0

With Docker compose

Create a docker-compose.yml in your project root with contents something similar to:

# ./docker-compose.yml
version: '3'

services:
  app:
    image: adhocore/lemp:8.0
    # For different app you can use different names. (eg: )
    container_name: some-app
    volumes:
      # app source code
      - ./path/to/your/app:/var/www/html
      # db data persistence
      - db_data:/var/lib/mysql
      # Here you can also volume php ini settings
      # - /path/to/zz-overrides:/usr/local/etc/php/conf.d/zz-overrides.ini
    ports:
      - 8080:80
    environment:
      MYSQL_ROOT_PASSWORD: supersecurepwd
      MYSQL_DATABASE: appdb
      MYSQL_USER: dbusr
      MYSQL_PASSWORD: securepwd
      # for postgres you can pass in similar env as for mysql but with PGSQL_ prefix

volumes:
  db_data: {}

Then all you gotta do is:

# To start
docker-compose up -d

# To stop
docker-compose stop

As you can see using compose is very neat, intuitive and easy. Plus you can already set the volumes and ports there, so you dont have to type in terminal.

MySQL Default credentials

  • root password: 1234567890 (if MYSQL_ROOT_PASSWORD is not passed)
  • user password: 123456 (if MYSQL_USER is passed but MYSQL_PASSWORD is not)

PgSQL Default credentials

  • postgres password: 1234567890 (if PGSQL_ROOT_PASSWORD is not passed)
  • user password: 123456 (if PGSQL_USER is passed but PGSQL_PASSWORD is not)

Accessing DB

In PHP app you can access MySQL db via PDO like so:

$db = new PDO(
    'mysql:host=127.0.0.1;port=3306;dbname=' . getenv('MYSQL_DATABASE'),
    getenv('MYSQL_USER'),
    getenv('MYSQL_PASSWORD')
);

You can access PgSQL db via PDO like so:

$pdb = new PDO(
    'pgsql:host=127.0.0.1;port=5432;dbname=' . getenv('PGSQL_DATABASE'),
    getenv('PGSQL_USER'),
    getenv('PGSQL_PASSWORD')
);

Nginx

URL rewrite is already enabled for you.

Either your app has public/ folder or not, the rewrite adapts automatically.

PHP

For available extensions, check adhocore/phpfpm#extensions.

Disabling services

Pass in env var DISABLE to the container in CSV format to disable services. The service names must be one or more of below in comma separated format:

beanstalkd
mailcatcher
memcached
mysql
pgsql
redis

Example: DISABLE=beanstalkd,mailcatcher,memcached,pgsql,redis Essential services like nginx, php, adminer cannot be disabled ;).

The service(s) will be enabled again if you run the container next time without DISABLE env or if you remove specific services from DISABLE CSV.

Testing mailcatcher

# open shell
docker exec -it lemp sh

# send test mail
echo "\n" | sendmail -S 0 test@localhost

Then you will see the new mail in realtime at http://localhost:8888.

Or you can check it in shell as well:

curl 0:88/messages
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].