Code Monkey home page Code Monkey logo

aphex's Introduction

Alpine Linux, PHP, Nginx

A super fast, super slim, production hardened PHP 7.3/7.4 and Nginx docker image built on Alpine Linux.

Perfect for horizontally distributed PHP and Laravel applications run within a container cluster.

Stack

  • Alpine Linux
  • PHP 7.3/7.4 & PHP-FPM
    • mysqli
    • pdo, pdo_mysql + pdo_sqlite
    • opcache
    • pcntl
    • bcmath
    • exif
    • mbstring
    • gd
    • xdebug-2.9 (Not loaded)
  • NGINX 1.16 (FastCGI web-server)
  • Composer 2 (PHP package manager)
    • hirak/prestissimo was previously globally installed, but is no longer required nor supported under Composer 2
  • Supervisor Daemon (Process manager)
  • Tooling
    • git
    • wget
    • bash

Usage

This image should not be directly built, it a starting point for your own Dockerfile.

Your Dockerfile should ADD an Nginx configuration file at the very least.

Lightweight example Dockerfile of running a brand new Laravel application

docker build -f example/Dockerfile .

XDebug

XDebug is included with the image, but not enabled for the PHP runtime. Lazily loading the xdebug module through command-line can be done via

php -d zend_extension=xdebug ...

Logging Output

A docker container should have the command it runs output to stdout and stderr, so the container runner (e.g. docker-compose / Kubernetes) can see this output and forward it to a logging system.

PHP

PHP-FPM has workers that can emit to php://stdout and php://stderr. These are captured by PHP-FPM's master process and can be logged to a single error log file. However, there is no way to send these to two separate files.

Additionally, a further file symlink would be needed to forward this output to /dev/stdout. But, PHP-FPM does not run as a user with the privilege to create this symlink or write to the file. Only root can write to /dev/stdout.

Possible Solutions

  1. Have php workers write to a file in a known location, /var/www/storage/logs/stdout.log.
  2. A process running as root tails this file and forwards it to /dev/stdout
  3. Another process truncates this file occasionally to prevent it from filling up the file system

aphex's People

Contributors

00dani avatar 4406arthur avatar andrewmclagan avatar developerdino avatar igornadj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aphex's Issues

How to Properly Set it up with HAProxy?

Hi i want to scale This Container at the same time load balance...

I manage to Run this Container with no Problem...

version: '2'
services:
    web:
        build: ./web
        container_name: sandbox-web
        volumes:
        - ./laravel:/var/www
        - ./web/config/supervisord.conf:/etc/supervisord.conf
        - ./web/config/nginx.conf:/etc/nginx/nginx.conf
        - ./web/config/php.ini:/usr/local/etc/php/conf.d/php-fpm.ini
        ports:
        - "80:80"

when i do docker-compose up
i see laravel site up and running...

but as i try to do scaling with docker...

im facing hardship making it work...

but i manage to make it work at this repo
https://github.com/andrewmclagan/nginx-hhvm-docker

this is my docker-compose
https://gist.github.com/g0ld3lux/8d7e5aaf812f028c2a289e65073274a5

i only manage to make it work using stack file

i cant make it work on docker-compose v2

but aphex on the other hand i cant even use the stackfile and v2 syntax

Can You Share me Your Docker compose file?

Add PHP BCMATH module?

This is great setup, but our application is dependant on PHP bcmath functions. Would be nice to optionally add it to current extensions.

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.