How to run RabbitMQ in GitPod

Hello, anybody has an example of how to run RabbitMQ in GitPod for local development?

Hi @marcopeg! Sorry for the late response, but I’m not aware of any RabbitMQ-in-Gitpod example.

But I would expect RabbitMQ’s local installation instructions to work equally well in Gitpod, e.g. by doing something similar to Gitpod’s official PostgreSQL Docker image.

Have you tried installing RabbitMQ in Gitpod? Were there any bugs?

Maybe a .gitpod.Dockerfile like this could work (untested):

FROM gitpod/workspace-full

RUN mkdir /tmp/rabbitmq \
    && cd /tmp/rabbitmq \
    && wget -qO rabbitmq-server.deb https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.5/rabbitmq-server_3.8.5-1_all.deb \
    && sudo dpkg -i rabbitmq-server.deb \
    && rm -rf /tmp/rabbitmq

Thank you Jan, I’m giving it a go.

Locally, I’ve always ran Rabbit as docker container. I’m not good at Linux and Docker comes in handy for such things.

I read that docker-in-docker support is coming to GitPod… As a user, there are only 2 major blockers that prevent me from moving everything to GitPod:

  1. I need to run docker-compose projects
  2. I need to share an NPM identity or DockerHUB between workspaces in order to push

Hello, I tried but it doesn’t quite work :frowning:.

ERROR: rabbitmq-server depends on erlang-base

Too bad, it would be quite interesting to have Rabbit packaged with a workspace so to have a self contained environment to develop and test an event driven app!

@marcopeg @jan I’ve wrapped up the solution to run RabbitMQ on GitPod service:
https://github.com/nemke82/rabbitmqgitpod, also updated my Magento 2 repo to support it as well with the latest version. Hope this helps. Cheers.

1 Like

Support for docker-compose in Gitpod should be coming soon (currently being implemented in Gitpod, so barring any unforeseen blockers this should get released relatively soon).

@marcopeg Maybe you’ve figured this out already, but if you can store these identities in secret/uncommitted configuration files, you can do something like this:

  1. Set up a NPM or Docker Hub token as a personal Gitpod environment variable in https://gitpod.io/settings/ (e.g. called NPM_TOKEN)

  2. Add an init command to your projects’s .gitpod.yml that looks a bit like this:

tasks:
  - init: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc

(Note: Never commit the resulting .npmrc, and even better move it under $HOME or ignore from Git by adding it to .gitignore.)

@nemke82 Wow, that’s awesome! Many thanks for putting this together. :100:

If I may make a few suggestions:

  • I’m not sure what to do with all these exposed ports. Maybe you could add onOpen: ignore to the ports that can safely be ignored by the user (i.e. no need to make an IDE notification about the port being open), or onOpen: open-preview for any web ports that should get opened in a preview

  • As someone who has never used RabbitMQ, how can I test the RabbitMQ server that’s running? (E.g. is there a client command I could run, something like a CLI? If so, it could be cool to automatically run that via a command)

  • You could also add explicit names to each terminal defined in your .gitpod.yml, e.g. like so:

tasks:
  - name: "RabbitMQ Server"
    command: /opt/rabbitmq/sbin/rabbitmq-server
  - name: "RabbitMQ Client"
    command: rabbitmq-plugins enable rabbitmq_management

@nemke82 , I tried to install rabbitmq by following your repo, but this line failed for me → rabbitmqgitpod/.gitpod.Dockerfile at main · nemke82/rabbitmqgitpod · GitHub , any ideas or some alternatives? cc: @jan

:thinking:I tried running @nemke82’s example and it worked! Can you try again?

Yeah, tested from here. Interesting… Are you running that from Self-Hosted Gitpod?

Hey, nice to meet you @Pauline

@ufuksak try my other repo designed for PHP/Magento 2 which is having RabbitMQ as well installed:

@nemke82 , @Pauline , thank you for your quick responses. I will try another repo too…

I was able to use docker-compose in a GitPod hosted workspace. You should be able to run RabbitMQ in Docker now.

1 Like