[~] BACK



~~ HIY (II) ~~

** SPECIFICATIONS **

[HOW] | [20221129] | [0] | [0x17]




In the first part I showed you my idea of ​​what kind of foundation and, above all, what kind of structure the NERDBUDE should have in the future. The next step in the series is the selection of hardware and software. More precisely, which server, which operating system and which tools. The selection is of course made in accordance with the previously known procedure of keeping everything as slim and light as possible. Let's start with the server.

SERVER

Choosing the server is of course the first step to take. Nerd-friendly, of course, is Hetzner. Hetzner has been doing the infrastructure stuff since 1997 and I assume that they know what they're doing. Hetzner has an enormous selection of options and I had to dig through it to find out what I actually needed. At some point, I looked through everything and realized that a cloud server is completely sufficient for the NERDBUDE. I don't plan on running web applications or other stuff on the server. If something like that happens at some point, I'll get a new server. The cloud server is enough for now. The configuration is as follows:

SERVER
  CPX31
  4x VCPU
  8GB RAM
  160GB NVMe SSD
  20TB Traffic
  Location: DE

Not too little and not too much. I also have 20GB of block storage. The advantage of block storage is that it can grow dynamically. Since podcasts and later emails run via the server, I naturally want storage that grows with the server so that I don't have to completely reinstall it when the storage fills up.

OPERATING SYSTEM

The question of all questions - although that is every question with this project - which OS will go on the server. Hetzner offers a large number of operating systems that can be installed as default. Ubuntu, Debian, RockyLinux, CentOS, etc. I've already played around with Debian in the server area. Debian is somehow memorable and performs well. But the learning curve would be relatively flat if we use Debian. So I'm going to stick with NixOS as a server OS and try it out. Everything else feels somehow wrong.

Unfortunately, Hetzner does not (yet) offer NixOS as a default OS. But there is the option of putting NixOS on the cloud server. The tool/script is called nixos-infect. Pretty cool and fitting name, because first the "host" is installed, in my case Debian 10 and within Debian nixos-infect is started and installs NixOS over Debian.

Installing NixOS via nixos-infect is quite simple and can be done in just a few steps. The most important thing is that you save an SSH key on the server, otherwise you will lock yourself out of the system like I did. So we create an SSH key (this happens on the computer you want to use to connect to the server). This can be done in two ways:

TERMINAL (LOCAL)
  ssh-keygen
  ssh-keygen -b 4096

The first command creates the standard 2048-bit RSA key and the second variant creates a 4096-bit RSA key. You already know more security. In the process you will be asked for the path under which the key should be saved. ~/.ssh/id_rsa is of course sensible. You will also be asked for a password. So enter the password here, confirm it and of course remember it.
To be on the safe side, we check on the Debian server whether other SSH keys are available:

TERMINAL (SERVER)
  ls -l ~/.ssh/id*

If there are no keys, you will get the obligatory "No such file or directory". If there are any, delete them. Now we push our key to the Debian server.

TERMINAL (LOCAL)
  scp ~/.ssh/id_rsa.pub root@serverip:/root/.ssh/authorized_keys

Now we have the SSH key on the server. The configs on the Debian server are not touched by the NixOS installation. This means we can also connect to the server via SSH after installation. Now we move on to the actual NixOS installation.
As already mentioned, HETZNER does not offer NixOS as a default OS. So we have to throw the whole thing onto the server in some other way. A little research brings up a tool called "NixOS Infect" from elitak. This is a script that installs the latest NixOS version over the existing Debian but retains configs such as the SSH keys, for example. The script is executed on the server with the following 1-liner:

TERMINAL (SERVER)
  curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-master | NIX_CHANNEL=nixos-22.05 bash -x

From now on there is no turning back. When everything has been completed, you will be logged out and disconnected from the server. I had to log in to the Hetzner Web Console briefly because my NixOS installation had a hiccup and needed to be rebooted. After that happened, it ran without any problems. So wait a moment and then log in to the server via SSH and check using nixos-version to see if everything worked.



TOOLS

The good thing about NixOS is the easy installation and configuration of tools. These are installed via configuration.nix. But which tools are needed on the server?

NGINX - - Originally I wanted to use Apache. However, Apache is quite large and nowhere near as fast as NGINX. So NGINX is going to be used on NixOS as a web server.

VIM - Do I need to say anything else - I don't think so. Vim is simply part of it.

GIT - Since NERDBUDE is to get a new connector, it obviously needs git. I had already played around with GITEA beforehand, but I don't need the complete user management and web interface. I don't want to build NerdHub here. For this reason, a simple git will run. That way, everyone can download the code and, if necessary, work on it.

That should cover the most important things for now to put the NERDBUDE on the Hetzner cloud server. If other tools are needed, I will list them in the individual parts. We have NixOS, Vim and Git. What more do you need.

PARTS:
[01] - Intro
[02] - Requirements
[03] - Webserver
[04] - Mailserver


EDIT:
[2022-11-30] - change from Apache to NGINX
[~] BACK