Git Product home page Git Product logo

hw16adv's Introduction

How to run application

# run docker composer services
docker-compose up -d
# exec php container
docker-compose exec php bash
# install dependencies inside `php` container
composer install
# run console inside `php` container 
bin/console

How to bind ports

cp docker-compose.override.example.yml docker-compose.override.yml

RabbitMQ Management UI (user: guest, password: guest): http://localhost:15672/

How to change user ID in php docker container

There are a few options

  • add ENVs in .env
DOCKER_COMPOSE__USER_ID=1000
DOCKER_COMPOSE__GROUP_ID=1000
  • export ENVs
export DOCKER_COMPOSE__USER_ID=1000
export DOCKER_COMPOSE__GROUP_ID=1000

You need to rebuild docker images to apply new user ID

# Stop containers
docker-compose down
# Build docker images
docker-compose build

Example how application works

Example #1
student@hillel-php-advanced-2021[docker][/app]: bin/console hillel:task:publish 'Hello, RabbitMQ World!' -vvv
2021-10-16 15:27:02 INFO      [app] Publishing message ...  ["message_body_raw" => "Hello, RabbitMQ World!"]
2021-10-16 15:27:02 INFO      [app] Message was published  ["message_body_raw" => "Hello, RabbitMQ World!"]

student@hillel-php-advanced-2021[docker][/app]: bin/console rabbitmq:consumer task -vvv
2021-10-16 15:27:06 INFO      [app] Received message  ["message_body_raw" => "Hello, RabbitMQ World!"]

Example #2
student@hillel-php-advanced-2021[docker][/app]: bin/console hillel:message-bus:populate -vvv
2021-10-28 21:00:31 INFO      [app] Publishing messages ...
2021-10-28 21:00:31 INFO      [app] Messages were published

student@hillel-php-advanced-2021[docker][/app]: bin/console rabbitmq:consumer logger -vvv
2021-10-28 21:03:29 DEBUG     [app] Received message  ["message_body_raw" => "{"message":"New product was added","context":{"product_id":622}}","routing
_key" => "log.debug"]
2021-10-28 21:03:29 INFO      [app] Received message  ["message_body_raw" => "{"message":"Product was updated","context":{"product_id":771}}","routing_k
ey" => "log.info"]
2021-10-28 21:03:29 ERROR     [app] Received message  ["message_body_raw" => "{"message":"Can not delete brand","context":{"brand_id":584}}","routing_ke
y" => "log.error"]

Tips

  • Setup exchanges/bindings/queues in RabbitMQ
bin/console rabbitmq:setup-fabric

PHPStorm plugins

Useful links

hw16adv's People

Contributors

bilotilvv avatar

Watchers

 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.