Giter Site home page Giter Site logo

docker-symfony's Introduction

docker-symfony

Build Status

This is a simple To-do list application with GUI and REST API written in Symfony, running on multiple Docker containers. Docker Compose is used for orchestration.

Previous versions

  • If you are looking for products example rather than to-do list, check the products tag.
  • If you are looking for a multiple containers example with Apache, check the apache tag.
  • If you are looking for a single container example with supervisor and Vagrant, check the single-container tag.

Multiple containers

This environment uses 3 containers:

  1. The php container with PHP-FPM, being build from Dockerfile. It's based on sskorc/symfony2-mongo image. You can find its Dockerfile in this repo. This container shares the application sources with the host machine.
  2. The nginx container with nginx, pulled directly from the official nginx image on Docker Hub. This container shares the application sources with the host machine.
  3. The db container with MongoDB, pulled directly from the official MongoDB image on Docker Hub. This container shares DB data with the Docker Machine VM.

Containers are managed by Docker Compose. The configuration is in the docker-compose.yml.

Requirements

Basically, you need to have Docker Compose installed.

If you use Mac OS X or Windows as your host OS, I recommend using Docker Machine as the proxy VM to run Docker.

How to use it?

Start the environment

In the project root directory run the following command:

docker-compose up -d

This command will build the php Docker image and run its container together with nginx and db containers.

Prepare the environment

  1. Log in to the php container by running the following command:

    docker exec -it dockersymfony_php_1 bash
    
  2. Install dependencies by running the following command:

    cd /var/www/docker-symfony && composer install -n
    
  3. Change /tmp dir permissions:

    chown -R www-data:www-data /tmp
    

Update your hosts

Mac OS X

  1. Check Docker Machine IP address: docker-machine ip dev.

  2. Assuming it's 192.168.99.100, add the following line to your /etc/hosts file:

    192.168.99.100 docker-symfony.dev
    

Linux

TBA

Windows

  1. Check Docker Machine IP address: docker-machine ip dev.

  2. Assuming it's 192.168.99.100, add the following line to your %SystemRoot%\System32\drivers\etc\hosts file:

    192.168.99.100 docker-symfony.dev
    

Test the application

Web

You can test the application by following http://docker-symfony.dev/ URL in your browser.

REST API

  • You can test the REST API by sending the POST request with the name parameter to http://docker-symfony.dev/api/tasks. Example:

    curl -w "\n" -H "Content-Type: application/json" -X POST -d '{"name":"Hello!"}' http://docker-symfony.dev/api/tasks
    
  • You can get all products by sending the GET request to http://docker-symfony.dev/api/tasks. Example:

    curl -w "\n" -X GET http://docker-symfony.dev/api/tasks
    

Debugging

This application is ready to be debugged by Xdebug. If you want to configure your host and PHPStorm to debug this app, please follow the instruction.

Continuous Delivery

The application is being build on Travis CI and it's being deployed to Docker Cloud.

docker-symfony's People

Contributors

diogogomes77 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.