How to override default configs for a hypersnap/snapchain node

This is mostly in response to PR#102 which I pushed to hypersnap yesterday which has now merged into v0.17.21.

I'm seeing some noderunners confused around the whole docker-compose.yml setup: when to update it, when not to touch it, etc. I said I'd write a post about this, so here we go! Good chance for me to kick the tyres on the new Article system. 😸📝

Bear in mind this is based on my own opinion and experiences doing operations management at various organisations. If it doesn't reflect your preferred methodology, feel free to not do it.

arfy's rules to live by

  • I never touch the repo's docker-compose.*.yml files. That means I can update our validator and never have to merge/modify new changes into my docker-compose.yml file manually.
  • Never shove your validator private key into the docker compose file. I mean, c'mon.
  • Use best practices. docker-compose.override.yml exists for a reason and I will show you how to use it. Environment files also exist for a reason and I will show you why this is neat-o.

wat do?

  1. Backup your existing docker-compose.yml file, then remove it.
  2. Make a symbolic link: ln -s docker-compose.mainnet.yml docker-compose.yml. Your docker compose file is now exactly the same as the repo version, and the symlink ensures future changes flow into your node without overwriting your shit.
  3. Override where your config diverges from the standard config. This is where it gets fun, so we'll cover this in the next section.

wat mean, override file?

Did u know? The docker-compose.override.yml file is the standard way in which to override any settings from docker-compose.yml. By doing this, you maintain a 100% stock compose file, and override only the custom settings you want.

TL;DR: hypersnap repo updates to docker compose will never overwrite your settings again.

Docker knows about this file, and will prioritise and merge it together with the standard docker compose file.

Step one: get ur fucking key out of the compose file

Edit a file, let's say ~/hypersnap/hypersnap.env. Put your key in there:

SNAPCHAIN_CONSENSUS__PRIVATE_KEY=put_ur_private_key_here

Be sure to chmod it properly: chmod 600 ~/hypersnap/hypersnap.env. You know what that does, right, anon? Dis is critical to protect your key.

Step two: craft your override file

I will mention that for ports and some other sections, it will STACK the config from compose + override file, unless you use the !override tag (look at my example below). That means if you don't use the !override tag you will be listening on 0.0.0.0 (from docker-compose.yml) as well as localhost (if you set this in the override), effectively cucking your rules.

I expect you to know what you did to your config and where you need to override. diff is your friend--use it: diff your backed up compose file with the repo mainnet file to see where it diverges, those need to go into your override, cautiously.

Every node has different setups, different customisations. I won't sit here going through every iteration of possible configurations like RPC addresses, bootstrap peers, etc... that is an exercise left for the reader.

(I'm not going to babysit you through the process. You're a sysadmin hosting a node, and quite frankly if you have no idea what I'm talking about, you have no business running a node let alone a validator IMHO.)

Example override file

Here's my sample ~/hypersnap/docker-compose.override.yml file, I use a very similar configuration myself on our @imgn node:

services:
  hypersnap:
    env_file:
      - ./hypersnap.env
    ports: !override
      - "127.0.0.1:3381:3381/tcp"
      - "3382:3382/udp"
      - "127.0.0.1:3383:3383/tcp"
  grafana:
    ports: !override
      - "127.0.0.1:3000:3000"
  statsd:
    ports: !override
      - "127.0.0.1:8125:8125/udp"
      - "127.0.0.1:8126:8126"

What this sample override file does:

  • Notice I've added something here nobody really talks about: using the hypersnap.env file. That's why you don't see my private key in the docker files. There is no need to expose it there or in the override.
  • Various tweaks to the bounded addresses for the various services. Again, do not add these unless you understand what you're doing. Every node is different. Some cannot listen on localhost 3381/tcp because you're not reverse proxying from HTTPS:443, for example.

btw - on portz and firewallz

So right now you might be asking me "but arfy, I got my trusty ufw handling all dis innit brav?"

... well, no. Docker rules are shoved into iptables before it ever hits ufw. Your ufw firewall rules are absolutely useless. You need to sort this out here in the docker compose/override file.

Activatin' dis

To ensure this now works, you then recreate the container(s). Depending on what services you've overridden, recreate containers & restart some or all of the services:

Just hypersnap:

docker compose up -d hypersnap

All services:

docker compose up -d

Confirm u didn't fuck dis up

Validate in the logs that you've got it right. For example, grep to ensure it starts with your node's proper public key. That proves the private key is being read properly through the flow:

docker-compose.yml is overriden by docker-compose.override.yml which looks in hypersnap.env and picks up your private key properly, and the end result is you see your public key in the logs on startup.

To show public key & file descriptors on service startup, run this in a terminal immediately after restarting:

arfyshell$ docker compose logs -f -n 1000|grep -iE "starting snapchain|file descriptor"

hypersnap-1  | 2026-11-25T13:43:07.891289Z  INFO hypersnap: Starting Snapchain validator node with public key: 7882148cc2608d13d096ea6d68891deb99000612a9f136e55af440d49173ce0d (12D3KooWHvn8rQpVovdhKEcwko1TBcnwC8mtkZEFyfKKNearZqXJ)

hypersnap-1  | 2026-11-25T13:43:08.439278Z  INFO hypersnap: Starting replicator with file descriptor limit: 1048576

Conclusion

welp, if you've done all this, you'll never have to worry about merging docker compose changes manually again, or getting your custom config wiped out.

The only time you should then need to update config, is via the override file for your specific node.

You keep up with the latest & greatest compose files & configurations.

Have fun, noderunners! 😻

arfonzo 🐈‍⬛

5 likes4 recasts1 replies

1 reply

  • incredible words 👏. so fun to see an experienced professional share how not to cuck yourself wide range on my tl today: arfy: pls don't cuck urself linus: torching a contributor for asshattery theo: whatever that dude's doing, I can't even

    2 likes · 0 recastsRead 1 reply

    lmao, timeline is pretty random today 😹

    1 like · 0 recasts