Vincent Letourneau 301c7040ba Update gitignore
2017-06-13 22:20:18 +02:00
2017-06-13 22:18:16 +02:00
2017-06-13 22:18:45 +02:00
2017-06-13 20:25:09 +02:00
2017-06-13 22:20:18 +02:00
2017-01-22 10:42:42 +01:00
2017-06-13 22:19:29 +02:00

Nginx PHP MySQL

Docker running Nginx, PHP-FPM, MySQL and PHPMyAdmin.

THIS ENVIRONMENT SHOULD ONLY BE USED FOR DEVELOPMENT!

DO NOT USE IT IN PRODUCTION!

Images to use

Start using it

  1. Download it :

    $ git clone https://github.com/nanoninja/docker-nginx-php-mysql.git
    
  2. Copying the composer configuration file :

    # Convenient to avoid overwriting the configuration with Git.
    $ cp web/app/composer.json.dist web/app/composer.json
    
  3. Run :

    $ docker-compose up -d
    
  4. Open your favorite browser :

Directory tree

├── README.md
├── bin
│   └── linux
│       └── clean.sh
├── docker-compose.yml
├── etc
│   ├── nginx
│   │   └── default.conf
│   └── php
│       └── php.ini
└── web
    ├── app
    │   ├── composer.json.dist
    │   ├── phpunit.xml.dist
    │   ├── src
    │   │   └── Foo.php
    │   └── test
    │       ├── FooTest.php
    │       └── bootstrap.php
    └── public
        └── index.php

Connecting from PDO

<?php
    $dsn = 'mysql:host=mysql;dbname=test;charset=utf8;port=3306';
    $pdo = new PDO($dsn, 'dev', 'dev');
?>

Updating composer

$ docker run --rm -v $(pwd)/web/app:/app -v ~/.ssh:/root/.ssh composer/composer update

MySQL Container shell access

$ docker exec -it mysql bash

and

$ mysql -uroot -proot

Creating database dumps

$ docker exec mysql sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/all-databases.sql

or

$ docker exec mysql sh -c 'exec mysqldump dbname -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/dbname.sql

Example

$ docker exec mysql sh -c 'exec mysqldump test -uroot -p"$MYSQL_ROOT_PASSWORD"' > $(pwd)/data/db/dumps/test.sql

Generating SSL certificates

  1. Generate certificates

    $ docker run --rm -v $(pwd)/etc/ssl:/certificates -e "SERVER=localhost" jacoelho/generate-certificate
    
  2. Configure Nginx

    Edit nginx file etc/nginx/default.conf and uncomment the server section.

    # server {
    #     ...
    # }
    

Generating API Documentation

./web/app/vendor/apigen/apigen/bin/apigen generate -s web/app/src -d web/app/doc

Cleaning project

$ ./bin/linux/clean.sh $(pwd)
Description
Docker running Nginx, PHP-FPM, MySQL, and PHPMyAdmin
Readme 17 MiB
Languages
Shell 76.7%
Batchfile 15.8%
Makefile 7.5%