{"id":925,"date":"2022-03-22T12:33:22","date_gmt":"2022-03-22T12:33:22","guid":{"rendered":"https:\/\/mklasen.com\/?p=925"},"modified":"2022-04-15T17:36:54","modified_gmt":"2022-04-15T17:36:54","slug":"halcyon-part-2-the-docker-compose-yml-configuration","status":"publish","type":"post","link":"https:\/\/mklasen.com\/halcyon-part-2-the-docker-compose-yml-configuration\/","title":{"rendered":"Halcyon Part 2: The docker-compose.yml configuration"},"content":{"rendered":"\n
List of variables and ip addresses used: https:\/\/mklasen.com\/halcyon-list-of-variables-and-ip-addresses\/<\/a><\/p>\n\n\n\n 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.<\/p>\n\n\n\n Let’s start by creating a Github repo in which we’ll push the server configuration. You can find it here:<\/p>\n\n\n\n https:\/\/github.com\/mklasen\/halcyon<\/a><\/p>\n\n\n\n In the previous blog post I spoke about the service we want to run, ordered by priority:<\/p>\n\n\n\n I’ll copy the list above and add it to the docker-compose.yml file, then we’ll build from there.<\/p>\n\n\n\n https:\/\/github.com\/mklasen\/halcyon\/blob\/88c105ba1fd4cfd25513becff48c9a3c135889dd\/docker-compose.yml<\/a><\/p>\n\n\n\n We’ll use the cytopia\/bind image for this service. Learn more about this image here<\/a> and here<\/a>.<\/p>\n\n\n\n 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”?<\/p>\n\n\n\n This is the full configuration after adding the dns service:<\/p>\n\n\n\n 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. <\/p>\n\n\n\n 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. <\/p>\n\n\n\n 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.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n 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.<\/p>\n\n\n\nThe docker-compose.yml file<\/h2>\n\n\n\n
version: \"3\"\n\n# What we want to run:\n# - DNS service\n# - nginx-proxy for forwarding requests\n# - VPN service\n# - Catch-all mailserver\n# - Backup service for iPhones\n# - TimeMachine backup service<\/code><\/pre>\n\n\n\n
Adding the DNS service<\/strong><\/h4>\n\n\n\n
version: \"3\"\n\n# What we want to run:\n# - DNS service\n# - nginx-proxy for forwarding requests\n# - VPN service\n# - Catch-all mailserver\n# - Backup service for iPhones\n# - TimeMachine backup service\n\nservices:\n dns:\n container_name: dns\n image: cytopia\/bind:0.28\n hostname: bind\n ports:\n - \"53:53\/tcp\"\n - \"53:53\/udp\"\n dns:\n - 127.0.0.1\n environment:\n - DNS_A='*.hyc=192.168.2.70'\n - DNS_FORWARDER=192.168.1.1\n - DOCKER_LOGS=1\n - DEBUG_ENTRYPOINT=2\n restart: always<\/code><\/pre>\n\n\n\n
Setting up nginx-proxy<\/h4>\n\n\n\n
nginx-proxy:\n image: jwilder\/nginx-proxy\n container_name: nginx-proxy\n ports:\n - \"80:80\"\n - \"443:443\"\n restart: always<\/code><\/pre>\n\n\n\n
The catch-all mailservice<\/h4>\n\n\n\n
catchall:\n container_name: catchall\n image: mailhog\/mailhog:latest\n expose:\n - '8025'\n - '1025'\n environment:\n VIRTUAL_HOST: \"mail.hyc\"\n VIRTUAL_PORT: 8025\n restart: always<\/code><\/pre>\n\n\n\n