Easily host multiple dedicated domains using Docker

All domains on the Cutelab network (https://cutelab.space/domains) are completely hosted on a single machine using Docker, Docker Compose and a custom Node.js script. I’ve made the process so easy that I can create and destroy domains within a minute. Here’s how you can too!

0. Hardware requirements

  • Whether you want to host a single domain or multiple, you will need an x86_64 machine with any distro of Linux installed. Ubuntu server is easy to use. You must have basic knowledge of how Linux works.

  • You will need high speed internet because the server stack is very network heavy.

  • I recommend using a consumer processor like the Intel i7 at around 4.0 GHz for multiple domain hosing. Server hardware such as the Intel Xeon has actually caused problems for me in the past which is strange.

1. Installing dependencies

2. Creating folders and files

  • Create a new folder (e.g. mkdir ~/hifi) and cd ~/hifi into it.

  • Download: generate.js using curl -O https://hifi.maki.cat/external-scripts/compose-domain/generate.js

  • Download: yaml using npm install yaml

  • Write a new file: config.js using nano config.js and paste

module.exports = {
	version: "0.83.0",
	domains: {
		mydomain1: 50000,
		mydomain2: 50020,
	}
};
  • Edit the config to your likings

    • version: "0.83.0", should be the latest Hifi version

    • mydomain1: 50000,

      • The domain name will determine the folder path that the domain will use at ./domains/mydomain1

      • The port will occupy the next 20 ports (50000 to 50020). Make sure you open all ports on your router TCP/UDP and remember every domain has 20 ports apart from each other.

    • mydomain2: 50020, is optional and can be duplicated or deleted.

3. Generating config and starting up

  • Run node generate.js and the file docker-compose.yml should appear in the folder.

  • Run docker-compose up -d to start! It will first download the image which can take a while, but eventually you will be back to your shell when it is running.

    • The domains will also restart when the machine restarts as long as the docker service is enabled using systemctl
  • To visit your domain admin panel, visit http://ipofmachine:50000 or which ever port you used. You will be guided through Hifi’s domain setup.

    • If you don’t have a place name, you can visit your domain at hifi://ipofmachine:50002 (+2 from port in config.js)

    • If you have a place name set up, you will need to specify the server address and port at the top of the admin panel. You will find this:


      Set Automatic Networking to either None or IP Only but make sure that the port is set to 50002 (+2 from port in config.js)

4. Maintenance and details

  • To shut down all domains, cd into your folder cd ~/hifi and type docker-compose down

  • To manage one domain type docker-compose stop/start/restart/logs mydomain1

  • To update all domains to a new version

    • Run docker-compose down
    • Edit config.js to match new version
    • Delete old image with docker rmi highfidelity/hifi:v0.??.?
      • This will save a lot of space. View all installed images with docker images
    • Run docker-compose up -d
  • To see what docker containers are running run docker ps --format "{{.Names}}"

    • This is a way to check what’s up or down and can help with ensuring all domains are down when updating.

5. Conclusion

Thank you very much for reading! I hope this helped and if there are any problems, feel free to send me a message on Discord at Maki#4845 or reply here. I will try to keep this post up to date.

Original tutorial: https://forums.highfidelity.com/t/how-to-setting-up-a-domain-with-docker-compose/14426

2 Likes

I do not want to host HiFi at home, I want to host it on a VPS on the internet. I guess my personal preferences are a bit annoying, cutelab is not about everything for everyone of course!

Based on personal experience the best description is when you pair the process with the provider.
“this was tested on Linode on Bionic, and if you follow the steps this is going to work for you”. You are going to remove a lot of uncertainty when two out of the three necessary entities are known. Then the ONLY thing that is wrong must be your code.
I assume hosting a server out of your flat or apartment is cool… whatever. Please do not host “servers” out of your flat or apartment. Thank you!

I am not sure how many registrars support .space with DNSSEC, I never rented a .space TLD and I doubt I ever want to. If you ever try to hook up email to your .space this might be a problem. I had in the past very bad experiences with .xyz so I stay away from exotic TLDs. For factoryfouroh I rent 11 TLDs, and I anchor all my DNS servers with .info by Google Domains. You might want to stick with the boring but true, ditch the exotic and the .space

This is getting a bit thicker… I personally do not trust any domain that has no verified email.
I check MX Toolbox about cutelab.space and oh boy :frowning: I already wrote that .space domains have no DNSSEC support in the US.

You could indeed “host multiple dedicated domains using Docker”.
I try to introduce awareness ABOUT standards and safety on the internet. Yeah, the internet did not survive because people in charge have no fricking idea what they do!

Edit: I am more than happy to tutor and explain and demonstrate Internet Standards to anyone. I do not create them, I simply try to understand and always promote them.