We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Docker Phalcon Beanstalkd worker

I'm wondering if somebody already experimented with a docker container that watches a beanstalkd using phalcon and execute some work and is willing to share some code. Thinking about creating a container that I can easily scale when needed but would love to get some ideas how to setup this image.



12.1k
edited Oct '17

Yes I do. For docker I used two containers, once for beanstalkd the other one for the console. This are the images I've used in my docker-compose:

queue:
restart: always
image: phalconphp/beanstalkd:1.10
container_name: beanstalk
ports:

  • "11300:11300"
    volumes:
  • beanstalk:/var/lib/beanstalkd

    beanstalk_console:
    restart: always
    image: agaveapi/beanstalkd-console
    container_name: beanstalk_console
    ports:

  • "5556:80"
    depends_on:
  • queue
    env_file:
  • variables.env

For beanstalk inside phalcon I've written a module, using cli interface for executing the queue workers and integrating the Incubator beanstalk extension.

Sadly, beanstalkd is deprecated project. So I hesitate to use it in a production (new projects) like I used to... still it is very neat MQ broker.



12.1k
edited Oct '17

AWS is still proposing beanstalk and it is still working well. What do you suggest for replacing it? I think at the moment, even for new projects, beanstalk remain the best solution for integrating queues in phalcon, but we can start watching and working on wrappers for other systems..

I think we should implement in incubator or in core at least 2 other queues mostly used - redis and rabbit mq.

Rabbit MQ to start with. Any MQ solution which is current - and supported.

AWS is still proposing beanstalk and it is still working well. What do you suggest for replacing it? I think at the moment, even for new projects, beanstalk remain the best solution for integrating queues in phalcon, but we can start watching and working on wrappers for other systems..



12.1k

@ruudboon How have you structured logging with queues? I think logs are one of the most critical part when using asyncronous queues and they are the weak part of my implementation.



10.1k
edited Nov '17

@cosimo I outputting to the stdout that can easily read by docker. At this point I use beanstalk to easily offload heavy work (Generate PDF's). I write the final status (succes/failed etc) in the database. And thnx for the docker code!