Skip to content
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

Unix socket support #1278

Closed
AdamantGarth opened this issue Mar 4, 2024 · 2 comments
Closed

Unix socket support #1278

AdamantGarth opened this issue Mar 4, 2024 · 2 comments

Comments

@AdamantGarth
Copy link

Is your feature request related to a problem? Please describe.
Dropwizard seems to support unix sockets, but attempting to use them in Commafeed's config.yml results in an error:

io.dropwizard.configuration.ConfigurationParsingException: config.yml has an error:
  * Failed to parse configuration at: server.applicationConnectors.[0]; Could not resolve type id 'unix-socket' as a subtype of `io.dropwizard.jetty.ConnectorFactory`: known type ids = [http, https] (for POJO property 'applicationConnectors')
 at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.commafeed.CommaFeedConfiguration["server"]->io.dropwizard.core.server.DefaultServerFactory["applicationConnectors"]->java.util.ArrayList[0])
        at io.dropwizard.configuration.ConfigurationParsingException$Builder.build(ConfigurationParsingException.java:277)
        at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:177)
        at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:94)
        at io.dropwizard.core.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:139)
        at io.dropwizard.core.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
        at io.dropwizard.core.cli.Cli.run(Cli.java:78)
        at io.dropwizard.core.Application.run(Application.java:94)
        at com.commafeed.CommaFeedApplication.main(CommaFeedApplication.java:275)
Caused by: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'unix-socket' as a subtype of `io.dropwizard.jetty.ConnectorFactory`: known type ids = [http, https] (for POJO property 'applicationConnectors')
 at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.commafeed.CommaFeedConfiguration["server"]->io.dropwizard.core.server.DefaultServerFactory["applicationConnectors"]->java.util.ArrayList[0])
        at com.fasterxml.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:43)
        at com.fasterxml.jackson.databind.DeserializationContext.invalidTypeIdException(DeserializationContext.java:2040)
        at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownTypeId(DeserializationContext.java:1590)
        at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._handleUnknownTypeId(TypeDeserializerBase.java:298)
        at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:165)
        at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:151)
        at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:136)
        at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:263)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:361)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
        at com.fasterxml.jackson.module.blackbird.deser.SettableObjectProperty.deserializeAndSet(SettableObjectProperty.java:44)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:215)
        at com.fasterxml.jackson.module.blackbird.deser.SuperSonicBeanDeserializer.deserialize(SuperSonicBeanDeserializer.java:120)
        at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedUsingDefaultImpl(AsPropertyTypeDeserializer.java:226)
        at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:145)
        at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:263)
        at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:138)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:273)
        at com.fasterxml.jackson.module.blackbird.deser.SuperSonicBeanDeserializer.deserialize(SuperSonicBeanDeserializer.java:155)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342)
        at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:4875)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3033)
        at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:148)
        ... 6 more

Describe the solution you'd like
If it's easy to enable Dropwizard's support for unix sockets in Commafeed, I'd like that :)

Describe alternatives you've considered
Regular TCP sockets are fine, but not as tidy as unix sockets for my use case.

Additional context
I want to run Commafeed using systemd's socket activation feature. This requires opening multiple ports, as Commafeed (I assume) doesn't support systemd socket activation natively. One port is for Commafeed itself, and the second one is for socket-activated proxy). It would be neat if Commafeed's port could be a unix socket instead, hidden in commafeed directory, instead of being a second global TCP port.

Athou added a commit that referenced this issue Mar 4, 2024
@Athou
Copy link
Owner

Athou commented Mar 4, 2024

Dropwizard unix sockets support was in a separate dependency. I added it in 34db9ba could you try again please (either from sources, with the jar that was built here, or the master Docker tag)?

@AdamantGarth
Copy link
Author

Tried the jar from CI, worked like a charm. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants