Initial version of Vert.X gateway image
ADD
gateway-vertx/Dockerfile
+FROM jboss/base-jdk:8
+LABEL maintainter="jcechace@redhat.com>" \
+ description="Vert.X implementation of Apiman Gateway" \
+ version="1.0" \
+ apiman.verson="1.3.1.Final" \
+ apiman.component="gateway" \
+ apiman.platform="verx"
+
+
+ENV JBOSS_HOME="/opt/jboss"
+ENV APIMAN_VERSION="1.3.1.Final"
+ENV APIMAN_HOME="${JBOSS_HOME}/apiman"
+ENV APIMAN_CONFIG="${APIMAN_HOME}/configs/conf-container.json"
+ENV APIMAN_REGISTRY_URI="file:///${APIMAN_HOME}/configs/registry.json"
+
+RUN cd ${JBOSS_HOME} \
+ && curl -L http://downloads.jboss.org/apiman/${APIMAN_VERSION}/apiman-distro-vertx-${APIMAN_VERSION}.zip | bsdtar -xvf- \
+ && mv ${JBOSS_HOME}/apiman-distro-vertx-${APIMAN_VERSION} ${APIMAN_HOME} \
+ && cd ${APIMAN_HOME} \
+ && rm -rf configs \
+ && chmod +x apiman-gateway.sh
+
+
+COPY configs/ ${APIMAN_HOME}/configs/
+
+USER root
+
+RUN chown -R jboss:0 ${JBOSS_HOME} \
+ && chmod -R g+rw ${JBOSS_HOME}
+
+USER jboss
+
+VOLUME ${APIMAN_HOME}/configs/
+
+EXPOSE 8080
+EXPOSE 8081
+
+ENTRYPOINT ${APIMAN_HOME}/apiman-gateway.sh -conf "${APIMAN_CONFIG}"
+
+
+

ADD
gateway-vertx/configs/conf-container.json
+{
+ "variables": {
+ "apiman" : {
+ "es": {
+ "protocol": "${APIMAN_ES_PROTOCOL:-http}",
+ "host": "${APIMAN_ES_HOST:-localhost}",
+ "port": "${APIMAN_ES_PORT:-9200}",
+ "username": null,
+ "password": null,
+ "timeout": "${APIMAN_ES_TIMEOUT:-10000}"
+ }
+ }
+ },
+
+ "registry": {
+ "class": "io.apiman.gateway.engine.vertx.polling.URILoadingRegistry",
+ "config": {
+ // Path to your apiman JSON config; refer to apiman's documentation for format description.
+ // Supports: file, HTTP & HTTPS.
+ "configUri": "${APIMAN_REGISTRY_URI}",
+ // For HTTP/HTTPS auth is supported: BASIC, OAUTH2, KEYCLOAKOAUTH2
+ // For more detail refer to the apiman documentation.
+ "auth": "NONE"
+ }
+ },
+
+ // Gateway error writer
+ // A "trace" version of the error writer - comment out/remove this to suppress stack traces
+ // in the JSON/XML payload returned by the gateway when an error occurs.
+ "writers": {
+ "error": {
+ "class": "io.apiman.gateway.engine.impl.TracePolicyErrorWriter",
+ "config": {}
+ }
+ },
+
+ "encrypter": {
+ "class": "io.apiman.gateway.engine.impl.DefaultDataEncrypter",
+ "config": {}
+ },
+
+ "plugin-registry": {
+ "class": "io.apiman.gateway.platforms.vertx3.engine.VertxPluginRegistry",
+ "config": {}
+ },
+
+ "connector-factory": {
+ "class": "io.apiman.gateway.platforms.vertx3.connector.ConnectorFactory",
+ "config": {
+ // -----------------------------------------------
+ // SSL/TLS settings for the gateway connector(s).
+ // -----------------------------------------------
+ "tls": {
+ // Enable devMode for HTTPS connections (gateway trusts any certificate).
+ // This should *NOT* be used in production mode. *Use with great care.*
+ "devMode": "false",
+
+ // Whether self-signed certificates should be automatically trusted. *Use with great care.*
+ "allowSelfSigned": "${APIMAN_SSL_BACKEND_SELF_SIGNED:-false}"
+
+ // // Whether certificate host checks should be bypassed. *Use with great care.*
+ // "allowAnyHost": "${APIMAN_SSL_BACKEND_ANY_HOST:-false}",
+
+ // // Trust store contains certificate(s) trusted by gateway.
+ // "trustStore": "${APIMAN_SSL_BACKEND_TS}",
+ // "trustStorePassword": "${APIMAN_SSL_BACKEND_TS_PASSWORD}"
+
+ // // Key store contains gateway's keys (including private components: keep it safe).
+ // "keyStore": "${APIMAN_SSL_BACKEND_KS}",
+ // "keyStorePassword": "${APIMAN_SSL_BACKEND_KS_PASSWORD}"
+ }
+ }
+ },
+
+ "policy-factory": {
+ "class": "io.apiman.gateway.engine.policy.PolicyFactoryImpl",
+ "config": {}
+ },
+
+ "logger-factory": {
+ "class": "io.apiman.gateway.platforms.vertx3.logging.VertxLoggerDelegate",
+ "config": {}
+ },
+
+ // Elasticsearch Metrics Settings
+ "metrics": {
+ "class": "io.apiman.gateway.engine.es.ESMetrics",
+ "config": {
+ "client": {
+ "type": "jest",
+ "protocol": "${apiman.es.protocol}",
+ "host": "${apiman.es.host}",
+ "port": "${apiman.es.port}",
+ "initialize": true,
+ "username": "${apiman.es.username}",
+ "password": "${apiman.es.password}",
+ "timeout": "${apiman.es.timeout}"
+ }
+ }
+ },
+
+ "components": {
+ // Shared State Component Settings
+ "ISharedStateComponent": {
+ "class": "io.apiman.gateway.engine.es.ESSharedStateComponent",
+ "config": {
+ "client": {
+ "type": "jest",
+ "protocol": "${apiman.es.protocol}",
+ "host": "${apiman.es.host}",
+ "port": "${apiman.es.port}",
+ "initialize": true,
+ "username": "${apiman.es.username}",
+ "password": "${apiman.es.password}",
+ "timeout": "${apiman.es.timeout}"
+ }
+ }
+ },
+
+ // Rate Limiter Component Settings
+ "IRateLimiterComponent": {
+ "class": "io.apiman.gateway.engine.es.ESRateLimiterComponent",
+ "config": {
+ "client": {
+ "type": "jest",
+ "protocol": "${apiman.es.protocol}",
+ "host": "${apiman.es.host}",
+ "port": "${apiman.es.port}",
+ "initialize": true,
+ "username": "${apiman.es.username}",
+ "password": "${apiman.es.password}",
+ "timeout": "${apiman.es.timeout}"
+ }
+ }
+ },
+
+ // Cache Store Component Settings
+ "ICacheStoreComponent": {
+ "class": "io.apiman.gateway.engine.es.ESCacheStoreComponent",
+ "config": {
+ "client": {
+ "type": "jest",
+ "protocol": "${apiman.es.protocol}",
+ "host": "${apiman.es.host}",
+ "port": "${apiman.es.port}",
+ "initialize": true,
+ "username": "${apiman.es.username}",
+ "password": "${apiman.es.password}",
+ "timeout": "${apiman.es.timeout}"
+ }
+ }
+ },
+
+ // Execute Blocking Component
+ "IExecuteBlockingComponent": {
+ "class": "io.apiman.gateway.platforms.vertx3.components.ExecuteBlockingComponentImpl",
+ "config": {}
+ },
+
+ // JDBC Component Settings
+ "IJdbcComponent": {
+ "class": "io.apiman.gateway.platforms.vertx3.components.JdbcClientComponentImpl",
+ "config": {}
+ },
+
+ // LDAP Component Settings
+ "ILdapComponent": {
+ "class": "io.apiman.gateway.platforms.vertx3.components.LdapClientComponentImpl",
+ "config": {}
+ },
+
+ // HTTP Component Settings
+ "IHttpClientComponent": {
+ "class": "io.apiman.gateway.platforms.vertx3.components.HttpClientComponentImpl",
+ "config": {}
+ },
+
+ // Policy Failure Factory Component
+ "IPolicyFailureFactoryComponent": {
+ "class": "io.apiman.gateway.platforms.vertx3.components.PolicyFailureFactoryComponent",
+ "config": {}
+ },
+
+ // Buffer Factory Component
+ "IBufferFactoryComponent": {
+ "class": "io.apiman.gateway.platforms.vertx3.components.BufferFactoryComponentImpl",
+ "config": {}
+ },
+
+ // Periodic Component
+ "IPeriodicComponent": {
+ "class": "io.apiman.gateway.platforms.vertx3.components.PeriodicComponentImpl",
+ "config": {}
+ }
+ },
+
+ // SSL configuration to the gateway's *front end* (i.e. client <-> gateway).
+ // "ssl": {
+ // "keystore": {
+ // "path": "${APIMAN_SSL_FRONTEND_KS}",
+ // "password": "${APIMAN_SSL_FRONTEND_KS_PASSWORD}",
+ // },
+ // "truststore": {
+ // "path": "${APIMAN_SSL_FRONTEND_TS}",
+ // "password": "${APIMAN_SSL_FRONTEND_TS_PASSWORD}",
+ // }
+ // },
+
+ // Host-name to bind to for this machine.
+ "hostname": "localhost",
+
+ // Verticle configuration
+ // Port - The port a given verticle listens on (where relevant)
+ // Count - Number of given verticle type launched, or "auto" for automatic.
+ "verticles": {
+ "http": {
+ "port": "${APIMAN_VERTICLE_HTTP_PORT:-8080}",
+ "count": "auto"
+ },
+ // Configure the following SSL section to enable SSL/TLS.
+ "https": {
+ "port": "${APIMAN_VERTICLE_HTTPS_PORT:-8443}",
+ "count": 0
+ },
+ // The Gateway API; this will be the port to set in the UI.
+ // e.g. http://localhost:8081 or https://gateway.machine:8081
+ // Configure the following SSL section to enable SSL/TLS.
+ "api": {
+ "port": "${APIMAN_VERTICLE_API_PORT:-8081}",
+ "count": 1
+ }
+ },
+
+ // Gateway API Authentication. See documentation for further possibilities.
+ "auth": {
+ "type": "BASIC",
+ "config": {
+ "username": "${APIMAN_AUTH_USERNAME}",
+ "password": "${APIMAN_AUTH_PASSWORD}"
+ }
+ },
+
+ // When reporting an API's endpoint, prefer secure (i.e. https). You should probably change this after enabling HTTPS.
+ "preferSecure": false
+}

ADD
gateway-vertx/configs/registry.json
+{
+ "apis": [{
+ "publicAPI": false,
+ "organizationId": "example",
+ "apiId": "echo",
+ "version": "1.0",
+ "endpoint": "https://httpbin.org/get",
+ "endpointType": "rest",
+ "endpointContentType": "json",
+ "endpointProperties": {},
+ "parsePayload": false,
+ "apiPolicies": [{
+ "policyImpl": "class:io.apiman.gateway.engine.policies.RateLimitingPolicy",
+ "policyJsonConfig": "{ \"limit\" : 20, \"granularity\" : \"Client\", \"period\" : \"Minute\" }"
+ }]
+ }],
+ "clients": [{
+ "organizationId": "example",
+ "clientId": "client",
+ "version": "1.0",
+ "apiKey": "secret",
+ "contracts": [ {
+ "apiOrgId": "example",
+ "apiId": "echo",
+ "apiVersion": "1.0"
+ }]
+ }]
+}
+
+

Initial version of Vert.X gateway image