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 # Once assigned (either implicitly or explicitly) the rpc_port of an
# allocation should not be changed. # allocation should not be changed.
allocations: #allocations:
#- data_path: /foo/bar/data #- data_path: /foo/bar/data
# meta_path: /foo/bar/meta # meta_path: /foo/bar/meta

View File

@ -104,9 +104,9 @@ you can run:
``` ```
sudo cryptic-net admin create-network \ sudo cryptic-net admin create-network \
--config /path/to/daemon.yml \ --config-path /path/to/daemon.yml \
--name <name> \ --name <name> \
--ip <ip/subnet-prefix> \ --ip-net <ip/subnet-prefix> \
--domain <domain> \ --domain <domain> \
--hostname <hostname> \ --hostname <hostname> \
| gpg -e -r <my gpg email> \ | gpg -e -r <my gpg email> \
@ -115,9 +115,9 @@ sudo cryptic-net admin create-network \
A couple of notes here: 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 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 * 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, 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 ## Using daemon.yml
With the `daemon.yml` created and configured, you can configure your daemon 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` 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 // NebulaHost describes the nebula configuration of a Host which is relevant for
// other hosts to know. // other hosts to know.
type NebulaHost struct { type NebulaHost struct {
CertPEM string `yaml:"crt"` CertPEM string `yaml:"cert_pem"`
PublicAddr string `yaml:"public_addr,omitempty"` PublicAddr string `yaml:"public_addr,omitempty"`
} }

View File

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

View File

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