Code Monkey home page Code Monkey logo

docker's Introduction

Docker containers VS. Bash scripting

In this docker-compose project contains such containers as:

  • nginx:latest
  • MySQL
  • PHP 7.3
  • PhpMyAdmin
  • Mailcatcher
  • Elasticsearch
  • RabbitMQ
  • Redis

Overview

Repository provides two docker-compose files. One for development environment and one for production. In the root of repository located vca.bash script which allow to control docker containers such as: start, build, down and some actions inside them as composer update/install, etc.

Nginx config is located at Nginx directory and Nginx's log files there too in directory logs.

php.ini file is located under php-fpm directory. Also it's available to modify PHP container's Dockerfile.

Navigations

  • Content
    • Installation
    • One ring for rule... | One script for control...
    • PHPUnit
    • Control status of Docker-compose containers
    • It's bigger inside than outside | Inside container
    • Composer
  • Plan of improvements
  • Authors

Content

Installation

  1. First go to the root folder of project which you'll be dockerized
  2. Open terminal there and run command:
vasyltarasov@Vasyls-MBP ~ % git clone [email protected]:etvsyaka/docker.git
Cloning into 'docker'...
........................

vasyltarasov@Vasyls-MBP ~ % cd docker/

vasyltarasov@Vasyls-MBP ~ % ./bin/containers.bash build
vasyltarasov@Vasyls-MBP ~ % ./bin/containers.bash start
vasyltarasov@Vasyls-MBP ~ % ./bin/containers.bash bash
  1. After containers was builded and runed we need to edit /etc/hosts file
sudo vim /etc/hosts

# Add after first lines this:

127.0.0.1						symfony.loc, www.symfony.loc
  1. Now you can access your app via address http://symfony.loc/
  2. PhpMyAdmin locates at http://localhost:801
  3. Default settings is:
ServerAddress: symfony.loc/


MySQL Root User: 'root'
MySQL Root Password: 'symfony'

RabbitMQ User: 'rabbitmq'
RabbitMQ User Password: 'rabbitmq_password'

One ring for rule... | One script for control...

Run vca.bash without any parameters. Actually it's quite useless example because in this case script will do nothing.

//you're in root of your repository
vasyltarasov@Vasyls-MBP toplist% cd docker/
./bin/containers.bash

Control status of Docker-compose containers

Script provides basic commands to control containers status.

# Run all containers
vasyltarasov@Vasyls-MBP toplist % ./bin/containers.bash start

# Stop all continaers
vasyltarasov@Vasyls-MBP toplist % ./bin/containers.bash stop

# Restart all containers
vasyltarasov@Vasyls-MBP toplist % ./bin/containers.bash restart

# Build containers 
vasyltarasov@Vasyls-MBP toplist % ./bin/containers.bash build 

# Containers status 
vasyltarasov@Vasyls-MBP toplist % ./bin/containers.bash status

PHPUnit

PHP Unit tests must run from container so it's possible to do by these commands.

# It will run tests without coverage
vasyltarasov@Vasyls-MBP toplist % ./bin/containers.bash test

# It's possible to set second paramter to run tests with coverage
vasyltarasov@Vasyls-MBP toplist % ./bin/containers.bash test coverage

It's bigger inside than outside | Inside container

If you need to go inside container with PHP to change something or just to take a look you'll need to run this command.

vasyltarasov@Vasyls-MBP toplist % ./bin/containers.bash ssh
# ... after it you'll get inside container as root user

Also inside container exists alias for bin/console

# It's the same commands
php bin/console
# It's the same commands
symfony

Composer

It's available to run some Composer commands via the script.

# It will run composer.phar and install all dependecies
vasyltarasov@Vasyls-MBP toplist % composer-install 

# It will update the information about packages and update packages if it possible
vasyltarasov@Vasyls-MBP toplist % composer-update

# It allow to install package with name {packageName}
vasyltarasov@Vasyls-MBP toplist % composer-require {packageName}

Plan of improvements

Author

Say thanks and your ideas to:

Vasyl Tarasov [email protected] Telegram: @mage_f1

docker's People

Contributors

etvsyaka avatar

Stargazers

 avatar  avatar

Forkers

avyrobot

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.