Marinus Klasen

Marinus Klasen

  • Development
  • Consultancy
  • Developer Resources
  • Blog
  • Contact

March 22, 2022

Halcyon Part 2: The docker-compose.yml configuration

Marinus Klasen

List of variables and ip addresses used: https://mklasen.com/halcyon-list-of-variables-and-ip-addresses/

While the components are sitting on my desk, waiting to be unpacked, and while I figure out how to approach this (blogging? video? livestream? unpack video?), we can have a look at the server configuration.

Let’s start by creating a Github repo in which we’ll push the server configuration. You can find it here:

https://github.com/mklasen/halcyon

The docker-compose.yml file

In the previous blog post I spoke about the service we want to run, ordered by priority:

  1. DNS service
  2. nginx-proxy for forwarding requests
  3. catch-all mailserver
  4. VPN service
  5. Backup service for iPhones
  6. TimeMachine backup service

I’ll copy the list above and add it to the docker-compose.yml file, then we’ll build from there.

version: "3"

# What we want to run:
# - DNS service
# - nginx-proxy for forwarding requests
# - VPN service
# - Catch-all mailserver
# - Backup service for iPhones
# - TimeMachine backup service

https://github.com/mklasen/halcyon/blob/88c105ba1fd4cfd25513becff48c9a3c135889dd/docker-compose.yml

Adding the DNS service

We’ll use the cytopia/bind image for this service. Learn more about this image here and here.

This is the moment that we’ll define the custom TLD as well, which is entered in the DNS_A argument. Hm.. how about “.hyc”?

This is the full configuration after adding the dns service:

version: "3"

# What we want to run:
# - DNS service
# - nginx-proxy for forwarding requests
# - VPN service
# - Catch-all mailserver
# - Backup service for iPhones
# - TimeMachine backup service

services:
  dns:
    container_name: dns
    image: cytopia/bind:0.28
    hostname: bind
    ports:
      - "53:53/tcp"
      - "53:53/udp"
    dns:
      - 127.0.0.1
    environment:
      - DNS_A='*.hyc=192.168.2.70'
      - DNS_FORWARDER=192.168.1.1
      - DOCKER_LOGS=1
      - DEBUG_ENTRYPOINT=2
    restart: always

We’re linking port 53 to this service. This is the port that is used for DNS requests. With “DNS_A” we’re saying: Handle all requests for .hyc by “192.168.2.70”. We’re forwarding other DNS requests to “192.168.1.1”. Info and queries are logged to docker with “DOCKER_LOGS=1” and by setting “DEBUG_ENTRYPOINT=2” we log all info, warnings, errors and comments that are executed.

Setting up nginx-proxy

Okay, moving forward to nginx-proxy. Keep in mind: I’m just defining configuration now. At the time of writing, this configuration has not been tested.

We’ll keep the nginx-proxy configuration simple for now. Later on, we’ll dive into setting up shared volumes for configuration of the nginx-proxy container.

  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    restart: always

The catch-all mailservice

This will actually be the first service that we’ll set environment variables for that will be resolved by nginx-proxy later on. Below you’ll see that we define VIRTUAL_HOST and VIRTUAL_PORT. We’re basically telling nginx-proxy to forward traffic from VIRTUAL_HOST to this container on VIRTUAL_PORT. The mailhog service is accessible on the web via 8025, and SMTP runs on 1025, hence the expose part.

  catchall:
    container_name: catchall
    image: mailhog/mailhog:latest
    expose:
      - '8025'
      - '1025'
    environment:
      VIRTUAL_HOST: "mail.hyc"
      VIRTUAL_PORT: 8025
    restart: always

Alright, that’s it for today. We have a nice configuration to start with once we get this hardware up and running. I’m pretty sure this configuration will not run flawlessly upon start, but we’ll fix that on the go.

See you in part 3!

Repository state after the changes in this blog:

https://github.com/mklasen/halcyon/tree/5db4b2e470c298780b4ae9724c74b2d0e2028f5a

About Marinus Klasen

Marinus has been working in software/web development for more than a decade. Since 2020 his attention shifted on sharing knowledge and developing products and tools for sharing knowledge.

Marinus Klasen on Twitter

Looking for a WordPress expert?
Hire top notch developers on Codeable!

Consult an expert

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get in touch

Contact me using the details below

Marinus Klasen

Wilhelmina van Pruisenweg 35, 2595 AN Den Haag

marinus@mklasen.com
twitter.com/marinusklasen
linkedin.com/in/marinusklasen

  • GitHub
  • LinkedIn
  • Twitter

Have you read?

  • Elementor Widget UsageMarch 27, 2025
  • Programmatically showing popups with ElementorMarch 25, 2025
  • The Elementor sanitize_settings errorSeptember 12, 2024
  • Announcing.. Wooping Shop Health!June 13, 2024
  • Swiper setup when using wp-scriptsMarch 14, 2024

Copyright © 2025 ยท Marinus Klasen | Webdesign by Team Rood