-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add instances to Cli and enable remote vs local run configurations (#26)
* add instance flag to init command * update init and run cmds to use instance flag * moved some file path creation to use constants * init now creates local and remote config, run command only uses local config * added remote and local flags to run command * added different local vs remote binary downloads to allow for different versions for each run config * updated remote .env and added remaining binary download versions * update just build command * added instance flag to clean command * remove leading newlines * panic on failed instance name validation * update clean command help messages * remove unneeded default prints * remove cruft * alphabetize constants * move println to logging in init * runAll renamed to runRun * moved CreateDir to helpers * flag updates * fixed confusing cleanCmd name * add panic to all fatal logs * fix incorrect Infof log * readme updates * readme updates * renamed CreateDir to CreateDirOfPanic * move run configuration logic to simple switch statement * cleanup, instance flag usage updates
- Loading branch information
1 parent
786e51b
commit 7fc6e07
Showing
13 changed files
with
572 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
########################### | ||
######## conductor ######## | ||
########################### | ||
# Configuration options for the Astria Conductor | ||
|
||
# the sequencer block height that the rollup's first block was in | ||
ASTRIA_CONDUCTOR_INITIAL_SEQUENCER_BLOCK_HEIGHT=2892100 | ||
|
||
# The chain id of the chain that is being read from the astria-sequencer or the | ||
# Data Availability layer | ||
ASTRIA_CONDUCTOR_CHAIN_ID="clilocalastria" | ||
|
||
# Execution RPC URL | ||
ASTRIA_CONDUCTOR_EXECUTION_RPC_URL="http://127.0.0.1:50051" | ||
|
||
# The URL to a fully trusted CometBFT/Sequencer to issue cometbft RPCs. Example | ||
# RPCs are subscribing to new blocks, fetching blocks at a given level, or | ||
# retrieving validators. | ||
# 127.0.0.1:26657 is the default socket address in comebft's `rpc.laddr` setting. | ||
ASTRIA_CONDUCTOR_SEQUENCER_URL="wss://rpc.sequencer.dusk-3.devnet.astria.org/websocket" | ||
|
||
# Set the origin where blocks are pulled from and sent to the execution layer | ||
# Setting options: | ||
# - "SoftOnly" -> blocks are only pulled from the sequencer | ||
# - "FirmOnly" -> blocks are only pulled from DA | ||
# - "SoftAndFirm" -> blocks are pulled from both the sequencer and DA | ||
ASTRIA_CONDUCTOR_EXECUTION_COMMIT_LEVEL="SoftOnly" | ||
|
||
# Log Level | ||
ASTRIA_CONDUCTOR_LOG="astria_conductor=info" | ||
|
||
# The URL of the celestia node used to subscribe to new headers and fetch | ||
# blocks from. Note that this string need not be a fully qualified URL and | ||
# can miss the scheme part. The scheme part, if present, will be replaced by | ||
# `ws:` or `http:` for websocket subscriptions and http GET requests, | ||
# respectively. The following are examples of accepted strings (26658 is | ||
# the default port of a celestia node to listen for RPCs). | ||
# - 127.0.0.1:26658 | ||
# - ws://127.0.0.1:26658 | ||
# - http://127.0.0.1:26658 | ||
ASTRIA_CONDUCTOR_CELESTIA_NODE_URL="127.0.0.1:26658" | ||
|
||
# set to true to enable op-stack deposit derivations | ||
ASTRIA_CONDUCTOR_ENABLE_OPTIMISM=false | ||
|
||
# Websocket URL of Ethereum L1 node. | ||
# Only used if `ASTRIA_CONDUCTOR_ENABLE_OPTIMISM=true`. | ||
ASTRIA_CONDUCTOR_ETHEREUM_L1_URL="ws://127.0.0.1:8546" | ||
|
||
# The bearer token to retrieve sequencer blocks as blobs from Celestia. | ||
# The token is obtained by running `celestia bridge auth <permissions>` | ||
# on the host running the celestia node. | ||
ASTRIA_CONDUCTOR_CELESTIA_BEARER_TOKEN="<JWT Bearer token>" | ||
|
||
# If true disables writing to the opentelemetry OTLP endpoint. | ||
ASTRIA_CONDUCTOR_NO_OTEL=true | ||
|
||
# If true disables tty detection and forces writing telemetry to stdout. | ||
# If false span data is written to stdout only if it is connected to a tty. | ||
ASTRIA_CONDUCTOR_FORCE_STDOUT=true | ||
|
||
# If true uses an exceedingly pretty human readable format to write to stdout. | ||
# If false uses JSON formatted OTEL traces. | ||
# This does nothing unless stdout is connected to a tty or | ||
# `ASTRIA_CONDUCTOR_FORCE_STDOUT` is set to `true`. | ||
ASTRIA_CONDUCTOR_PRETTY_PRINT=true | ||
|
||
# If set to any non-empty value removes ANSI escape characters from the pretty | ||
# printed output. Note that this does nothing unless `ASTRIA_CONDUCTOR_PRETTY_PRINT` | ||
# is set to `true`. | ||
NO_COLOR= | ||
|
||
# Contract address of the OptimismPortal contract on L1. | ||
# Only used if `ASTRIA_CONDUCTOR_ENABLE_OPTIMISM=true`. | ||
ASTRIA_CONDUCTOR_OPTIMISM_PORTAL_CONTRACT_ADDRESS="" | ||
|
||
# The block height of the Ethereum L1 chain that the | ||
# OptimismPortal contract was deployed at. | ||
# Only used if `ASTRIA_CONDUCTOR_ENABLE_OPTIMISM=true`. | ||
ASTRIA_CONDUCTOR_INITIAL_ETHEREUM_L1_BLOCK_HEIGHT=1 | ||
|
||
# Set to true to enable prometheus metrics. | ||
ASTRIA_CONDUCTOR_NO_METRICS=true | ||
|
||
# The address at which the prometheus HTTP listener will bind if enabled. | ||
ASTRIA_CONDUCTOR_METRICS_HTTP_LISTENER_ADDR="127.0.0.1:9000" | ||
|
||
|
||
########################## | ||
######## composer ######## | ||
########################## | ||
# Configuration options of Astria Composer. | ||
|
||
# Address of the RPC server for the sequencer chain | ||
ASTRIA_COMPOSER_SEQUENCER_URL="https://rpc.sequencer.dusk-3.devnet.astria.org" | ||
|
||
# A list of execution <chain_id_1>::<rpc_server_1>,<chain_id_2>::<rpc_server_2>. | ||
# Chain IDs are not case sensitive. If an ID is repeated, the last list item is used. | ||
ASTRIA_COMPOSER_ROLLUPS="clilocalastria::ws://127.0.0.1:8546" | ||
|
||
# Log level. One of debug, info, warn, or error | ||
ASTRIA_COMPOSER_LOG="astria_composer=info" | ||
|
||
# If true disables writing to the opentelemetry OTLP endpoint. | ||
ASTRIA_COMPOSER_NO_OTEL=true | ||
|
||
# If true disables tty detection and forces writing telemetry to stdout. | ||
# If false span data is written to stdout only if it is connected to a tty. | ||
ASTRIA_COMPOSER_FORCE_STDOUT=true | ||
|
||
# If true uses an exceedingly pretty human readable format to write to stdout. | ||
# If false uses JSON formatted OTEL traces. | ||
# This does nothing unless stdout is connected to a tty or | ||
# `ASTRIA_COMPOSER_FORCE_STDOUT` is set to `true`. | ||
ASTRIA_COMPOSER_PRETTY_PRINT=true | ||
|
||
# If set to any non-empty value removes ANSI escape characters from the pretty | ||
# printed output. Note that this does nothing unless `ASTRIA_COMPOSER_PRETTY_PRINT` | ||
# is set to `true`. | ||
NO_COLOR= | ||
|
||
# Address of the API server | ||
ASTRIA_COMPOSER_API_LISTEN_ADDR="0.0.0.0:0" | ||
|
||
# Private key for the sequencer account used for signing transactions | ||
# Must be a hex-encoded 32-byte array (64-character hex string) | ||
ASTRIA_COMPOSER_PRIVATE_KEY="2bd806c97f0e00af1a1fc3328fa763a9269723c8db8fac4f93af71db186d6e90" | ||
|
||
# Block time in milliseconds, used to force submitting of finished bundles. | ||
# Should match the sequencer node configuration for 'timeout_commit', as | ||
# specified in https://docs.tendermint.com/v0.34/tendermint-core/configuration.html | ||
ASTRIA_COMPOSER_MAX_SUBMIT_INTERVAL_MS=2000 | ||
|
||
# Max bytes to encode into a single sequencer `SignedTransaction`, not including signature, | ||
# public key, nonce. This is the sum of the sizes of all the `SequenceAction`s. Should be | ||
# set below the sequencer's max block size to allow space for encoding, signature, public | ||
# key and nonce bytes | ||
ASTRIA_COMPOSER_MAX_BYTES_PER_BUNDLE=200000 | ||
|
||
# Set to true to enable prometheus metrics. | ||
ASTRIA_COMPOSER_NO_METRICS=true | ||
|
||
# The address at which the prometheus HTTP listener will bind if enabled. | ||
ASTRIA_COMPOSER_METRICS_HTTP_LISTENER_ADDR="127.0.0.1:9000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package devtools | ||
|
||
const ( | ||
DataDirName = "data" | ||
DefaultInstanceName = "default" | ||
LocalBinariesDirName = "bin-local" | ||
LocalConfigDirName = "config-local" | ||
RemoteBinariesDirName = "bin-remote" | ||
RemoteConfigDirName = "config-remote" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package devtools | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"regexp" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
func IsInstanceNameValidOrPanic(instance string) { | ||
re, err := regexp.Compile(`^[a-z]+[a-z0-9]*(-[a-z0-9]+)*$`) | ||
if err != nil { | ||
log.WithError(err).Error("Error compiling regex") | ||
panic(err) | ||
} | ||
if !re.MatchString(instance) { | ||
log.Errorf("Invalid instance name: %s", instance) | ||
err := fmt.Errorf(` | ||
Invalid instance name: '%s'. Instance names must be lowercase, alphanumeric, | ||
and may contain dashes. It can't begin or end with a dash. No repeating dashes. | ||
`, instance) | ||
panic(err) | ||
} | ||
} | ||
|
||
// CreateDirOrPanic creates a directory with the given name with 0755 permissions. | ||
// If the directory can't be created, it will panic. | ||
func CreateDirOrPanic(dirName string) { | ||
err := os.MkdirAll(dirName, 0755) | ||
if err != nil { | ||
log.WithError(err).Error("Error creating data directory") | ||
panic(err) | ||
} | ||
|
||
} |
Oops, something went wrong.