86 lines
2.4 KiB
Markdown
86 lines
2.4 KiB
Markdown
# Serverraum-mit-Matratze Infrastructure
|
|
|
|
[](LICENSE)
|
|
[](https://github.com/RichardLitt/standard-readme)
|
|
|
|
This is the Infrastructure Code for the "Serverraum mit Matratze" shared apartment.
|
|
|
|
## Table of Contents
|
|
|
|
- [Dependencies](#dependencies)
|
|
- [Updating Configuration](#updating-configuration)
|
|
- [Hosts](#hosts)
|
|
- [License](#license)
|
|
|
|
## Dependencies
|
|
|
|
To remotely Deploy Nix-Servers with Native Tools, you will need Access to the nixos-rebuild command.
|
|
|
|
You can either use a NixOS System.
|
|
|
|
Or you can Install the [Nix Package Manager](https://nixos.org/download/) and open a Nix-Shell with the Command available:
|
|
|
|
``` bash
|
|
nix-shell -p '(nixos{}).nixos-rebuild'
|
|
```
|
|
|
|
## Updating Configuration
|
|
|
|
So, you updated the Configuration on your Computer, how can you apply the Updated Config to the Server?
|
|
|
|
You'll need SSH-Access to the Server, with a User which can run Nix-Commands, and can escalate Privileges using sudo.
|
|
|
|
1. Don't forget to Configure your ssh Config! (See [Hosts](#hosts))
|
|
2. Stage the Changes if you created or deleted Files `git add .` (They will be ignored if you miss this step!)
|
|
3. Build and Switch the Config on the Target Server! (Example [mow0m](#mow0m)):
|
|
|
|
``` bash
|
|
nixos-rebuild switch --flake .#mow0m --target-host master@mow0m --build-host master@mow0m --use-remote-sudo
|
|
```
|
|
|
|
You want to keep the Build-Host the Same as the Target-Host, because the Target will only accept Binarys with a trusted Signature. It is way easier, to just run the Build on the Same Machine then.
|
|
|
|
## Hosts
|
|
|
|
### mow0m
|
|
|
|
[Configuration](./systems/x86_64-linux/mow0m)
|
|
|
|
<table>
|
|
<tr>
|
|
<td>User</td>
|
|
<td>master@mow0m</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Cpu</td>
|
|
<td>Intel(R) Core(TM) i5-6400 (4) @ 3.30 GHz</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Ram</td>
|
|
<td>32GB</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Build</td>
|
|
<td><pre lang="bash">nixos-rebuild switch --flake .#mow0m --target-host master@mow0m --build-host master@mow0m --use-remote-sudo</pre></td>
|
|
</tr>
|
|
<tr>
|
|
<td>SSH Config</td>
|
|
<td><pre lang="bash">
|
|
Host mow0m
|
|
HostName mow0m.lan
|
|
User master
|
|
Port 9553
|
|
IdentityFile ~/.ssh/master@mow0m
|
|
Host remoteunlock-mow0m
|
|
HostName mow0m.lan
|
|
User root
|
|
Port 2550
|
|
IdentityFile ~/.ssh/remoteunlock-mow0m</pre></td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
## License
|
|
|
|
[GPL v2](../LICENSE)
|