Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Sandbox based on Docker Compose and official nginx, mysql and php #802

Closed
wants to merge 2 commits into from

Conversation

alexanderilyin
Copy link

PREREQUIREMENTS

  1. Composer — It's required by Symfony2.
  2. Docker — It will run containers with preconfigured environments.
  3. Docker Compose — It will link all containers to each other to make things works.
  4. boot2docker — It will run docker if your host system is Mac or Windows.

QUICK START

3 preconfigured containers based on official images. Start in 3 steps.

php composer.phar install
docker-compose up
open http://`boot2docker ip`/config.php

If you prefer access to your site via localhost do the following:

boot2docker ssh -vnNTL 8080:localhost:80 -L 8443:localhost:443
open https://localhost:8443/app_dev.php

@@ -10,3 +10,5 @@
/vendor/
/bin/
/composer.phar
.idea
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these as these are dev specific

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cordoval done.

@hacfi
Copy link

hacfi commented May 1, 2015

@alexanderilyin The code looks good but I think this should be placed in a separate repository. You could create a cookbook in the symfony/symfony-docs repo instead.

@cordoval
Copy link
Contributor

cordoval commented May 1, 2015

does this work with boot2docker?

@hacfi
Copy link

hacfi commented May 1, 2015

@cordoval I think it’s specifically created to work with boot2docker.

@stof
Copy link
Member

stof commented May 1, 2015

I agree with @hacfi here. The vagrant setup has already been rejected from the symfony-standard repo in the past

@cordoval
Copy link
Contributor

cordoval commented May 1, 2015

@alexanderilyin let this not discourage you but work on a repo that has the docker files and share it in this thread, would rock to play with it. This in fact would be a lot faster than vagrant and could even help to the idea of even improve symfony tests to avoid travis instabilities or reproduction tasks.

EDIT: if it is useful and gets the eye who knows they may reconsider or at least showcast it

@alexanderilyin
Copy link
Author

@hacfi possible you're right. I should write small article why it's useful with some cool screenshots like this:

screenshot 2015-05-01 00 03 20

@cordoval It was tested only in boot2docker on OS X but should work in any docker environment. Basically only docker-compose.yml should be included in project. But to make it work there are some configurations for nginx and some customization because of problems with boot2docker and permissions in shared folders.

Some details about used versions:

$ docker --version
Docker version 1.6.0, build 4749651
$ docker-compose --version
docker-compose 1.2.0

@@ -10,3 +10,4 @@
/vendor/
/bin/
/composer.phar
.mysql
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This directory required to survive container restart and keep all data in MySQL.

@cordoval
Copy link
Contributor

cordoval commented May 1, 2015

i wonder if it would be useful at least a link to https://docs.docker.com/compose/ (btw i was using fig for my projects cc @AlexKovalevych) would be useful and why it is more sanctioned than fig if it is?

@alexanderilyin
Copy link
Author

@cordoval answer is on http://www.fig.sh/index.html

Fig has been replaced by Docker Compose, and is now deprecated.
The new documentation is on the Docker website.

P. S.
I'll add details about prerequirements.

@cordoval
Copy link
Contributor

cordoval commented May 1, 2015

oh my bad true, had forgotten indeed, yes that is perfect

@fabpot
Copy link
Member

fabpot commented May 1, 2015

@alexanderilyin Thanks for your contribution. Unfortunately, we do not want to go down this road in this repository. The SE is only about the code you need to bootstrap a new Symfony project... and for any kind of Symfony projects. And your configurations makes some assumptions like a MySQL database or the usage of nginx. It would much better to create a standalone repo or contribute a cookbook for the docs. Thanks.

@fabpot fabpot closed this May 1, 2015
@weaverryan
Copy link
Member

@alexanderilyin I am interested in this kind of thing for the docs however - some unofficial (meaning community) repositories with Vagrant or Docker setups that we can inform people of in the official docs. See symfony/symfony-docs#4676 for an example. I think we're not doing a great service yet since this information is not included, and I'd be eager to discuss fixing that :).

Thanks!

command: php-fpm --allow-to-run-as-root
image: php:5.6.8-fpm
volumes:
- fpm.conf:/usr/local/etc/php-fpm.conf
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexanderilyin I got file exists at /mnt/sda1/var/lib/docker/aufs/mnt/eb13125c1167ab4a391994d402ac8181b13901875d2c1350793452242ca275b2/usr/local/etc/php-fpm.conf, can't create volume there error when docker-compose up. Same to other NGINX config below.

I am using boot2docker, am I missing anything?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexanderilyin FYI if I mount a directory, instead of a file, then it does build.

See docker/compose#424

@mmi-rperez
Copy link

@alexanderilyin is this project death or alive? are you following up?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants