This docker compose environment can be used for development.
To improve performance on MacOS and Windows you can optionally use Docker Sync (https://github.com/EugenMayer/docker-sync/).
It will install these services:
- mariadb
- mailserver based on dovecot and postfix
- groupoffice apache web server with php 7.0 with ioncube and xdebug running on port 80
- phpunit for testing
- PhpMyAdmin running on port 8001. (see below on how to make phpmyadmin settings persist)
- Webgrind for performance tuning runs on port 8002.
- PHP composer container to run composer commands
- sass container that will watch and compile sass files for you.
-
Make sure docker and docker-compose are installed.
-
Clone this repository:
git clone --recurse-submodules https://github.com/Intermesh/groupoffice-docker-development.git
-
Go into src/* dfirectories and checkout the branches:
cd groupoffice-docker-development/src/master` git checkout master git pull
-
Run php composer install once:
docker-compose run -w /src/master/www --rm composer install --ignore-platform-reqs
-
Run the stack:
docker-compose up -d
-
Visit PHPMyAdmin at http://localhost:8001 and create the database "groupoffice". (Default password for root is 'groupoffice')
-
Install Group-Office by going to http://localhost/install/. Note you should not see a page where you enter database connection details. If you see this something is wrong with the database container.
-
Configure a cron job on the host machine so that Group Office can run scheduled tasks. On Linux create a file /etc/cron.d/groupoffice and add:
* * * * * root docker exec --user www-data go_web php /usr/local/share/groupoffice/cron.php
On MacOS I ran on the terminal:
crontab -e
And added:
* * * * * /usr/local/bin/docker exec --user www-data go_web php /usr/local/share/groupoffice/cron.php
-
All done. Happy coding!
WARNING: This will destroy and recreate database called "groupoffice_phpunit".
docker-compose exec groupoffice ./www/vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml tests
You can create a profile by setting the GET parameter XDEBUG_PROFILE=1
.
Also see the xdebug docs for more options.
Xdebug is ready to run. You just need to setup path mappings. Map your local folder "$YOUR_INSTALL_PATH/docker-groupoffice-development/src/master" to "/usr/local/share/src" in the Docker container to tell your IDE that's where the source files are on the server.
For PHPStorm debugging on the command line make sure you set mappings for "localhost" at Settings -> Languages & Frameworks -> PHP -> Servers. Because we set the 'PHP_IDE_CONFIG' environment vairable to "localhost" in docker-compose.yml.
See also: https://www.jetbrains.com/help/phpstorm/zero-configuration-debugging-cli.html#6e577196
If you'd like to open a shell inside the container then you can run:
docker exec -it --user root groupoffice bash
PhpMyAdmin runs on localhost:8001 by default. But it has no place to store it's settings yet. You can fix that by running:
# in host (login to the correct docker container)
docker exec -it --user root go_phpmyadmin sh
# in container
apt-get update # update the package database
apt-get install mariadb-client # get a mysql client for running sql
mysql -u root -pgroupoffice -h db < sql/create_tables.sql # create the database
exit
Now recreate the containers on the host:
docker-compose down
docker-compose up -d
Check the main settings page and the warning message should be gone and the settings will persist.
Checkout new source in the "src" directory
cd src
git clone -b 6.3.x https://github.com/Intermesh/groupoffice.git 63
Run composer for the branch:
docker-compose run -w /root/src/63/www --rm composer install --no-dev --ignore-platform-reqs
See dockerfile for example: Duplicate the go_web container and the go_data and go_etc volumes Change the database to groupoffice_63