krops article corrected a bit

This commit is contained in:
Ingolf Wagner 2018-09-30 09:40:28 +02:00
parent 181fb6095d
commit 297367aaa5
2 changed files with 84 additions and 72 deletions

5
.markdownlint.json Normal file
View file

@ -0,0 +1,5 @@
{
"MD033": { "allowed_elements": [
"table", "thead", "tbody", "tr", "td", "th"
]}
}

View file

@ -14,12 +14,12 @@ summary: >
In this article we will checkout on how to deploy a server
using krops and discuss all involved parameters and steps.
---
# krops
[NixOps](https://nixos.org/nixops/) the official DevOps tool of
[NixOps](https://nixos.org/nixops/)
the official DevOps tool of
[NixOS ](https://nixos.org) is nice, but it has some flaws.
[krops](https://cgit.krebsco.de/krops/about/) is an alternative to
[NixOps](https://nixos.org/nixops/) trying to solve some of theses flaws,
@ -33,70 +33,73 @@ have a look at
# krops vs. NixOps (Feature Comparison)
<table class="comparison">
<tr>
<th class="text">Feature</th>
<th>NixOps</th>
<th>krops</th>
</tr>
<tr>
<td title="serverA is unstable, serverB is stable, serverC on commit=XY">
Precise versioning for every machine.
</td>
<td class="bad"> No </td>
<td class="good"> Yes </td>
</tr>
<tr>
<td class="text">Well documented</td>
<td class="good"> Yes </td>
<td class="bad"> No</td>
</tr>
<tr>
<td class="text">Lightweight</td>
<td class="ok"> Kinda </td>
<td class="good"> Yes </td>
</tr>
<tr>
<td class="text"
title="krops uses passwordstore.org, see more below">
Native File Encryption
</td>
<td class="bad"> No </td>
<td class="good"> Yes </td>
</tr>
<tr>
<td class="text"
title="nixops has deployment.keys">
TMPFS Key Management
</td>
<td class="good"> Yes </td>
<td class="bad"> No </td>
</tr>
<tr>
<td class="text"
title="run nixos-rebuild on the target system">
Manual Deployment Possible
</td>
<td class="bad"> No </td>
<td class="good"> Yes </td>
</tr>
<tr>
<td class="text" >
Needs Database
</td>
<td class="bad"> Yes </td>
<td class="good"> No </td>
</tr>
<tr>
<td class="text"
title="where are the .drv files are created">
Build and Download happens on
</td>
<td class="ok"> Client </td>
<td class="good"> Target </td>
</tr>
<thead>
<tr>
<th class="text">Feature</th>
<th>NixOps</th>
<th>krops</th>
</tr>
</thead>
<tbody>
<tr>
<td title="serverA is unstable, serverB is stable, serverC on commit=XY">
Precise versioning for every machine.
</td>
<td class="bad"> No </td>
<td class="good"> Yes </td>
</tr>
<tr>
<td class="text">Well documented</td>
<td class="good"> Yes </td>
<td class="bad"> No</td>
</tr>
<tr>
<td class="text">Lightweight</td>
<td class="ok"> Kinda </td>
<td class="good"> Yes </td>
</tr>
<tr>
<td class="text"
title="krops uses passwordstore.org, see more below">
Native File Encryption
</td>
<td class="bad"> No </td>
<td class="good"> Yes </td>
</tr>
<tr>
<td class="text"
title="nixops has deployment.keys">
TMPFS Key Management
</td>
<td class="good"> Yes </td>
<td class="bad"> No </td>
</tr>
<tr>
<td class="text"
title="run nixos-rebuild on the target system">
Manual Deployment Possible
</td>
<td class="bad"> No </td>
<td class="good"> Yes </td>
</tr>
<tr>
<td class="text" >
Needs Database
</td>
<td class="bad"> Yes </td>
<td class="good"> No </td>
</tr>
<tr>
<td class="text"
title="where are the .drv files are created">
Build and Download happens on
</td>
<td class="ok"> Client </td>
<td class="good"> Target </td>
</tr>
</tbody>
</table>
# krops Structure by Example
krops is not an executable like NixOps,
@ -164,7 +167,8 @@ Once that file is created, you can run the command `./result` again.
krops will copy the file `configuration.nix` to `/var/src/nixos-config` on `server01`
and will clone `nixpkgs` into `/var/src/nixpkgs`.
After that, krops will run `nixos-rebuild switch -I /var/src` which will provision `server01`.
After that, krops will run `nixos-rebuild switch -I /var/src` which will provision
`server01`.
## The Different Parts Explained
@ -195,11 +199,13 @@ The executable `server01` is which results in the link `./result`.
It is the result of `krops.writeDeploy` with parameters
* `target` passed to the ssh command
* `source` the set of files and folders which should be made available beneath `/var/src` on the target
* `source` the set of files and folders which should be made available beneath
`/var/src` on the target
{{% note %}}
`target` takes more argument parts than just the host, you can for example set it to `root@server01:4444/etc/krops/`
`target` takes more argument parts than just the host,
you can for example set it to `root@server01:4444/etc/krops/`
to change the ssh port and the target folder it should be copied.
@ -396,8 +402,8 @@ in {
```
Now you can create multiple `./result`s or you can use the `-A` parameter of nix-build to choose what
`./result` will be.
Now you can create multiple `./result`s or you can use the
`-A` parameter of nix-build to choose what `./result` will be.
```shell
$> nix-build ./krops.nix -A server01 && ./result
@ -407,9 +413,10 @@ $> nix-build ./krops.nix -A all && ./result
## Update and Fixing Git Commits
Updating hashes for Git repositories is annoying and using branches might break consistency.
To avoid editing files you can use the `nix-prefetch-git` and `lib.importJson` to make
your live easier.
Updating hashes for Git repositories is annoying and using branches
might break consistency.
To avoid editing files you can use the `nix-prefetch-git`
and `lib.importJson` to make your live easier.
```shell
$> nix-prefetch-git \