docker run \ -d \ --restart always -p 54377:54377 \ # Nucleus (required) -p 8080:8080 \ # HTTP server -p 1883:1883 \ # MQTT server -p 8085:8085 \ # TCP server -p 8086:8086 \ # UDP server -p 8088:8088 \ # WebSockets server -v /mnt/docker/data/corrade/:/etc/corrade \ wizardrysteamworks/corrade:latest
where:
/mnt/docker/data/corrade/
is a host / local filesystem path where configuration files will be stored,
Corrade run within a docker container using our official image on DockerHUB. The usage pattern is typical to running Corrade from the command line: the container is started, the user connects to the Nucleus port 54377
to configure Corrade, and then Corrade logs in to the grid.
The configuration files NucleusConfiguration.xml
, CorradeConfiguration.xml
and Log4Net.config
are exported to the local path given by the volume mount (in the TL;DR section, that is /mnt/docker/data/corrade/
).
Here is the Docker compose file that does the same but using docker-compose and it should also be compatible with docker swarm:
version: "3.7" services: corrade: image: wizardrysteamworks/corrade:latest ports: - "54377:54377" # Nucleus (required) - "8080:8080" # HTTP server - "1883:1883" # MQTT server - "8085:8085" # TCP - "8086:8086" # UDP - "8088:8088" # Websockets server volumes: - /mnt/docker/data/corrade/:/corrade/
The build system is based on Debian bullseye and here is a tree view of the filesystem layout of the build system:
. ├── Dockerfile └── rootfs └── usr └── local └── bin └── run 5 directories, 2 files
Here is the Dockerfile
that is placed at the root of the build system:
# for libssl compatiblity required for .net 5.0 FROM debian:bullseye-slim # update package manager RUN apt-get update -y && \ apt-get upgrade -y && \ apt-get dist-upgrade -y && \ apt-get -y autoremove && \ apt-get clean # unzip required for unpacking Corrade and all the rest are libraries RUN apt-get install -y \ coreutils \ bash \ unzip \ libgssapi-krb5-2 \ libssl1.1 \ libicu67 # retrieve latest Corrade ADD https://corrade.grimore.org/download/corrade/linux-x64/Corrade-12.0.383.399-linux-x64.zip /tmp/Corrade.zip # unpack the latest Corrade WORKDIR /tmp RUN unzip /tmp/Corrade.zip -d /corrade # open port declaration, in order: Nucleus, HTTP, MQTT, TCP, UDP and WebSockets EXPOSE 54377 8080 1883 8085 8086 8088 # add filesystem requirements ADD rootfs / # execute the bootstrapper that will start Corrade RUN ["chmod", "+x", "/usr/local/bin/run"] ENTRYPOINT ["/usr/local/bin/run"]
Next to the Dockerfile
file there should be a directory created named rootfs
that contains the path rootfs/usr/local/bin/
and the following script is placed at rootfs/usr/local/bin/run
:
#!/usr/bin/env bash # create a directory that will be mountable as a regular Docker volume mkdir -p /etc/corrade # now pivot user-editable files as a symlink into the Docker mountable volume directory if [ ! -f /etc/corrade/CorradeConfiguration.xml ]; then cp /corrade/CorradeConfiguration.xml.default /etc/corrade/CorradeConfiguration.xml fi ln -sf /etc/corrade/CorradeConfiguration.xml /corrade/CorradeConfiguration.xml if [ ! -f /etc/corrade/NucleusConfiguration.xml ]; then cp /corrade/NucleusConfiguration.xml.default /etc/corrade/NucleusConfiguration.xml fi ln -sf /etc/corrade/NucleusConfiguration.xml /corrade/NucleusConfiguration.xml if [ ! -f /etc/corrade/Log4Net.config ]; then cp /corrade/Log4Net.config.default /etc/corrade/Log4Net.config fi ln -sf /etc/corrade/Log4Net.config /corrade/Log4Net.config /corrade/Corrade
Some voodoo is performed by the run
script that moves the configuration files to /etc/corrade
, that will be exported to the host via a volume mount, and then the script creates back(sym)links to the Corrade directory such that some of the configuration files can be exposed in order to not resort to bind mounts.
It is fairly acceptable to resort to bind mounts; that is, expose the whole Corrade directory, even if it is docker-unorthodox to do so, but due to Nucleus that uses a lot of small files, as well as the Corrade cache that keeps growing, synchronizing the files between host and container takes a while (a long while, it took 15 minutes on the clock, as a cold start).