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:
- DNS service
- nginx-proxy for forwarding requests
- catch-all mailserver
- VPN service
- Backup service for iPhones
- 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
Leave a Reply