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

Add HTTP proxy, multiple connections to client, clustering to server #11

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
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
Prev Previous commit
Next Next commit
Update main method to use cluster mode
  • Loading branch information
seanf committed Oct 31, 2017
commit c19c42ddc3e2ecc4bcb22202eee72fc2a0a1dbf3
5 changes: 5 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ plugins {
dependencies {
compile project(':common')
compile 'de.svenkubiak:jBCrypt:0.4.1'
runtime 'io.vertx:vertx-infinispan:3.5.0'
// // http://vertx.io/docs/vertx-infinispan/java/#_configuring_for_kubernetes_or_openshift_3
runtime 'org.infinispan:infinispan-cloud:9.1.2.Final'
}

mainClassName = 'io.vertx.core.Launcher'
Expand Down Expand Up @@ -37,11 +40,13 @@ shadowJar {
classifier = 'fat'

manifest {
attributes "Main-Class": "io.vertx.core.Launcher"
attributes "Main-Verticle": mainVerticleName
}

mergeServiceFiles {
include 'META-INF/services/io.vertx.core.spi.VerticleFactory'
include 'META-INF/services/io.vertx.core.spi.cluster.ClusterManager'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package org.zanata.proxyhook.server

import io.vertx.core.Future
import io.vertx.core.Vertx
import io.vertx.core.VertxOptions
import org.mindrot.jbcrypt.BCrypt
import io.vertx.core.buffer.Buffer
import io.vertx.core.eventbus.EventBus
Expand Down Expand Up @@ -92,12 +93,24 @@ class ProxyHookServer(
var actualPort: Future<Int>? = null) : CoroutineVerticle() {

companion object {
// Try these JVM arguments: -Djava.net.preferIPv4Stack=true -Djgroups.bind_addr=127.0.0.1
@JvmStatic fun main(args: Array<String>) {
Vertx.vertx().deployVerticle(ProxyHookServer(port = null), { result ->
result.otherwise { e ->
exit(e)
Vertx.clusteredVertx(VertxOptions().apply {
// clusterHost = "localhost"
// clusterPort = 0
// isClustered = true
}) { res ->
if (res.succeeded()) {
res.result().deployVerticle(ProxyHookServer(port = null), { result ->
result.otherwise { e ->
exit(e)
}
}
)
} else {
exit(res.cause())
}
})
}
}
}
private inner class ConnectionManager(val connections: AsyncMap<String, Boolean>, val connectionCount: Counter)
Expand Down