Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Improve Starting Zilla with the CLI
  • Loading branch information
ankitk-me committed May 21, 2024
commit 8449aeb385ca0eba10be4ec2d682020470a88f40
Comment thread
ankitk-me marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,9 @@ private void generateLauncher() throws IOException
"if [ -n \"$ZILLA_INCUBATOR_ENABLED\" ]; then",
"JAVA_OPTIONS=\"$JAVA_OPTIONS -Dzilla.incubator.enabled=$ZILLA_INCUBATOR_ENABLED\"",
"fi",
"cd \"${0%/*}\"",
"JAVA_OPTIONS=\"$JAVA_OPTIONS -Dzilla.directory=${0%/*}\"",
Comment thread
ankitk-me marked this conversation as resolved.
Outdated
String.format(String.join(" ", Arrays.asList(
"exec %s/bin/java",
"exec \"${0%%/*}\"/%s/bin/java",
Comment thread
ankitk-me marked this conversation as resolved.
Outdated
"--add-opens java.base/sun.nio.ch=org.agrona.core",
"$JAVA_OPTIONS",
"-m io.aklivity.zilla.runtime.command/io.aklivity.zilla.runtime.command.internal.ZillaMain \"$@\"")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static io.aklivity.zilla.runtime.engine.EngineConfiguration.ENGINE_DIRECTORY;
import static io.aklivity.zilla.runtime.engine.EngineConfiguration.ENGINE_VERBOSE;
import static io.aklivity.zilla.runtime.engine.EngineConfiguration.ENGINE_WORKERS;
import static io.aklivity.zilla.runtime.engine.EngineConfiguration.ZILLA_DIRECTORY_PROPERTY;
import static java.lang.Runtime.getRuntime;
import static org.agrona.LangUtil.rethrowUnchecked;

Expand All @@ -45,7 +46,8 @@
@Command(name = "start", description = "Start engine")
public final class ZillaStartCommand extends ZillaCommand
{
private static final String OPTION_PROPERTIES_PATH_DEFAULT = ".zilla/zilla.properties";
private static final String OPTION_PROPERTIES_PATH_DEFAULT = "%s/.zilla/zilla.properties";
private static final String ZILLA_ENGINE_PATH_DEFAULT = "%s/.zilla/engine";

private final CountDownLatch stop = new CountDownLatch(1);
private final CountDownLatch stopped = new CountDownLatch(1);
Expand Down Expand Up @@ -83,9 +85,10 @@ public void run()
{
Runtime runtime = getRuntime();
Properties props = new Properties();
props.setProperty(ENGINE_DIRECTORY.name(), ".zilla/engine");
String directory = System.getProperty(ZILLA_DIRECTORY_PROPERTY, ".");
props.setProperty(ENGINE_DIRECTORY.name(), String.format(ZILLA_ENGINE_PATH_DEFAULT, directory));

Path path = Paths.get(propertiesPath != null ? propertiesPath : OPTION_PROPERTIES_PATH_DEFAULT);
Path path = Paths.get(propertiesPath != null ? propertiesPath : String.format(OPTION_PROPERTIES_PATH_DEFAULT, directory));
Comment thread
ankitk-me marked this conversation as resolved.
Outdated
if (Files.exists(path) || propertiesPath != null)
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
public class EngineConfiguration extends Configuration
{
public static final String ZILLA_NAME_PROPERTY = "zilla.name";
public static final String ZILLA_DIRECTORY_PROPERTY = "zilla.directory";

public static final boolean DEBUG_BUDGETS = Boolean.getBoolean("zilla.engine.debug.budgets");

Expand Down Expand Up @@ -82,7 +83,7 @@ public class EngineConfiguration extends Configuration
ENGINE_CONFIG_URL = config.property(URL.class, "config.url", EngineConfiguration::configURL, "file:zilla.yaml");
ENGINE_CONFIG_POLL_INTERVAL_SECONDS = config.property("config.poll.interval.seconds", 60);
ENGINE_NAME = config.property("name", EngineConfiguration::defaultName);
ENGINE_DIRECTORY = config.property("directory", ".");
ENGINE_DIRECTORY = config.property("directory", EngineConfiguration::zillaDirectory);
Comment thread
ankitk-me marked this conversation as resolved.
Outdated
ENGINE_CACHE_DIRECTORY = config.property(Path.class, "cache.directory", EngineConfiguration::cacheDirectory, "cache");
ENGINE_HOST_RESOLVER = config.property(HostResolver.class, "host.resolver",
EngineConfiguration::decodeHostResolver, EngineConfiguration::defaultHostResolver);
Expand Down Expand Up @@ -348,6 +349,12 @@ private static String defaultName(
return System.getProperty(ZILLA_NAME_PROPERTY, "zilla");
}

private static String zillaDirectory(
Configuration config)
{
return System.getProperty(ZILLA_DIRECTORY_PROPERTY, ".");
}

private static HostResolver decodeHostResolver(
Configuration config,
String value)
Expand Down