Compare commits
No commits in common. "97d4aacc15a59126d533fbbc2d9bb30fe779ed27" and "d916d1a6300dfbcb9e0b52c1ba4b351d6856b192" have entirely different histories.
97d4aacc15
...
d916d1a630
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,4 @@
|
|||||||
*-bin
|
*-bin
|
||||||
*admin.yml*
|
*-admin.tgz*
|
||||||
*bootstrap.yml*
|
*-bootstrap.tgz
|
||||||
result
|
result
|
||||||
|
@ -43,7 +43,7 @@ To create a `bootstrap.yml` file for the new host, the admin should perform the
|
|||||||
following command from their own host:
|
following command from their own host:
|
||||||
|
|
||||||
```
|
```
|
||||||
cryptic-net hosts create-bootstrap \
|
cryptic-net hosts make-bootstrap \
|
||||||
--hostname <name> \
|
--hostname <name> \
|
||||||
--ip <ip> \
|
--ip <ip> \
|
||||||
--admin-path <path to admin.yml> \
|
--admin-path <path to admin.yml> \
|
||||||
@ -61,12 +61,12 @@ running their host's `cryptic-net daemon`.
|
|||||||
### Encrypted `admin.yml`
|
### Encrypted `admin.yml`
|
||||||
|
|
||||||
If `admin.yml` is kept in an encrypted format on disk (it should be!) then the
|
If `admin.yml` is kept in an encrypted format on disk (it should be!) then the
|
||||||
decrypted form can be piped into `create-bootstrap` over stdin. For example, if
|
decrypted form can be piped into `make-bootstrap` over stdin. For example, if
|
||||||
GPG is being used to secure `admin.yml` then the following could be used to
|
GPG is being used to secure `admin.yml` then the following could be used to
|
||||||
generate a `bootstrap.yml`:
|
generate a `bootstrap.yml`:
|
||||||
|
|
||||||
```
|
```
|
||||||
gpg -d <path to admin.yml.gpg> | cryptic-net hosts create-bootstrap \
|
gpg -d <path to admin.yml.gpg> | cryptic-net hosts make-boostrap \
|
||||||
--hostname <name> \
|
--hostname <name> \
|
||||||
--ip <ip> \
|
--ip <ip> \
|
||||||
--admin-path - \
|
--admin-path - \
|
||||||
|
@ -11,6 +11,10 @@ func (b Bootstrap) GaragePeers() []garage.RemotePeer {
|
|||||||
|
|
||||||
for _, host := range b.Hosts {
|
for _, host := range b.Hosts {
|
||||||
|
|
||||||
|
if host.Garage == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
for _, instance := range host.Garage.Instances {
|
for _, instance := range host.Garage.Instances {
|
||||||
|
|
||||||
peer := garage.RemotePeer{
|
peer := garage.RemotePeer{
|
||||||
@ -45,7 +49,7 @@ func (b Bootstrap) ChooseGaragePeer() garage.RemotePeer {
|
|||||||
|
|
||||||
thisHost := b.ThisHost()
|
thisHost := b.ThisHost()
|
||||||
|
|
||||||
if len(thisHost.Garage.Instances) > 0 {
|
if thisHost.Garage != nil && len(thisHost.Garage.Instances) > 0 {
|
||||||
|
|
||||||
inst := thisHost.Garage.Instances[0]
|
inst := thisHost.Garage.Instances[0]
|
||||||
return garage.RemotePeer{
|
return garage.RemotePeer{
|
||||||
|
@ -60,7 +60,7 @@ type GarageHost struct {
|
|||||||
type Host struct {
|
type Host struct {
|
||||||
Name string `yaml:"name"`
|
Name string `yaml:"name"`
|
||||||
Nebula NebulaHost `yaml:"nebula"`
|
Nebula NebulaHost `yaml:"nebula"`
|
||||||
Garage GarageHost `yaml:"garage,omitempty"`
|
Garage *GarageHost `yaml:"garage,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// IP returns the IP address encoded in the Host's nebula certificate, or panics
|
// IP returns the IP address encoded in the Host's nebula certificate, or panics
|
||||||
|
@ -245,8 +245,8 @@ var subCmdAdminCreateNetwork = subCmd{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var subCmdAdminCreateBootstrap = subCmd{
|
var subCmdAdminMakeBootstrap = subCmd{
|
||||||
name: "create-bootstrap",
|
name: "make-bootstrap",
|
||||||
descr: "Creates a new bootstrap.yml file for a particular host and writes it to stdout",
|
descr: "Creates a new bootstrap.yml file for a particular host and writes it to stdout",
|
||||||
checkLock: true,
|
checkLock: true,
|
||||||
do: func(subCmdCtx subCmdCtx) error {
|
do: func(subCmdCtx subCmdCtx) error {
|
||||||
@ -335,7 +335,7 @@ var subCmdAdmin = subCmd{
|
|||||||
do: func(subCmdCtx subCmdCtx) error {
|
do: func(subCmdCtx subCmdCtx) error {
|
||||||
return subCmdCtx.doSubCmd(
|
return subCmdCtx.doSubCmd(
|
||||||
subCmdAdminCreateNetwork,
|
subCmdAdminCreateNetwork,
|
||||||
subCmdAdminCreateBootstrap,
|
subCmdAdminMakeBootstrap,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ func mergeDaemonConfigIntoBootstrap(
|
|||||||
|
|
||||||
if allocs := daemonConfig.Storage.Allocations; len(allocs) > 0 {
|
if allocs := daemonConfig.Storage.Allocations; len(allocs) > 0 {
|
||||||
|
|
||||||
|
host.Garage = new(bootstrap.GarageHost)
|
||||||
|
|
||||||
for _, alloc := range allocs {
|
for _, alloc := range allocs {
|
||||||
|
|
||||||
id, err := garage.InitAlloc(alloc.MetaPath)
|
id, err := garage.InitAlloc(alloc.MetaPath)
|
||||||
|
@ -38,24 +38,8 @@ var subCmdHostsList = subCmd{
|
|||||||
return fmt.Errorf("retrieving hosts from garage: %w", err)
|
return fmt.Errorf("retrieving hosts from garage: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
type host struct {
|
hosts := make([]bootstrap.Host, 0, len(hostsMap))
|
||||||
Name string `yaml:"name"`
|
for _, host := range hostsMap {
|
||||||
Nebula struct {
|
|
||||||
IP string `yaml:"ip"`
|
|
||||||
} `yaml:"nebula"`
|
|
||||||
Garage bootstrap.GarageHost `yaml:"garage,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
hosts := make([]host, 0, len(hostsMap))
|
|
||||||
for _, h := range hostsMap {
|
|
||||||
|
|
||||||
host := host{
|
|
||||||
Name: h.Name,
|
|
||||||
Garage: h.Garage,
|
|
||||||
}
|
|
||||||
|
|
||||||
host.Nebula.IP = h.IP().String()
|
|
||||||
|
|
||||||
hosts = append(hosts, host)
|
hosts = append(hosts, host)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user