Skip to content

Commit

Permalink
separate HOME for bakers
Browse files Browse the repository at this point in the history
  • Loading branch information
cryi committed Nov 3, 2024
1 parent 8853b1d commit 16435f1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configuration/services/template/baker.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
executable: octez-baker-${PROTOCOL_SHORT}
args: ${BAKER_ARGS}
environment: {
HOME: ${HOME}
HOME: ${BAKERS_HOME}
TEZOS_LOG: "* -> info"
}
restart: always
Expand Down
12 changes: 12 additions & 0 deletions src/box/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ local function inject_ascend_services(protocol, bakers, options)
PROTOCOL_HASH = protocol.hash,
SANDBOX_FILE = path.combine(protocol.path, constants.sandboxParametersFileId),
HOME = env.homeDirectory,
BAKERS_HOME = env.bakersHomeDirectory,
VOTE_FILE = path.combine(protocol.path, constants.voteFileId),
USER = env.user,
}
Expand Down Expand Up @@ -330,6 +331,17 @@ function core.initialize(protocol, options)
inject_ascend_services(proto, bakerAccounts, { withDal = options.withDal })
end

-- copy .tezos-client from homeDirectory to bakersHomeDirectory
local octezClientPath = path.combine(env.homeDirectory, ".tezos-client")
local octezClientTargetPath = path.combine(env.bakersHomeDirectory, ".tezos-client")
local ok, err = fs.safe_copy(octezClientPath, octezClientTargetPath, { overwrite = true, ignore = function (path)
return path:match("logs")
end })
if not ok then
log_error("failed to copy .tezos-client to " .. octezClientTargetPath .. " - error: " .. tostring(err))
os.exit(1)
end

if options.withDal and not octez.dal.install_trusted_setup() then
log_error("failed to install dal trusted setup")
os.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions src/box/env.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local args = require "util.args"
local tezboxDirectory = os.getenv("TEZBOX_DIRECTORY") or "/tezbox"
local tezboxContextDirectory = path.combine(tezboxDirectory, "context")
local tezboxDataDirectory = path.combine(tezboxContextDirectory, "data")
local tezboxBakersHomeDirectory = path.combine(tezboxDataDirectory, "bakers-home")
local defaultEnv = {
tezboxDirectory = tezboxDirectory,
configurationDirectory = path.combine(tezboxDirectory, "configuration"),
Expand All @@ -11,6 +12,7 @@ local defaultEnv = {

-- octez directories
homeDirectory = tezboxDataDirectory,
bakersHomeDirectory = tezboxBakersHomeDirectory,

octezNodeBinary = "octez-node",
octezClientBinary = "octez-client",
Expand All @@ -26,6 +28,7 @@ local env = util.merge_tables({
contextDirectory = args.options["context-directory"] or env.get_env("CONTEXT_DIRECTORY"),

homeDirectory = args.options["home-directory"] or env.get_env("HOME_DIRECTORY"),
bakersHomeDirectory = args.options["bakers-home-directory"] or env.get_env("BAKERS_HOME_DIRECTORY"),

octezNodeBinary = args.options["octez-node-binary"] or env.get_env("OCTEZ_NODE_BINARY"),
octezClientBinary = args.options["octez-client-binary"] or env.get_env("OCTEZ_CLIENT_BINARY"),
Expand All @@ -37,5 +40,6 @@ fs.mkdirp(env.configurationDirectory)
fs.mkdirp(env.configurationOverridesDirectory)
fs.mkdirp(env.contextDirectory)
fs.mkdirp(env.homeDirectory)
fs.mkdirp(env.bakersHomeDirectory)

return env
2 changes: 1 addition & 1 deletion src/version-info.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local TEZBOX_VERSIOn = "0.4.1"
local TEZBOX_VERSIOn = "0.4.2"

return {
VERSION = TEZBOX_VERSIOn,
Expand Down

0 comments on commit 16435f1

Please sign in to comment.