Lumen on Docker - Skeleton project with Nginx, MySQL & PHP 8 | Aws ECS, Google Kubernates, Azure Container Engine

Overview

Docker infrastructure for Lumen

Description

Microservice Lumen is a starting skeleton based on Docker and Lumen Framework. This project helps to develop and maintain a simple and clean infrastructure for the management / creation of php microservices. In just a few steps, the developer starts the development / staging / production environment as needed. Basically, the Nginx containers are available for the webserver, the backend container in PHP 7.4 for the application, both based on Linux alpine. Include MySQL container by default. The Dockefile (in the docker folder) is already set up to create the production image of the application, we recommend modifying it only to add dependencies or configurations.

Develop env

La prima volta che viene eseguito il setup saranno chiesti in input dei dati (nome app, verisone larvel ed altro), questo genererà un file env.conf e un .env (che è la copia esetta), il primo dovrete versionarlo il secondo sarà escluso. Inoltre verrà scaricato il codice sorgente laravel/lumen, anche'esso dovrà essere versionato. Nel caso il vostro progetto sia stato già inizializzato, chi andrà a scaricarlo dovrà eseguire comunque sia il primo passo indicato in 'setup and run'.

- require

OS: linux
Packages: make
Docker version: >= 18.09.6
docker-compose version: >= 1.28.0

- setup and run

1.  make setup

2.  [not required] Set .env db connection into lumen/ dir:
    DB_CONNECTION=mysql
    DB_HOST=mysql.private
    DB_PORT=3306
    DB_DATABASE=lumen
    DB_USERNAME=root
    DB_PASSWORD=root

- make commands

down:  down containers

up:   up -d containers

exec:  enter in app container

exec_mysql:  enter in mysql container

ssh_root:  connection ssh (as root) to server

ssh:  connection ssh (as www-data) to server

deploy: rebuild containers (down, build and up)

## production ##

image_build:  build immagine

image_push: publish image

Manual push into docker hub registry

References

Nginx: 1.18

PHP: 7.4-fpm-alpine

MySQL: 8.0

Lumen Framework: delfault master (or specific version)

License

This project is open-sourced software licensed under the MIT license

Comments
  • Permission error on Entrypoint script

    Permission error on Entrypoint script

    Hi,

    after creating and publishing the image, if you try to start it, the nginx service fails with the following error: starting container process caused: exec: "/usr/local/sbin/services/init.sh": stat /usr/local/sbin/services/init.sh: permission denied: unknown

    The problem is bypassed by editing the following line in the Dockerfile: USER www-data to USER root at row 86.

    Thanks.

    bug 
    opened by benjiam-gh 3
  • Bump illuminate/database from 7.1.3 to 7.30.4 in /source

    Bump illuminate/database from 7.1.3 to 7.30.4 in /source

    Bumps illuminate/database from 7.1.3 to 7.30.4.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump illuminate/database from 7.1.3 to 7.30.3 in /source

    Bump illuminate/database from 7.1.3 to 7.30.3 in /source

    Bumps illuminate/database from 7.1.3 to 7.30.3.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump symfony/http-kernel from 5.0.5 to 5.1.5 in /source

    Bump symfony/http-kernel from 5.0.5 to 5.1.5 in /source

    Bumps symfony/http-kernel from 5.0.5 to 5.1.5.

    Release notes

    Sourced from symfony/http-kernel's releases.

    v5.1.5

    Changelog (https://github.com/symfony/http-kernel/compare/v5.1.4...v5.1.5)

    • no changes

    v5.1.4

    Changelog (https://github.com/symfony/http-kernel/compare/v5.1.3...v5.1.4)

    • bug #37841 Backport handler lock when using VAR_DUMPER_FORMAT (ogizanagi)

    v5.1.3

    Changelog (https://github.com/symfony/http-kernel/compare/v5.1.2...v5.1.3)

    • bug #37341 Fix support for PHP8 union types (nicolas-grekas)

    v5.1.2

    Changelog (https://github.com/symfony/http-kernel/compare/v5.1.1...v5.1.2)

    • no changes

    v5.1.1

    Changelog (https://github.com/symfony/http-kernel/compare/v5.1.0...v5.1.1)

    • bug #37182 Fix regression where Store does not return response body correctly (mpdude)

    v5.1.0

    Changelog (https://github.com/symfony/http-kernel/compare/v5.1.0-RC2...v5.1.0)

    • no changes

    v5.1.0-RC2

    Changelog (https://github.com/symfony/http-kernel/compare/v5.1.0-RC1...v5.1.0-RC2)

    • bug #36891 Address deprecation of ReflectionType::getClass() (derrabus)
    • bug #36833 Fix that the Store would not save responses with the X-Content-Digest header present (mpdude)
    • bug #36855 Fix error logger when stderr is redirected to /dev/null (fabpot)
    • bug #36838 Bring back the debug toolbar (derrabus)

    v5.1.0-RC1

    Changelog (https://github.com/symfony/http-kernel/compare/v5.1.0-BETA1...v5.1.0-RC1)

    • bug #36789 Change priority of KernelEvents::RESPONSE subscriber (marcw)

    v5.0.11

    Changelog (https://github.com/symfony/http-kernel/compare/v5.0.10...v5.0.11)

    • bug #37341 Fix support for PHP8 union types (nicolas-grekas)

    v5.0.10

    Changelog (https://github.com/symfony/http-kernel/compare/v5.0.9...v5.0.10)

    Changelog

    Sourced from symfony/http-kernel's changelog.

    CHANGELOG

    5.2.0

    • added session usage
    • made the public http_cache service handle requests when available
    • allowed enabling trusted hosts and proxies using new kernel.trusted_hosts, kernel.trusted_proxies and kernel.trusted_headers parameters
    • content of request parameter _password is now also hidden in the request profiler raw content section

    5.1.0

    • allowed to use a specific logger channel for deprecations
    • made WarmableInterface::warmUp() return a list of classes or files to preload on PHP 7.4+; not returning an array is deprecated
    • made kernels implementing WarmableInterface be part of the cache warmup stage
    • deprecated support for service:action syntax to reference controllers, use serviceOrFqcn::method instead
    • allowed using public aliases to reference controllers
    • added session usage reporting when the _stateless attribute of the request is set to true
    • added AbstractSessionListener::onSessionUsage() to report when the session is used while a request is stateless

    5.0.0

    • removed support for getting the container from a non-booted kernel
    • removed the first and second constructor argument of ConfigDataCollector
    • removed ConfigDataCollector::getApplicationName()
    • removed ConfigDataCollector::getApplicationVersion()
    • removed support for Symfony\Component\Templating\EngineInterface in HIncludeFragmentRenderer, use a Twig\Environment only
    • removed TranslatorListener in favor of LocaleAwareListener
    • removed getRootDir() and getName() from Kernel and KernelInterface
    • removed FilterControllerArgumentsEvent, use ControllerArgumentsEvent instead
    • removed FilterControllerEvent, use ControllerEvent instead
    • removed FilterResponseEvent, use ResponseEvent instead
    • removed GetResponseEvent, use RequestEvent instead
    • removed GetResponseForControllerResultEvent, use ViewEvent instead
    • removed GetResponseForExceptionEvent, use ExceptionEvent instead
    • removed PostResponseEvent, use TerminateEvent instead
    • removed SaveSessionListener in favor of AbstractSessionListener
    • removed Client, use HttpKernelBrowser instead
    • added method getProjectDir() to KernelInterface
    • removed methods serialize and unserialize from DataCollector, store the serialized state in the data property instead
    • made ProfilerStorageInterface internal
    • removed the second and third argument of KernelInterface::locateResource
    • removed the second and third argument of FileLocator::__construct
    • removed loading resources from %kernel.root_dir%/Resources and %kernel.root_dir% as
    Commits
    • 3e32676 Update VERSION for 5.1.5
    • f855601 Merge branch '4.4' into 5.1
    • cdf1e9b security #cve-2020-15094 Remove headers with internal meaning from HttpClient...
    • 8e8d0ed Remove headers with internal meaning from HttpClient responses
    • 05293dd Bump Symfony version to 5.1.5
    • f829c24 Update VERSION for 5.1.4
    • a5ed890 Bump Symfony version to 4.4.13
    • f93f6b3 Update VERSION for 4.4.12
    • 794f3d4 Merge branch '4.4' into 5.1
    • 98fb210 minor #37831 stop using deprecated PHPUnit APIs (xabbuh)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Super interesting project! Site returns a 404

    Super interesting project! Site returns a 404

    Hi Fabrizio! This project looks really interesting. The issue is just to tell you that the site https://fabriziocafolla.github.io/microservice-lumen/ returns a 404, just in case you didn't know :)

    opened by fgilio 1
  • Redis-cli container close just after start

    Redis-cli container close just after start

    Redis-cli container close just after start, logs seems to be empty. Problem seems to be related to command attribute on docker-compose.

      # Use it with command: docker-compose run redis-cli
      redis-cli:
        container_name: ${NAME}_redis-cli
        image: "${REDIS_NAME}:${REDIS_TAG}"
        links:
          - redis
        command: redis-cli -h redis
    
    opened by alessandromr 1
  • Bump symfony/http-foundation from 5.0.5 to 5.0.7 in /source

    Bump symfony/http-foundation from 5.0.5 to 5.0.7 in /source

    Bumps symfony/http-foundation from 5.0.5 to 5.0.7.

    Release notes

    Sourced from symfony/http-foundation's releases.

    v5.0.7

    Changelog (https://github.com/symfony/http-foundation/compare/v5.0.6...v5.0.7)

    • no changes

    v5.0.6

    Changelog (https://github.com/symfony/http-foundation/compare/v5.0.5...v5.0.6)

    • bug #36173 Fix clear cookie samesite (guillbdx)
    • bug #36103 fix preloading script generation (nicolas-grekas)
    Commits
    • 26fb006 Merge branch '4.4' into 5.0
    • 62f9250 [HttpFoundation] Do not set the default Content-Type based on the Accept header
    • 98b44bd Merge branch '4.4' into 5.0
    • 67d0196 add missing gitattributes for phpunit-bridge
    • 2da0828 Merge branch '4.4' into 5.0
    • 0a3b771 Merge branch '3.4' into 4.4
    • a8833c5 [Http Foundation] Fix clear cookie samesite
    • 6748a30 Merge branch '4.4' into 5.0
    • 109ac25 [DI] fix preloading script generation
    • bb49965 Merge branch '4.4' into 5.0
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • 'ADD' fix + workspace dockerfile cleaning

    'ADD' fix + workspace dockerfile cleaning

    Readme must be updated:

    1. After docker-compose exec workspace bash composer install is needed to run.

    commit Workspace Dockerfile cleaning

    Removed unused commands from workspace dockerfile ADD is not used because file added during build are overwritten by volumes composer must be executed after build, so in Dockerfile is not used cp .env is unused because is overwritten by volumes files


    commit Mysql + Redis ADD fix

    1. removed mysql and redis dockerfile. Tag image in docker-compose file is already selecting the right image, so dockerfile is not required.

    Changes are tested.

    opened by alessandromr 0
  • Fix Lumen env copy + Mysql/Redis ADD fix

    Fix Lumen env copy + Mysql/Redis ADD fix

    To copy the .env during the first start i used a shell script. The script check if .env already exist, if not create a new one based on .env.example.


    Changed the docker-compose file, remove the build attr because image do almost the same. Also remove the mysql and redis dockerfile, now the version is selected directly from docker-compose image attribute.

    opened by alessandromr 0
Releases(v1.0)
  • v1.0(Sep 12, 2022)

    Note

    You can create your Lumen microservice and start programming in just a few steps.

    The first version enables local development and image preparation for QA and Production environments.

    Source code(tar.gz)
    Source code(zip)
Owner
Fabrizio Cafolla
DevOps Engineer | #FullRemote #Microservices #AWS #Docker #Python #Php #Linux #CI/CD
Fabrizio Cafolla
Magento-Vagrant-Puppet-Nginx - Installs magento and a nginx server

Magento-Vagrant-Puppet-Nginx Installs Magento MySQL PHP PHP-FPM Nginx n98-magerun Setup git submodule init git submodule update vagrant up Modify pupp

Christian Münch 61 Aug 10, 2022
CDK patterns for serverless container with AWS Fargate

cdk-fargate-patterns CDK patterns for serverless container with AWS Fargate DualAlbFargateService Inspired by Vijay Menon from the AWS blog post intro

Pahud Hsieh 48 Sep 1, 2021
PHP project for tracking Azure AD App Reg secrets about to expire, and (manually) tracking SSL certificates

CertExpiry Katy Nicholson https://katystech.blog/ Setup instructions etc available at: https://katystech.blog/2021/11/certexpiry/ PHP project for trac

Katy Nicholson 5 Oct 2, 2022
Hachkathon DevOps - Deploy application with docker container

Hackathon-Semesta-DevOps Nama : Islam Nurul Yakin Mail : [email protected] Sebuah Web Server menggunakan Nginx, PHP, dan MySQl di tambah dengan p

Islam Nurul Yakin 3 Jul 14, 2022
🐋 This project aims to broaden knowledge of system administration by using Docker: virtualizing several Docker images, creating them in a new personal virtual machine.

?? This project aims to broaden knowledge of system administration by using Docker: virtualizing several Docker images, creating them in a new personal virtual machine.

Anton Kliek 1 Jan 26, 2022
Microsoft Azure Storage Library for PHP

Microsoft Azure Storage PHP Client Libraries This project will be in Community Support and Azure Storage team commits to validate and release every qu

Microsoft Azure 201 Nov 30, 2022
Automatische Bild-Beschreibung mit Azure Cognitive Services

Degas Automatische Bild-Beschreibung mit Azure Cognitive Services Das Addon benutzt die "Description" Funktion der "Computer Vision API" die von den A

Oliver Hörold 4 May 13, 2022
A complete stack for running Symfony 5 into Docker containers using docker-compose tool and with Certbot for the HTTPS certificate.

?? Docker + PHP 7.4 + MySQL8.0 + Nginx + Certbot(HTTPS) + Symfony 5 Boilerplate ?? Edited from https://github.com/ger86/symfony-docker version -> http

null 6 Nov 9, 2022
Docker-magento - Docker image for Magento 1.6 to 1.9

Docker image for Magento 1.x This repo creates a Docker image for Magento 1.x. Please note The primary goal of this repo is to create Docker images fo

Fu Cheng 144 Nov 18, 2022
A privacy respecting free as in freedom meta search engine for Google and popular torrent sites

A privacy respecting free as in freedom meta search engine for Google and popular torrent sites

null 329 Dec 27, 2022
Docker with Apache, MySql, PhpMyAdmin and Php

docker-lamp Docker example with Apache, MySql 8.0, PhpMyAdmin and Php You can use MariaDB 10.1 if you checkout to the tag mariadb-10.1 - contribution

Joel Cavat 360 Dec 3, 2022
Like Cloud Drive Run on Raspbian + Nginx + PHP

Raspberry-Pi-Cloud Like Cloud Drive Run on Raspbian + Nginx + PHP I Made a Project Called Raspberry-Pi-Cloud. it's on testing stage help me to test it

null 1 Dec 25, 2021
Here are few exercises to practice how to implement API Security with NGINX App-Protect WAF.

api-security-lab This repo contains files for customers and partners to practice an API Security with NGINX App-Protect WAF. To demonstrate the capabi

null 4 Mar 30, 2022
Default Nginx config for Magento

Default Nginx config for Magento DEMO: https://www.magenx.com Get cloud server: at DigitalOcean magento Magento upto 1.9.x default magento configurati

MagenX 499 Dec 22, 2022
λ Run PHP Coroutines & Fibers as-a-Service on the AWS Lambda.

λ Swoole Runtime for AWS Lambda Run PHP Coroutines & Fibers as-a-Service on the AWS Lambda. Getting started Create your Lambda function index.php <?ph

Leo Cavalcante 32 Dec 29, 2022
Private Composer registry for private PHP packages on AWS Serverless

Tug Tug is a Composer private registry for private PHP packages installable with Composer (1 and 2). The main idea of this project is to have an inter

Fxp 33 Oct 5, 2022
This demo app shows you how to run a simple PHP application on AWS Elastic Beanstalk.

Elastic Beanstalk + PHP Demo App - "Share Your Thoughts" This demo app shows you how to run a simple PHP application on AWS Elastic Beanstalk. Run the

AWS Samples 143 Nov 26, 2022
PHP Runtime Layer for AWS Lambda

PHP Layer For AWS Lambda Ever wanted to run PHP websites in AWS Lambda? It's your lucky day! This Lambda Runtime Layer runs the PHP 7.3/7.1 webserver

Stackery 319 Nov 30, 2022
A tool to create php lambda's in AWS via custom runtime api

Getting Started This composer library assists in the creation, configuration, and testing of an AWS Lambda function. It utilizes the AWS Lambda custom

Mike McGrath 0 Jul 13, 2022