Example
sandboxproject:
image: avatarnewyork/dockerenv-apache:php53
volumes:
- /var/www/sandboxproject/public:/var/www/html
ports:
- "80"
links:
- db # Link any external containers, like your database
environment:
POSTFIX_HOSTNAME: dev_host
POSTFIX_USER: [email protected]
POSTFIX_PWD: somesecretpassword
XDEBUG_CLIENT_IP: 10.2.0.51
- For a list of supported PHP versions, go here: https://registry.hub.docker.com/u/avatarnewyork/dockerenv-apache/tags/manage/
- Anything appended with "beta" should be considered unstable and is bleeding edge
Ask your admin for these (different for staging / dev environments)
POSTFIX_HOSTNAME: [hostname]
POSTFIX_USER: [user]
POSTFIX_PWD: [password]
You can check the status of the mail that was sent using loggly. Search for the respective environment and include appropriate date/times:
- mailgun stage.avatarnewyork.com
- mailgun dev.avatarnewyork.com
In your docker [PROJECTNAME].yml file that you created for your project make sure you have the: XDEBUG_CLIENT_IP: 10.2.0.51 <= replace with your desktop IP
Setup XDEBUG on PHPStorm for a Symfony2/Drupal project:
- Click Run from the navigation bar and select Edit Configurations
- In the Run/Debug Configurations window that opens click + and select PHP Web Application
- Name the application [projectnameDEV]
Next we need to configure a server.
- Under configuration (same window) next to server, click ...
- On the Servers window that opens click +
- Name your server [projectnameDEV]
- under host write [PROJECT_NAME].dev.avatarnewyork.com
- Check that port is 80 and Debugger is Xdebug
Now we need to configure path mappings for our remote server configuration. 6. Check the Use path mappings checkbox 7. For Symfony2 only, you need to map 2 different directories; Drupal projects require only that the web root directory is mapped:
- Main project root => /var/www
- web root => /var/www/html
- Click apply, OK to save and close the Servers Configurations window
- Click apply, OK to save and close the Run/Debug Configurations
- Verify that everything works.
- Create a breakpoint and click the little bug in the toolbar (only executable statements can have breakpoints).
- A new browser window opens with ?XDEBUG_SESSION_START=11349 in the url
- In PHPStorm the debugging engine is activated and a new console/debugger tool opens
For more information refer to the PHPStorm docs on debugging: https://www.jetbrains.com/phpstorm/help/debugging-with-a-php-web-application-debug-configuration.html
phpunit is a dockerenv wrapper to phprun - You can run phpunit tests by using the dockerenv phpunit
wrapper command as follows:
phpunit [-hv] [-t <latest|php55beta|php53|php53beta|php51>] <PROJECT> [FILES]
- -t be sure to always include this unless you are using the latest tag default
- is your project name
- the test file(s) you want to run
class TestLogin extends PHPUnit_Extensions_Selenium2TestCase {
public function setUp(){
// Selenium Host - always dev server ip or hostname
$this->setHost('10.2.0.10');
// Selenium Port - this is static and is running in privleged mode (will always be 4444)
$this->setPort(4444);
// Selenium Browser - *currently only supporting chrome
$this->setBrowser('chrome');
// Selenium Test URL - this will be your dev URL - we should come up with a way to make this dynamic
$this->setBrowserUrl('http://patsandbox.dev.avatarnewyork.com');
}
See: https://github.com/avatarnewyork/dockerenv_apache/wiki/phpunit_selenium_example
phprun
(composer, etc) available in :latest, php53 - see dockerenv documentationdrush
available in :latest, php53 - see dockerenv documentationphpunit
available in :latest, php53 - see dockerenv documentation
The container logs provide the following:
- system logs
- apache access logs
- apache error logs
- php error logs
In order to veiw logs run:
docker logs [PROJETNAME]_[PROJECTNAME]_1
example:
docker logs patmohawkconnects_patmohawkconnects_1
Name | :latest (php55) | :php53 | notes |
---|---|---|---|
nodejs less | x | x | #6 |
composer | x | x | home is /.composer - https://getcomposer.org/ |
grunt js | x | x | http://gruntjs.com/ |
wp-cli | x | x | http://wp-cli.org/ |
xdebug | x | x | #8 |
x | x | Set environment variables above. See #10 | |
oauth | x | x | http://php.net/manual/en/book.oauth.php |
ssh2 | x | x | http://php.net/manual/en/book.ssh2.php |