Small fixes to documentation and various small bugs

This commit is contained in:
Brian Picciano 2022-11-05 13:57:21 +01:00
parent c0ebca193d
commit e9ac1336ba
6 changed files with 36 additions and 25 deletions

View File

@ -73,7 +73,7 @@ storage:
#
# Once assigned (either implicitly or explicitly) the rpc_port of an
# allocation should not be changed.
allocations:
#allocations:
#- data_path: /foo/bar/data
# meta_path: /foo/bar/meta

View File

@ -104,9 +104,9 @@ you can run:
```
sudo cryptic-net admin create-network \
--config /path/to/daemon.yml \
--config-path /path/to/daemon.yml \
--name <name> \
--ip <ip/subnet-prefix> \
--ip-net <ip/subnet-prefix> \
--domain <domain> \
--hostname <hostname> \
| gpg -e -r <my gpg email> \
@ -115,9 +115,9 @@ sudo cryptic-net admin create-network \
A couple of notes here:
* The `--ip` parameter is formed from both the subnet and the IP you chose
* The `--ip-net` parameter is formed from both the subnet and the IP you chose
within it. So if your subnet is `10.10.0.0/16`, and your chosen IP in that
subnet is `10.10.4.20`, then your `--ip` parameter will be `10.10.4.20/16`.
subnet is `10.10.4.20`, then your `--ip-net` parameter will be `10.10.4.20/16`.
* Only one gpg recipient is specified. If you intend on including other users as
network administrators you can add them to the recipients list at this step,

View File

@ -20,10 +20,10 @@ parameters. Feel free to edit this file as needed.
## Using daemon.yml
With the `daemon.yml` created and configured, you can configure your daemon
process to use it by passing it as the `-c` argument:
process to use it by passing it as the `--config-path` argument:
```
sudo cryptic-net daemon -c /path/to/daemon.yml
sudo cryptic-net daemon --config-path /path/to/daemon.yml
```
If you are an operator then your host should be running its `cryptic-net daemon`

View File

@ -9,7 +9,7 @@ import (
// NebulaHost describes the nebula configuration of a Host which is relevant for
// other hosts to know.
type NebulaHost struct {
CertPEM string `yaml:"crt"`
CertPEM string `yaml:"cert_pem"`
PublicAddr string `yaml:"public_addr,omitempty"`
}

View File

@ -135,8 +135,12 @@ func runDaemonPmuxOnce(
}
err := doOnce(ctx, func(ctx context.Context) error {
fmt.Fprintln(os.Stderr, "updating host info in garage")
return hostBootstrap.PutGarageBoostrapHost(ctx)
if err := hostBootstrap.PutGarageBoostrapHost(ctx); err != nil {
fmt.Fprintf(os.Stderr, "updating host info in garage: %v\n", err)
return err
}
return nil
})
if err != nil {
@ -155,8 +159,12 @@ func runDaemonPmuxOnce(
}
err := doOnce(ctx, func(ctx context.Context) error {
fmt.Fprintln(os.Stderr, "applying garage layout")
return garageApplyLayout(ctx, hostBootstrap, daemonConfig)
if err := garageApplyLayout(ctx, hostBootstrap, daemonConfig); err != nil {
fmt.Fprintf(os.Stderr, "applying garage layout: %v\n", err)
return err
}
return nil
})
if err != nil {
@ -234,9 +242,8 @@ var subCmdDaemon = subCmd{
bootstrapDataDirPath = bootstrap.DataDirPath(envDataDirPath)
bootstrapAppDirPath = bootstrap.AppDirPath(envAppDirPath)
hostBootstrapPath string
hostBootstrap bootstrap.Bootstrap
foundHostBootstrap bool
hostBootstrapPath string
hostBootstrap bootstrap.Bootstrap
)
tryLoadBootstrap := func(path string) bool {
@ -245,6 +252,7 @@ var subCmdDaemon = subCmd{
return false
} else if hostBootstrap, err = bootstrap.FromFile(path); errors.Is(err, fs.ErrNotExist) {
fmt.Fprintf(os.Stderr, "bootstrap file not found at %q\n", path)
err = nil
return false
@ -253,21 +261,22 @@ var subCmdDaemon = subCmd{
return false
}
fmt.Fprintf(os.Stderr, "bootstrap file found at %q\n", path)
hostBootstrapPath = path
return true
}
foundHostBootstrap = tryLoadBootstrap(bootstrapDataDirPath)
foundHostBootstrap = !foundHostBootstrap && *bootstrapPath != "" && tryLoadBootstrap(*bootstrapPath)
foundHostBootstrap = !foundHostBootstrap && tryLoadBootstrap(bootstrapAppDirPath)
if err != nil {
switch {
case tryLoadBootstrap(bootstrapDataDirPath):
case *bootstrapPath != "" && tryLoadBootstrap(*bootstrapPath):
case tryLoadBootstrap(bootstrapAppDirPath):
case err != nil:
return fmt.Errorf("attempting to load bootstrap.yml file: %w", err)
} else if !foundHostBootstrap {
default:
return errors.New("No bootstrap.yml file could be found, and one is not provided with --bootstrap-path")
}
} else if hostBootstrapPath != bootstrapDataDirPath {
if hostBootstrapPath != bootstrapDataDirPath {
// If the bootstrap file is not being stored in the data dir, copy
// it there, so it can be loaded from there next time.

View File

@ -32,8 +32,10 @@ no-hosts
user=
group=
{{- range $host := .Hosts }}
address=/{{ $host.Name }}.hosts.{{ .Domain }}/{{ $host.Nebula.IP }}
{{- $domain := . -}}
{{- range .Hosts }}
address=/{{ .Name }}.hosts.{{ $domain }}/{{ .IP }}
{{ end -}}
{{- range .Resolvers }}