New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separating digdag-guice-rs-server from digdag-server #316
Conversation
nice, worked. dependency conflicts were the last beast. According to
@danielnorberg are you comfortable to merge this? It might be better to separate digdag-guice-rs-* (and embulk guice-bootstrap) to another repository and make them stabilized in the future once digdag doesn't need frequent changes in them. |
public RevisionAutoReloaderStarter(Config systemConfig, ProjectArchiveLoader projectLoader, ConfigFactory cf, RevisionAutoReloader autoReloader) | ||
{ | ||
this.projectDirName = systemConfig.get(SYSTEM_CONFIG_AUTO_LOAD_LOCAL_PROJECT_KEY, String.class); | ||
this.overwriteParams = cf.fromJsonString(systemConfig.get(SYSTEM_CONFIG_LOCAL_OVERWRITE_PARAMS, String.class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/overwrite/override
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh ok...overwriteParams
is used a lot in digdag's code (especially digdag-cli but also some in digdag-core such as ProjectArchiveLoader).
should all of them be replaced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. But maybe that can be a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I'll do that in another PR.
compile 'org.embulk:guice-bootstrap:0.1.0' | ||
compile 'com.fasterxml.jackson.module:jackson-module-guice:2.6.7' | ||
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.6.7' | ||
// this dependency is here only to override dependency confliction of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/confliction/conflict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops!
@@ -20,25 +21,33 @@ | |||
@JsonSerialize(as = ImmutableServerConfig.class) | |||
@JsonDeserialize(as = ImmutableServerConfig.class) | |||
public interface ServerConfig | |||
extends UndertowServerConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the fact that digdag server uses undertow be part of the public interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it's hard to abstract configuration parameters of different HTTP server implementations. Some of them are generic but not all of them. More control is more important than abstraction here in my opinion. Then if we change implementation from Undertow to something else, users will need to change config file anyways. So I think it is OK to expose "Undertow" here.
And more over, although ServerConfig is a public interface, it's not digdag-spi. In my understanding, digdag-server package is an implementation detail of digdag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Remind me, what's the purpose of this PR? Is it just refactoring to improve design/code structure? On a related note, how come we have such a bespoke http server setup instead of using something more standard like dropwizard? |
This PR is code structure refactoring so that initialization code of Undertow becomes reusable. I think it is ok to separate digdag-server from digdag-cli. Then dependency issues will be smaller. Digdag's server code is based-on JAX-RS. So, migrating to Java EE frameworks seems possible although Spring boot seems more work to adopt. KumuluzEE, Dropwizard, Payara (Micro), Restlet, TomEE, etc. |
What is the intended user of the undertow initialization code? Some other part of digdag or another project? If the intent is for the undertow initialization code to become a library reusable by other projects, then perhaps it should be broken out into a separate project without the name digdag? That can be future work in a separate PR though. I'm comfortable with merging this if you are. 👍 |
plazmadb-server is an user: https://github.com/treasure-data/plazmadb/pull/55 Having another repository is good but I'm expecting more changes. It's easier to test changes if code is in this repository. Once digdag doesn't need frequent changes, we can move them. |
Besides moving of code, there're some interface changes for isolation:
BackgroundExecutor
interface (=threads that should shutdown before stopping HTTP handlers Graceful shutdown of HTTP server and worker threads #182) is changed to@PreStop
annotation. Current code still has BackgroundExecutor interface that has only one method annotated with@PreStop
to minimize change of code. Some refactoring may be necessary later.ServerConfig
interface extendsUndertowServerConfig
interface (nothing changed actually though)DigdagEmbed.Bootstrap
has a method to returnorg.embulk.guice.Bootstrap
rather thanInjector
so thatUndertowBootstrap
can add modules before creating injector. I think that DigdagEmbed.Bootstrap should extendorg.embulk.guice.Bootstrap
but it's a refactoring that may happen later.@PostStart
handler (ServerRuntimeInfoWriter
).cli.Sched
andcli.Server
createServerBootstrap
instance rather than passingServerBootstrap.class
. This is becauseUndertowServer
takes an instance that implements new sharedServerBootstrap
interface.