From 466dbca456c291d3438bfa348f7612c24260fd3a Mon Sep 17 00:00:00 2001 From: Vincent Letourneau Date: Thu, 29 Mar 2018 10:32:54 +0200 Subject: [PATCH] Documentation improvement --- README.md | 52 ++++++++++++------------ doc/configure-cacert-for-local-macosx.md | 26 ++++++++++++ 2 files changed, 52 insertions(+), 26 deletions(-) create mode 100644 doc/configure-cacert-for-local-macosx.md diff --git a/README.md b/README.md index edb4bb0..9836424 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ Docker running Nginx, PHP-FPM, Composer, MySQL and PHPMyAdmin. We’ll download the code from its repository on GitHub. -3. [Configure Nginx With SSL Certificates](#configure-nginx-with-ssl-certificates) [Optional] +3. [Configure Nginx With SSL Certificates](#configure-nginx-with-ssl-certificates) [`Optional`] We'll generate and configure SSL certificate for nginx before running server. -4. [Configure Xdebug](#configure-xdebug) [Optional] +4. [Configure Xdebug](#configure-xdebug) [`Optional`] We'll configure Xdebug for IDE (PHPStorm or Netbeans). @@ -24,7 +24,7 @@ Docker running Nginx, PHP-FPM, Composer, MySQL and PHPMyAdmin. By this point we’ll have all the project pieces in place. -6. [Use Makefile](#use-makefile) [Optional] +6. [Use Makefile](#use-makefile) [`Optional`] When developing, you can use `Makefile` for doing recurrent operations. @@ -225,20 +225,20 @@ ___ When developing, you can use [Makefile](https://en.wikipedia.org/wiki/Make_(software)) for doing the following operations : -| Name | Description | -|---------------|--------------------------------------------| -| apidoc | Generate documentation of API | -| clean | Clean directories for reset | -| code-sniff | Check the API with PHP Code Sniffer (PSR2) | -| composer-up | Update PHP dependencies with composer | -| docker-start | Create and start containers | -| docker-stop | Stop and clear all services | -| gen-certs | Generate SSL certificates for `nginx` | -| logs | Follow log output | -| mysql-dump | Create backup of whole database | -| mysql-restore | Restore backup from whole database | -| phpmd | Analyse the API with PHP Mess Detector | -| test | Test application with phpunit | +| Name | Description | +|---------------|----------------------------------------------| +| apidoc | Generate documentation of API | +| clean | Clean directories for reset | +| code-sniff | Check the API with PHP Code Sniffer (`PSR2`) | +| composer-up | Update PHP dependencies with composer | +| docker-start | Create and start containers | +| docker-stop | Stop and clear all services | +| gen-certs | Generate SSL certificates for `nginx` | +| logs | Follow log output | +| mysql-dump | Create backup of all databases | +| mysql-restore | Restore backup of all databases | +| phpmd | Analyse the API with PHP Mess Detector | +| test | Test application with phpunit | ### Examples @@ -273,7 +273,7 @@ sudo docker run --rm -v $(pwd)/web/app:/app composer update ### Generating PHP API documentation ```sh -sudo docker-compose exec -T php ./app/vendor/bin/apigen generate app/src --destination ./app/doc +sudo docker-compose exec -T php php -d memory_limit=256M -d xdebug.profiler_enable=0 ./app/vendor/bin/apigen generate app/src --destination ./app/doc ``` ### Testing PHP application with PHPUnit @@ -282,6 +282,12 @@ sudo docker-compose exec -T php ./app/vendor/bin/apigen generate app/src --desti sudo docker-compose exec -T php ./app/vendor/bin/phpunit --colors=always --configuration ./app/ ``` +### Fixing standard code with [PSR2](http://www.php-fig.org/psr/psr-2/) + +```sh +sudo docker-compose exec -T php ./app/vendor/bin/phpcs -v --standard=PSR2 ./app/src/ +``` + ### Checking the standard code with [PSR2](http://www.php-fig.org/psr/psr-2/) ```sh @@ -314,7 +320,7 @@ and mysql -u"$MYSQL_ROOT_USER" -p"$MYSQL_ROOT_PASSWORD" ``` -#### Backup of database +#### Creating a backup of all databases ```sh mkdir -p data/db/dumps @@ -324,13 +330,7 @@ mkdir -p data/db/dumps source .env && sudo docker exec $(sudo docker-compose ps -q mysqldb) mysqldump --all-databases -u"$MYSQL_ROOT_USER" -p"$MYSQL_ROOT_PASSWORD" > "data/db/dumps/db.sql" ``` -or - -```sh -source .env && sudo docker exec $(sudo docker-compose ps -q mysqldb) mysqldump test -u"$MYSQL_ROOT_USER" -p"$MYSQL_ROOT_PASSWORD" > "data/db/dumps/test.sql" -``` - -#### Restore Database +#### Restoring a backup of all databases ```sh source .env && sudo docker exec -i $(sudo docker-compose ps -q mysqldb) mysql -u"$MYSQL_ROOT_USER" -p"$MYSQL_ROOT_PASSWORD" < "data/db/dumps/db.sql" diff --git a/doc/configure-cacert-for-local-macosx.md b/doc/configure-cacert-for-local-macosx.md new file mode 100644 index 0000000..5af87db --- /dev/null +++ b/doc/configure-cacert-for-local-macosx.md @@ -0,0 +1,26 @@ +# Configure Local CA CERT with MacOS + +## 1. The warning you receive while developing locally. + +![Warning](images/cacert-1-warning.png) + +## 2. Open the keychain app. + +![Open Keychain](images/cacert-2-open-keychain.png) + +## 3. Use File --> Import to add the ca cert you've already created. + +![Add CA Cert](images/cacert-3-add-cacert-file-import.png) + +## 4. Once added, locate it via the search box. + +![Localhost Search Box](images/cacert-4-locate-cert.png) + +## 5. Set to always trust. + +![Trust The Cert](images/cacert-5-set-to-always-trust.png) + +## 6. Reload the webpage. + +![The Results](images/cacert-6-reload-page.png) +