Skeleton Service
This project is intented to be a skeleton for PHP based services., (*1)
, (*2)
Getting started
$ docker build -t crakmedia/skeleton-service:latest .
$ cp docker-compose.yml.dist docker-compose.yml
$ docker-compose run shell
$ composer install
$ docker-compose up
Overriding default settings
Should over need to override the default configuratio for any of the services
runing within the container, you can add docker volumes to your docker-compose.yml.
As an example, say you need to modify the default nginx configuration provided by
the base image. In this case you just need to add a new voluming mapping under the
volumes section in your docker-compose.yml file:, (*3)
volumes:
... existing mappings ...
- /path/to/nginx.conf:/etc/nginx/nginx.conf
The following is a list of files/directories added in the base image, which could be
overriden:, (*4)
- /etc/nginx/conf.d
- /etc/nginx/nginx.conf
- /etc/php.ini
- /etc/php-fpm.conf
- /etc/php-fpm.d
Of course you can always use docker volumes to override any file/directory within a running
container. See here for more details., (*5)
Migrations
Run migrations, (*6)
$ docker-compose run shell
$ php app/console migrations:migrate
Tests
First, go in your container shell, (*7)
$ docker-compose run shell
Copy tests/config.yml.dist
to tests/config.yml
and configure your test database, (*8)
$ cp tests/config.yml.dist tests/config.yml
Functional tests, (*9)
$ bin/behat
Generate doc
Install apidoc, (*10)
$ npm install apidoc -g
Generate doc, (*11)
$ apidoc -i src/Controller/ -o doc
Launch doc/index.html
with your browser., (*12)
Monitor your metrics
In order to monitor metrics of application, you should use $app['monitor']. For more information about how to use, see
documentation of the client, (*13)