docs: wrote part of new usage section

This commit is contained in:
Jef Roosens 2022-06-09 09:32:41 +02:00 committed by Jef Roosens
parent 4ecf6a11c4
commit d7d77afe09
Signed by untrusted user: Jef Roosens
GPG key ID: B580B976584B5F30
5 changed files with 63 additions and 6 deletions

View file

@ -0,0 +1,4 @@
# Usage
This section describes how to use the various parts of Vieter. It assumes you
have a Vieter repository server up and running.

View file

@ -0,0 +1,38 @@
# Pacman repository
The part of Vieter that users will interact with the most is the Pacman
repository aka `vieter server`.
## Design overview
A Vieter repository server has support for multiple repositories, with each
repository containing packages for multiple architectures.
If you wish to use these repositories on your system, add the following to
`/etc/pacman.conf` for each repository you wish to use:
```
[repo-name]
Server = https://example.com/$repo/$arch
SigLevel = Optional
```
Here, `$repo` & `$arch` are not variables you have to fill in yourself. Rather,
Pacman will substitute these when reading the config file. `$repo` is replaced
by the name between the square brackets (in this case `repo-name`), & `$arch`
is replaced by your system's architecture, e.g. `x86_64`. Of course, you can
also fill in these values manually yourself, e.g. if you wish to use a
different name inside the square brackets.
Important to note is that, when two repositories contain a package with the
same name, Pacman will choose the one from the repository that's highest up in
the `pacman.conf` file. Therefore, if you know your repository has packages
with the same name as ones from the official repositories, it might be better
to place the repository below the official repositories to avoid overwriting
official packages.
## Publishing packages
Packages can be easily published using a single HTTP POST request. Check out
the [HTTP API docs](https://rustybever.be/docs/vieter/api/) for more info on
these routes, including example cURL commands.

View file

@ -0,0 +1,54 @@
---
weight: 30
---
# Usage
## Starting the server
To start a server, either install it using Docker (see
[Installation](/installation)) or run it locally by executing `vieter
server`. See [Configuration](/configuration) for more information about
configuring the binary.
## Multiple repositories
Vieter works with multiple repositories. This means that a single Vieter server
can serve multiple repositories in Pacman. It also automatically divides files
with specific architectures among arch-repos. Arch-repos are the actual
repositories you add to your `/etc/pacman.conf` file. See [Configuring
Pacman](/usage#configuring-pacman) below for more info.
## Adding packages
Using Vieter is currently very simple. If you wish to add a package to Vieter,
build it using makepkg & POST that file to the `/<repo>/publish` endpoint of
your server. This will add the package to the repository. Authentification
requires you to add the API key as the `X-Api-Key` header.
All of this can be combined into a simple cURL call:
```
curl -XPOST -H "X-API-KEY: your-key" -T some-package.pkg.tar.zst https://example.com/somerepo/publish
```
`somerepo` is automatically created if it doesn't exist yet.
## Configuring Pacman
Configuring Pacman to use a Vieter instance is very simple. In your
`/etc/pacman.conf` file, add the following lines:
```
[vieter]
Server = https://example.com/$repo/$arch
SigLevel = Optional
```
Here, you see two important placeholder variables. `$repo` is replaced by the
name within the square brackets, which in this case would be `vieter`. `$arch`
is replaced by the output of `uname -m`. Because Vieter supports multiple
repositories & architectures per repository, using this notation makes sure you
always use the correct endpoint for fetching files.
I recommend placing this below all other repository entries, as the order
decides which repository should be used if there's ever a naming conflict.