Docker WebSocket Brew Servlet

The WebSocket brew does not currently contain it's own server, so the brew needs a location to publish to. This servlet provides a very basic server to brew to and patronize from.

Run For Development Purposes

The servlet may be run outside of Docker by simply running the server.py file. You must be in an environment with Tornado installed.

Install servlet

pip install pubkeeper.server.websocket

run

pk_websocket_server

Create and Run the Docker Image

Create a Dockerfile with the following:

FROM python:3.5-alpine

RUN apk update
RUN apk add --no-cache --virtual .build_deps gcc linux-headers musl-dev

RUN pip3 install tornado ujson pubkeeper.server.websocket

RUN apk del .build_deps

EXPOSE 8000

WORKDIR /home/ws-server

ENTRYPOINT ["pk_websocket_server"]

Build the image and run the container:

docker image build . --tag ws-server
docker container run ws-server

Gotchas

The container needs to have the exposed port mapped onto the host platform.

Kitematic

Your WebSocket server should now be running on localhost:9555, if not go into Kitematic, click Settings -> Hostname / Ports and set the PUBLISHED IP:PORT to localhost:9555 and click SAVE.

results matching ""

    No results matching ""