Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Laradock support for connecting Laravel to Centrifugo, Seq, Mule ESB #2756

Open
alexc-hollywood opened this issue Oct 26, 2020 · 0 comments

Comments

@alexc-hollywood
Copy link

alexc-hollywood commented Oct 26, 2020

Been loving Laradock so far, but a lot of custom software i've been working with isn't included out of the box. And it's been tough to get it going. Wanted to include 3 snippets which have made my life a lot easier and been put together after a fair bit of pain googling away for hours.

Centrifugo

Centrifugo (https://centrifugal.github.io/centrifugo/) is a drop-in replacement for Pusher which is a great Websockets server with JWT authentication API and web backend. Similar to Crossbar, but easier to use (IMO).

Works well with https://packagist.org/packages/luisozparr/centrifuge-broadcaster .

Insert into docker-compose.yml:

# https://centrifugal.github.io/centrifugo/server/configuration/#configuration-ways
    centrifugo:
      container_name: centrifugo
      image: centrifugo/centrifugo:latest
      restart: always
      environment:
        - CENTRIFUGO_ADDRESS=0.0.0.0
        - CENTRIFUGO_ENGINE=memory
        - CENTRIFUGO_ADMIN=true
        - CENTRIFUGO_TOKEN_HMAC_SECRET_KEY=secret
        - CENTRIFUGO_ADMIN_PASSWORD=password
        - CENTRIFUGO_ADMIN_SECRET=secret
        - CENTRIFUGO_API_KEY=centrifugo_api_client
        - CENTRIFUGO_V3_USE_OFFSET=true
        - CENTRIFUGO_LOG_LEVEL=debug
        - CENTRIFUGO_CLIENT_CHANNEL_LIMIT=128
        - CENTRIFUGO_CHANNEL_MAX_LENGTH=255
        - CENTRIFUGO_CLIENT_REQUEST_MAX_SIZE=65536
        - CENTRIFUGO_CLIENT_QUEUE_MAX_SIZE=10485760
        - CENTRIFUGO_CLIENT_ANONYMOUS=FALSE
        - CENTRIFUGO_SOCKJS_HEARTBEAT_DELAY=25
        - CENTRIFUGO_WEBSOCKET_COMPRESSION=FALSE
        - CENTRIFUGO_GOMAXPROCS=0
        - CENTRIFUGO_WEBSOCKET_HANDLER_PREFIX="/connection/websocket"
        - CENTRIFUGO_SOCKJS_HANDLER_PREFIX="/connection/sockjs"
        - CENTRIFUGO_API_HANDLER_PREFIX="/api"
        - CENTRIFUGO_PROMETHEUS_HANDLER_PREFIX="/metrics"
        - CENTRIFUGO_HEALTH_HANDLER_PREFIX="/health"
      ports:
        - "8000:8000"
      command: centrifugo --admin --health
      networks:
        - frontend
        - backend

Note: the backend admin UI is at http://localhost:8000.

Seq

Seq (https://datalust.co/seq) is a Graylog alternative for monitoring debug and app output which is typically focused around .Net, Node, and others. It has its own HTTP API which can be used, but supports Graylog Extended format (GELF). GELF is also suppported by Monolog.

The (additional) GELF intermediary/middleman server (or plugin app) runs over TCP/UDP/HTTP on port 12201 and forwards messages to Seq on port 5341. See: https://github.com/datalust/sqelf.

Works well with https://github.com/hedii/laravel-gelf-logger.

Insert into docker-compose.yml:

    seq-input-gelf:
      image: datalust/seq-input-gelf:latest
      depends_on:
        - seq
      environment:
        GELF_ADDRESS: "tcp://0.0.0.0:12201" #0.0.0.0:12201/udp
        SEQ_ADDRESS: "http://seq:5341"
        GELF_ENABLE_DIAGNOSTICS: "True"
      ports:
        - "12201:12201"
      restart: unless-stopped
      networks:
        - backend

    seq:
      container_name: seq
      image: datalust/seq:latest
      restart: unless-stopped
      environment:
        - ACCEPT_EULA=y
      ports:
        - "9595:80"
        - "5341:5341"
      networks:
        - backend

Note: the web UI for Seq is at http://localhost:9595 but you can set it however you like. For use in Laradock, the hosts need to be seq and seq-input-gelf and NOT localhost.

Mule ESB

Mule ESB / Anypoint Platform (https://www.mulesoft.com/platform/api-design) is a lightweight Enterprise Service Bus (ESB) written in Java which brings all the APIs you use together into one single point of contact, as well as allowing you to talk to other platforms and endpoints.

How you set it up - HTTP, AMQP, CSV etc - is up to you.

Insert into docker-compose.yml:

    mule-esb:
      container_name: mule-esb
      image: javastreets/mule:lateste
      restart: unless-stopped
      environment:
        - TIMEZONE=America/Los_Angeles
        - MULE_ESB_NAME=My-ESB-Server-01
        - APP_CONFIG_PATH=
        - MULE_STARTUP_ENV_CONFIG=
        - MULE_ENV_OVERRIDE_DEFAULT=0
        - MULE_ARM_TOKEN=
        - MULE_MMC_AGENT_PORT=7777
        - MULE_MMC_URL=http://my-server.example.com/mmc-console
        - MULE_MMC_USERNAME=admin
        - MULE_MMC_PASSWORD=admin
        - MULE_MMC_AGENT_HOST=123.455.234.110
        - MULE_MMC_HEADER_AUTH=
        - MULE_MMC_SERVER_GROUP=
        - CUSTOM_SCRIPT=
      ports:
        - "8081:8081"
      networks:
        - frontend
        - backend
@alexc-hollywood alexc-hollywood changed the title Adding Laradock support for Centrifugo, Seq, Mule ESB Adding Laradock support for connecting Laravel to Centrifugo, Seq, Mule ESB Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant