As you may know, we have started to create the Hawkular-Services distribution, which we try to build weekly. This distribution comes without embedded Cassandra, with no default user and also without a UI (we plan on re-adding a basic UI).
But you must not fear.
Running Hawkular-services is pretty easy via Docker.
Let me start with a drawing of what I want to do here:
Setup of Hawkular-services via Docker
In this scenario I run a Docker daemon (which is extremely easy these days on a Mac thanks to DockerForMac (Beta)). On the daemon I run a Hawkular-services container, which talks to a Cassandra container over the Docker-internal network. On top of that I have two WildFly10 containers running ("HawkFly"), which have been instrumented with the Hawkular-agent.
For the purpose to setup linking and data volumes I am using docker-compose. The following is the docker-compose.yml file used (for the moment all images are on my personal account):
# set up the wildfly with embedded hawkular-agent hawkfly: image: "pilhuhn/hawkfly:latest" ports: - "8081:8080" links: - hawkular # The hawkular-server hawkular: image: "pilhuhn/hawkular-services:latest" ports: - "8080:8080" - "8443:8443" - "9990:9990" volumes: - /tmp/opt/data:/opt/data links: - myCassandra environment: - HAWKULAR_BACKEND=remote - CASSANDRA_NODES=myCassandra # The used Cassandra container myCassandra: image: cassandra:3.7 environment: - CASSANDRA_START_RPC=true volumes: - /tmp/opt/data:/opt/data
To get started save the file as
docker-compose.yml and then run:
$ docker-compose up hawkularThis starts first the Cassandra container and then the Hawkular one. If they do not yet exist on the system, they are pulled from DockerHub.
After Hawkular has started you can also start the HawkFly:
$ docker-compose up hawkfly
Right now if you would directly do
docker-compose up hawkfly the agent would not work as the hawkular server is not yet up and the agent would just stop. We will add some re-try logic to the agent pretty soon.
I have pushed a new version 0.19.2 of HawkFly that has the retry mechanism. Now it is possible to get the full combo going by only running
$ docker-compose up hawkfly
Running without docker-compose
On my RHEL 7 box, there is Docker support, but no docker-compose available. Luckily docker-compose is more or less a wrapper around individual docker commands. The following would be a sequence that gets me going (you have to be root to do this):
mkdir -p /var/run/hawkular/cassandra mkdir -p /var/run/hawkular/hawkular chcon -Rt svirt_sandbox_file_t /var/run/hawkular docker run --detach --name myCassandra -e CASSANDRA_START_RPC=true \ -v /var/run/hawkular/cassandra:/var/lib/cassandra cassandra:3.7 sleep 10 docker run --detach -v /var/run/hawkular/hawkular:/opt/data \ -e HAWKULAR_BACKEND=remote -e CASSANDRA_NODES=myCassandra \ -p 8080:8080 -p 8443:8443 --link myCassandra:myCassandra \ pilhuhn/hawkular-services:latest
There is an open Pull-Request to the Hawkular-Services Docker build as a part of a release and make it available via DockerHub on the official Hawkular account.
With this PR you can do
$ mvn install $ cd docker-dist $ mvn docker:build docker:start
to get your own container built and run together with the C* one.
Right now I put in the default user/password and if the agent inside the hawkular-container should be enabled at image build time. Going forward we need to find a way to pass those at the time of the first start. The same applies (probably even more) to SSL-Certificates.
Storing them inside the container itself does not work going forward, as this way they are lost when a newer version of the image is pulled and a new container is constructed from the newer image.