docs: new ssh consolidation changes

See coop-cloud/abra#255
This commit is contained in:
decentral1se 2023-02-01 08:16:58 +01:00
parent 3a92e57114
commit 93c9f769d0
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
4 changed files with 14 additions and 56 deletions

View File

@ -28,8 +28,7 @@ flags: `-f/--force`, `-C/--chaos`
flags: `-f/--force`, `-V/--volumes` flags: `-f/--force`, `-V/--volumes`
### add/remove server ### add/remove server
- `abra server add $SERVER $USERNAME $SSH_PORT` - `abra server add $SERVER`
flags: `-p/--provision`, `-l/--local`
- `abra server remove $SERVER` - `abra server remove $SERVER`
flags: `-s/--server` flags: `-s/--server`

View File

@ -8,51 +8,21 @@ You can use [this issue tracker](https://git.coopcloud.tech/coop-cloud/abra/issu
## SSH connection issues? ## SSH connection issues?
`abra` tries its best to learn from your system configuration or command-line input what the correct SSH connection details are for a given server. This doesn't always work out. Here are some things to try to fix it. When you run `abra server add <host>`, `abra` will read from your `~/.ssh/config` and try to match a `Host <host>` entry. If you can `ssh <host>` then you should be able to `abra server add <host>`.
First, ensure that you can `ssh <my-server>` and things work. If you can't SSH to your server then neither can `abra`. If you have a password protected SSH key, then you'll need to make sure your `ssh-agent` is running and you've added your SSH key part: For example, if you do `abra server add example.com`, you should have a matching entry that looks like this:
``` ```
eval $(ssh-agent -k) Host example.com
ssh-add ~/.ssh/<my-secret-key-part> Hostname example.com
ssh-add -L # validate loaded keys User exampleUser
Port 12345
IdentityFile ~/.ssh/example@somewhere
``` ```
The first thing `abra` will check for is the connection details listed in `abra server ls`. Check those details are correct. If you haven't managed to `abra server add` your server yet, then no details will appear in that list. You may need to take a look at [this entry](/abra/trouble/#abra-server-ls-shows-the-wrong-details) to clean up old values depending on your situation.
`abra` will then try to read your `~/.ssh/config` entries and match the server domain against a `Host` entry. So, if you do `ssh myserver.com` and you have:
```
Host myserver.com
Hostname myserver.com
User myuser
Port 222
IdentityFile ~/.ssh/my@myserver.com
```
Then `abra` should have all it needs to build a working SSH connection. You can validate this by passing `-d/--debug` to your commands.
However, sometimes, you use an alias in your SSH configuration, say:
```
Host mys
...
```
So that you can simply type `ssh mys`. `abra` won't be able to match against those entries to discover connection details. You can use aliases to remedy this:
```
Host mys, myserver.com
...
```
`abra` will try to read the relevant `IdentityFile` entry from your `~/.ssh/config` but if it can't make a match, it will rely on your key being added to the `ssh-agent`.
Due to a limitation in our implementation, `abra` uses 2 methods of making SSH connections, the main `abra` -> `remote docker` connection using `/usr/bin/ssh` which can seamlessly pick up loaded SSH keys. However, for SSH host key checking, `abra` uses an SSH library & Golang SSH internals. We're working on resolving this to a single implementation but it is tricky work.
## "abra server ls" shows the wrong details? ## "abra server ls" shows the wrong details?
You can use `abra server rm` to remove the incorrect details. Make sure to take a backup of your `~/.abra/servers/<domain>` first. You can then try to re-create by using `abra server add ...` again, making sure to take care if you need to use `<user> <port>`, see `abra server add -h` for more help on this. You can use `abra server rm` to remove the incorrect details. Make sure to take a backup of your `~/.abra/servers/<domain>` first. You can then try to re-create by using `abra server add ...` again.
However, if you have Docker installed on the same machine you have `abra`, then there might be some confusion. If you run `docker context ls` you'll see that Docker uses context connection strings also. `abra` simply uses this approach. Sometimes, your Docker defined context details & your `abra` context details can get out of sync. You can use `docker context rm` to resolve this. However, if you have Docker installed on the same machine you have `abra`, then there might be some confusion. If you run `docker context ls` you'll see that Docker uses context connection strings also. `abra` simply uses this approach. Sometimes, your Docker defined context details & your `abra` context details can get out of sync. You can use `docker context rm` to resolve this.
@ -62,7 +32,7 @@ If you need to create a new context from Docker, you can do:
docker context create <domain> --docker "host=ssh://<user>@<domain>:<port>" docker context create <domain> --docker "host=ssh://<user>@<domain>:<port>"
``` ```
(This is what we used to before we wrote `abra` to make it more convenient.) This is what we used to before we wrote `abra` to make it more convenient.
## Command-line flag handling is weird? ## Command-line flag handling is weird?
@ -99,7 +69,3 @@ You can install it alongside the [supported version of Abra](https://git.coopclo
git clone https://git.coopcloud.tech/coop-cloud/abra-bash ~/.abra/bash-src git clone https://git.coopcloud.tech/coop-cloud/abra-bash ~/.abra/bash-src
ln -s ~/.abra/bash-src/abra ~/.local/bin/babra ln -s ~/.abra/bash-src/abra ~/.local/bin/babra
``` ```
## I am seeing very weird `lookup <domain> on <ip>: write udp <ip>: write: operation not permitted` errors
You should turn off your VPN. `abra` has trouble dealing with it right now. We welcome change sets to make it work though!

View File

@ -250,8 +250,6 @@ docker swarm init
docker network create -d overlay proxy docker network create -d overlay proxy
``` ```
`abra` will do this for you when you run `abra server add --provision`.
## Managing DNS entries ## Managing DNS entries
`abra record ...` can help you manage your DNS entries if you have an account with a supported 3rd party provider. We currently support [Gandi](https://gandi.net). The process of managing DNS with `abra` usually goes like this: `abra record ...` can help you manage your DNS entries if you have an account with a supported 3rd party provider. We currently support [Gandi](https://gandi.net). The process of managing DNS with `abra` usually goes like this:

View File

@ -102,7 +102,7 @@ Most Co-op Cloud deployments have been run on Debian machines so far. Some exper
You need to keep port `:80` and `:443` free on your server for web proxying to your apps. Typically, you don't need to keep any other ports free as the core web proxy ([Traefik](https://traefik.io)) keeps all app ports internal to its network. Sometimes however, you need to expose an app port when you need to use a transport which would perform better or more reliably without proxying. You need to keep port `:80` and `:443` free on your server for web proxying to your apps. Typically, you don't need to keep any other ports free as the core web proxy ([Traefik](https://traefik.io)) keeps all app ports internal to its network. Sometimes however, you need to expose an app port when you need to use a transport which would perform better or more reliably without proxying.
`abra` has support for both creating servers (`abra server new`) & provisioning them (passing `--provision` to `abra server add`) but those are more advanced automation options which are covered in the [handbook](/operators/handbook). For this tutorial, we'll focus on the basics. Assuming you've managed to create a testing VPS with some `$hosting_provider`, you'll need to install Docker, add your user to the Docker group & setup swarm mode: `abra` has support for creating servers (`abra server new`) but that is a more advanced automation feature which is covered in the [handbook](/operators/handbook). For this tutorial, we'll focus on the basics. Assuming you've managed to create a testing VPS with some `$hosting_provider`, you'll need to install Docker, add your user to the Docker group & setup swarm mode:
``` ```
# docker install convenience script # docker install convenience script
@ -162,14 +162,13 @@ If you run into issues during installation, [please report a ticket](https://git
#### Add your server #### Add your server
Now you can connect `abra` with your server. You need to have a working SSH configuration before you can do this. That means you can run `ssh <server-domain>` on your command-line and everything Works :tm:. Now you can connect `abra` with your server. You should have a working SSH configuration before you can do this (e.g. a matching `Host <server-domain>` entry in `~/.ssh/config` with the correct SSH connection details). That means you can run `ssh <server-domain>` on your command-line and everything Works :tm:.
```bash ```bash
abra server add <server-domain> -p ssh <server-domain> # make sure it works
abra server add <server-domain>
``` ```
The `-p` or `--provision` flag means that `abra` will install Docker and initialise the [new single-host swarm](https://docs.docker.com/engine/swarm/key-concepts/) on your server. If you've already followed the steps in [the server setup](/operators/tutorial/#server-setup) step, then `abra` should not need to do any work.
It is important to note that `<domain>` here is a publicy accessible domain name which points to your server IP address. `abra` does make sure this is the case and this is done to avoid issues with HTTPS certificate rate limiting. It is important to note that `<domain>` here is a publicy accessible domain name which points to your server IP address. `abra` does make sure this is the case and this is done to avoid issues with HTTPS certificate rate limiting.
You will now have a new `~/.abra/` folder on your local file system which stores all the configuration of your Co-op Cloud instance. You will now have a new `~/.abra/` folder on your local file system which stores all the configuration of your Co-op Cloud instance.
@ -184,10 +183,6 @@ abra server ls
`abra` uses plain 'ol SSH under the hood and aims to make use of your existing SSH configurations in `~/.ssh/config` and interfaces with your running `ssh-agent` for password protected secret key files. `abra` uses plain 'ol SSH under the hood and aims to make use of your existing SSH configurations in `~/.ssh/config` and interfaces with your running `ssh-agent` for password protected secret key files.
The `server add` command listed above assumes that that you make SSH connections on port 22 using your current username. If that is not he case, pass the new values as positional arguments. See `abra server add -h` for more on this.
abra server add <domain> <user> <port> -p
Running `server add` with `-d/--debug` should help you debug what is going on under the hood. It's best to take a moment to read [this troubleshooting entry](/abra/trouble/#ssh-connection-issues) if you're running into SSH connection issues with `abra`. Running `server add` with `-d/--debug` should help you debug what is going on under the hood. It's best to take a moment to read [this troubleshooting entry](/abra/trouble/#ssh-connection-issues) if you're running into SSH connection issues with `abra`.
!!! question "How do I share my configs in `~/.abra`?" !!! question "How do I share my configs in `~/.abra`?"