Compare commits

..

No commits in common. "0a6516b44ec6889cfbd0ed557cd885060b89c375" and "877e5198212190c019000685ccc7677b1e0e57c6" have entirely different histories.

7 changed files with 29 additions and 40 deletions

View File

@ -58,19 +58,21 @@ storage:
# network. If no allocations are defined then no data is replicated to this
# node.
#
# Each allocation should have its own data/meta directories, separate from the
# other allocations.
#
# The data directory of each allocation should be on a different drive, while
# the meta directories can be anywhere (ideally on an SSD).
#
# Capacity declares how many gigabytes can be stored in each allocation, and
# is required. It must be a multiple of 100.
#
# The ports are all _optional_, and will be automatically assigned if they are
# The ports are all required and must all be unique within and across
# allocations.
#
# THe ports are all _optional_, and will be automatically assigned if they are
# not specified. If ports any ports are specified then all should be
# specified, and each should be unique across all allocations.
#
# Once assigned (either implicitly or explicitly) the rpc_port of an
# allocation should not be changed.
#allocations:
#- data_path: /foo/bar/data

View File

@ -2,7 +2,6 @@
pkgsAttrs ? (import ./nix/pkgs.nix),
bootstrap ? null,
releaseName ? "debug",
}: let
@ -28,7 +27,7 @@ in rec {
buildInputs = [ pkgs.git pkgs.go ];
src = ./.;
inherit bootstrap releaseName;
inherit bootstrap;
nixPkgsVersion = pkgsAttrs.version;
nixPkgsRev = pkgsAttrs.rev;
builtByUser = builtins.getEnv "USER";
@ -45,7 +44,6 @@ in rec {
echo "Built for host: $hostName" >> "$versionFile"
fi
echo "Release: $releaseName" >> "$versionFile"
echo "Build date: $(date) ($(date +%s))" >> "$versionFile"
echo "Built by: $builtByUser" >> "$versionFile"
echo "Git rev: $(cd srcCp && git describe --always --long --dirty=' (dirty)')" >> "$versionFile"
@ -97,22 +95,24 @@ in rec {
source $stdenv/setup
cp -rL "$src" cryptic-net
chmod +w cryptic-net -R
appimagetool cryptic-net "$out"
mkdir $out
appimagetool cryptic-net "$out/cryptic-net"
'';
};
release = pkgs.stdenv.mkDerivation {
name = "cryptic-net-AppImage";
inherit appImage releaseName;
service = pkgs.writeText "cryptic-service" ''
[Unit]
Description=cryptic nebula
Requires=network.target
After=network.target
buildInputs = [ pkgs.coreutils ];
[Service]
Restart=always
RestartSec=1s
User=root
ExecStart=${appImage}/cryptic-net
builder = builtins.toFile "build.sh" ''
source $stdenv/setup
mkdir -p "$out"
cp "$appImage" "$out"/cryptic-net-$releaseName-linux-amd64
(cd "$out" && sha256sum * > sha256.txt)
'';
};
[Install]
WantedBy=multi-user.target
'';
}

View File

@ -105,7 +105,7 @@ func (b Bootstrap) GetGarageBootstrapHosts(
for objInfo := range objInfoCh {
ctx := mctx.Annotate(ctx, "objectKey", objInfo.Key)
ctx := mctx.Annotate(ctx, "object-key", objInfo.Key)
if objInfo.Err != nil {
return nil, fmt.Errorf("listing objects: %w", objInfo.Err)

View File

@ -268,7 +268,7 @@ var subCmdDaemon = subCmd{
}
logger.Info(
mctx.Annotate(ctx, "bootstrapFilePath", path),
mctx.Annotate(ctx, "bootstrap-file-path", path),
"bootstrap file found",
)

View File

@ -11,12 +11,11 @@ import (
"strconv"
"code.betamike.com/cryptic-io/pmux/pmuxlib"
"github.com/mediocregopher/mediocre-go-lib/v2/mctx"
"github.com/mediocregopher/mediocre-go-lib/v2/mlog"
)
func garageAdminClientLogger(logger *mlog.Logger) *mlog.Logger {
return logger.WithNamespace("garageAdminClient")
return logger.WithNamespace("garage-admin-client")
}
// newGarageAdminClient will return an AdminClient for a local garage instance,
@ -58,7 +57,7 @@ func waitForGarageAndNebula(
return nil
}
adminClientLogger := garageAdminClientLogger(logger)
logger = garageAdminClientLogger(logger)
for _, alloc := range allocs {
@ -70,12 +69,9 @@ func waitForGarageAndNebula(
adminClient := garage.NewAdminClient(
adminAddr,
hostBootstrap.Garage.AdminToken,
adminClientLogger,
logger,
)
ctx := mctx.Annotate(ctx, "garageAdminAddr", adminAddr)
logger.Debug(ctx, "wating for garage instance to start")
if err := adminClient.Wait(ctx); err != nil {
return fmt.Errorf("waiting for garage instance %q to start up: %w", adminAddr, err)
}
@ -275,7 +271,7 @@ func garageApplyLayout(
}
clusterLayout[id] = peerLayout{
Capacity: alloc.Capacity,
Capacity: alloc.Capacity / 100,
Zone: zone,
Tags: []string{},
}

View File

@ -49,7 +49,7 @@ func writeLock() error {
// returns a cleanup function which will clean up the created runtime directory.
func setupAndLockRuntimeDir(ctx context.Context, logger *mlog.Logger) (func(), error) {
ctx = mctx.Annotate(ctx, "runtimeDirPath", envRuntimeDirPath)
ctx = mctx.Annotate(ctx, "runtime-dir-path", envRuntimeDirPath)
logger.Info(ctx, "will use runtime directory for temporary state")
if err := os.MkdirAll(envRuntimeDirPath, 0700); err != nil {

View File

@ -10,7 +10,6 @@ import (
"net/http/httputil"
"time"
"github.com/mediocregopher/mediocre-go-lib/v2/mctx"
"github.com/mediocregopher/mediocre-go-lib/v2/mlog"
)
@ -150,7 +149,6 @@ func (c *AdminClient) Wait(ctx context.Context) error {
return ctxErr
} else if err != nil {
c.logger.Warn(ctx, "waiting for instance to become ready", err)
continue
}
@ -162,16 +160,9 @@ func (c *AdminClient) Wait(ctx context.Context) error {
}
}
ctx := mctx.Annotate(ctx,
"numKnownNodes", len(clusterStatus.KnownNodes),
"numUp", numUp,
)
if numUp >= ReplicationFactor-1 {
c.logger.Debug(ctx, "instance appears to be online")
return nil
}
c.logger.Debug(ctx, "instance not online yet, will continue waiting")
}
}