Skip to content
Docker environment for Symfony2/OroCRM/OroBAP/Vue.js development on Windows platform
Dockerfile Shell Batchfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
backend
docker
frontend
.gitignore
LICENSE.md
README.md
docker-compose.yml

README.md

Docker environment for Symfony2/OroCRM/OroBAP/Vue.js development on Windows platform

Docker containers configuration for Symfony2/OroCRM/OroBAP development on Windows platform.

Update: Now works with linux hosts, checkout linux branch

Also it can be used for separated backend and frontend applications (see Vue.js example in Step by step manual)

This repo is under MIT license. Feel free to do with it whatever you want.

Contents

Containers:

  • nginx (latest nginx, configured to run app in dev mode)
  • app (inside: php7.1-fpm/php7.0-fpm/php5.6-fpm, see stepansib/php-js-symfony-oro for more details)
  • mysql (5.6, hostname: "mysqldb", root password: "qazwsxedc", database: "app", user: "app", user password: "qazwsxedc")
  • rabbitmq (latest, hostname:"rabbitmq", access management UI via http://localhost:15672, user: "app", passowrd: "qazwsxedc", turned off by default)
  • elk (ELK stack container, Kibana available at http://localhost:82, turned off by default)
  • selenium (for acceptance tests)
  • data (syncs application between containers)

Also there are several batch scripts (see full list) to simplify docker manipulations with these containers

Installation and usage

Symfony (backend) application should be stored in "backend" folder. This is shared folder that mounts to /var/www/backend directory in "data" container. This directory (and /var/www/frontend frontend directory) also shared with "app" and "nginx" containers.

Step by step manual:

Backend app

  1. Install Docker for Windows and share the local disk where your project will be located in Docker setings
  2. Clone this repo
  3. Place your application in backend folder (via git clone for example)
  4. Run docker\start to build and run containers
  5. Run bash in "php" container by executing docker\bash command
  6. cd to /var/www/backend directory
  7. Install all the dependencies via Composer
  8. Provide database and other parameters using your favourite IDE on host machine
  9. Open your browser and go to http://localhost to access backend app

Passing SSH key to application container

If you want to pass your private SSH key to app container feel free to replace env variable SSH_PRIVATE_KEY in docker-compose.yml

Frontend Vue.js app

  1. Place your application in frontend folder
  2. Edit webpack config and specify the app host
module.exports = {
  ...
  devServer: {
    historyApiFallback: true,
    noInfo: true,
    host: "app",
    port: 8080
  },
  ...
}
  1. Run docker\start to build and run containers
  2. Run bash in "php" container by executing docker\bash command
  3. cd to /var/www/frontend directory
  4. Install all the dependencies (npm install for example)
  5. If you use Vue.js webpack project modify following lines to enable hot reloading:
// frontend/build/dev-server.js

var devMiddleware = require('webpack-dev-middleware')(compiler, {
    publicPath: webpackConfig.output.publicPath,
    quiet: false,
    watchOptions: {
        aggregateTimeout: 300,
        poll: 1000,
        ignored: /node_modules/
    }
})

See this article for explanation 8. Run npm run dev 9. Open your browser and go to http://localhost:81 to access frontend app

Important

Following directories excluded from sync to speed up Symfony application in container and prevent permission issues:

  • app/cache
  • app/logs
  • vendor
  • bin
  • node_modules

So feel free to empty these dirs on your host machine.

They are excluded via new shared volume for each of them (see docker-compose.yml), so these dirs cannot be move/removed/overwritten inside the containers.

If you need the "vendor" dir on your host machine (for development) - you can compress it to "shared" folder via tar -zcf cache_vendor.tar.gz -C /var/www/backend/ app/cache vendor and then extract synced "vendor.tar.gz" dir to "app/vendor" directory

Scripts to control docker

You can use these scripts instead of standard docker commands, just for simplicity:

  • docker\start (or bash docker/start for linux hosts) - run (and build if not built yet) containers
  • docker\bash - run bash in php container
  • docker\stop - stop all containers
  • docker\restart - restart all containers
  • docker\update - update and run containers
  • docker\build - build/rebuild and run containers (even already running)

Tips and useful PhpStorm plugins

Here are some tips from me to bring more fun to development process

PhpStorm plugins

ConEmu shortcut

"C:\Program Files\ConEmu\ConEmu64.exe" -Max -Monitor 2 -runlist {Shells::cmd} & docker stats ||| {Shells::cmd} -new_console:d:"c:\projects\app":s75V

This shortcut will run ConEmu on second monitor with two vertically splitted consoles. Upper console will display docker stats for running containers, lower one will run cmd in specified folder as usual. Just provide the correct path to ConEmu and workdir

You can’t perform that action at this time.