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

fixes #167 add Dockerfile.17 and a new config folder light-portal #168

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ publish() {
echo "Building Docker image with version $VERSION"
docker build -t $IMAGE_NAME:$VERSION -t $IMAGE_NAME:latest -f ./docker/Dockerfile . --no-cache=true
docker build -t $IMAGE_NAME:$VERSION-slim -f ./docker/Dockerfile-Slim . --no-cache=true
dokcer build -t $IMAGE_NAME:$VERSION-17 -f ./docker/Dockerfile.17 . --no-cache=true
docker build -t $IMAGE_NAME:$VERSION-17 -f ./docker/Dockerfile.17 . --no-cache=true
echo "Images built with version $VERSION"
echo "Pushing image to DockerHub"
docker push $IMAGE_NAME -a
Expand Down
1 change: 1 addition & 0 deletions config/light-portal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder contains the configuration for the local light-portal instance. It is used for testing and debugging purposes.
Binary file added config/light-portal/client.truststore
Binary file not shown.
106 changes: 106 additions & 0 deletions config/light-portal/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016 Network New Technologies Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<configuration>
<!-- TODO create logger for audit only.
http://stackoverflow.com/questions/2488558/logback-to-log-different-messages-to-two-files -->
<turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
<Marker>PROFILER</Marker>
<!--<OnMatch>DENY</OnMatch>-->
<OnMatch>NEUTRAL</OnMatch>
</turboFilter>

<!--stdout log-->
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %X{sId} %X{cId} %-5level %class{36}:%L %M - %msg%n</pattern>
</encoder>
</appender>

<!--stdout-file log-->
<appender name="stdout-file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/stdout.log.json</file>
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<timestamp>
<fieldName>timestamp</fieldName>
<pattern>yyyy-MM-dd'T'HH:mm:ss.SSSZ</pattern>
</timestamp>
<pattern>
<pattern>
{
"thread": "%thread",
"level": "%-5level",
"logger": "%logger{64}",
"correlationId": "%X{cId}",
"serviceId": "%X{sId}",
"class": "%F",
"lineNumber": "%class{64}:%L",
"method": "%M",
"logMessage": "#tryJson{%message}"
}
</pattern>
</pattern>
<rootStackTraceElement/>
<stackTrace/>
</providers>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>log/stdout.log.json.%i.zip</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>5</maxIndex> <!-- max number of archived logs that are kept -->
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>200MB
</maxFileSize> <!-- The size of the logfile that triggers a switch to a new logfile, and the current one archived -->
</triggeringPolicy>
</appender>

<!--audit log-->
<appender name="audit" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/schedular-audit.log.json</file> <!-- logfile location -->
<encoder>
<pattern>%msg%n</pattern> <!-- the layout pattern used to format log entries -->
<immediateFlush>true</immediateFlush>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>log/schedular-audit.log.json.%i.zip</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>5</maxIndex> <!-- max number of archived logs that are kept -->
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>200MB
</maxFileSize> <!-- The size of the logfile that triggers a switch to a new logfile, and the current one archived -->
</triggeringPolicy>
</appender>

<root level="debug">
<appender-ref ref="stdout"/>
<appender-ref ref="stdout-file"/>
</root>

<logger name="Audit" level="debug" additivity="false">
<appender-ref ref="audit"/>
</logger>

<logger name="com.networknt" level="trace" additivity="false">
<appender-ref ref="stdout"/>
</logger>

</configuration>
Binary file added config/light-portal/server.keystore
Binary file not shown.
166 changes: 166 additions & 0 deletions config/light-portal/values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# server.yml
server.serviceId: com.networknt.gateway-1.0.0


# router.yml
router.maxRequestTime: 5000

#client.yml
client.verifyHostname: false
client.loadDefaultTrustStore: false
#client.tokenCcClientId: f7d42348-c647-4efb-a52d-4c5787421e73
#client.tokenRtClientId: f7d42348-c647-4efb-a52d-4c5787421e73
#client.tokenKeyClientId: f7d42348-c647-4efb-a52d-4c5787421e73
#client.signClientId: f7d42348-c647-4efb-a52d-4c5787421e73
#client.signKeyClientId: f7d42348-c647-4efb-a52d-4c5787421e73
#client.derefClientId: f7d42348-c647-4efb-a52d-4c5787421e73
#client.injectOpenTracing: true
#client.tokenServiceId: com.networknt.oauth-token-1.0.0
#client.tokenKeyServiceId: com.networknt.oauth-key-1.0.0
#client.signServiceId: com.networknt.oauth-token-1.0.0
#client.signKeyServiceId: com.networknt.oauth-key-1.0.0
#client.derefServiceId: com.networknt.oauth-token-1.0.0

# service.yml
service.singletons:
- com.networknt.registry.URL:
- com.networknt.registry.URLImpl
- com.networknt.registry.Registry:
- com.networknt.registry.support.DirectRegistry
- com.networknt.balance.LoadBalance:
- com.networknt.balance.RoundRobinLoadBalance
- com.networknt.cluster.Cluster:
- com.networknt.cluster.LightCluster
- com.networknt.cache.CacheManager:
- com.networknt.cache.CaffeineCacheManager

# pathPrefixService.yml
pathPrefixService.enabled: true
pathPrefixService.mapping:
/oauth2: com.networknt.oauth-kafka-1.0.0
/r: com.networknt.reference-1.0.0
/portal/command: com.networknt.portal.hybrid.command-1.0.0
/portal/query: com.networknt.portal.hybrid.query-1.0.0
/config-server: com.networknt.config-server-1.0.0
/services: com.networknt.controller-1.0.0
/schedulers: com.networknt.scheduler-1.0.0

# direct-registry.yml
direct-registry.directUrls:
# com.networknt.portal.hybrid.query-1.0.0: https://hybrid-query1:8440,https://hybrid-query2:8441,https://hybrid-query3:8442
com.networknt.portal.hybrid.query-1.0.0: https://local.lightapi.net:8440,https://local.lightapi.net:8441,https://local.lightapi.net:8442
# com.networknt.portal.hybrid.command-1.0.0: https://hybrid-command:8439
com.networknt.portal.hybrid.command-1.0.0: https://local.lightapi.net:8439
# com.networknt.oauth-kafka-1.0.0: https://oauth-kafka:6881
com.networknt.oauth-kafka-1.0.0: https://192.168.4.102:6881
# com.networknt.reference-1.0.0: https://reference:2498
com.networknt.reference-1.0.0: https://192.168.4.102:2498
# com.networknt.config-server-1.0.0: https://config-server:8435
com.networknt.config-server-1.0.0: https://192.168.4.102:8435
# com.networknt.controller-1.0.0: https://controller-node1:8438,https://controller-node2:8437,https://controller-node3:8436
com.networknt.controller-1.0.0: https://192.168.4.102:8438,https://192.168.4.102:8437,https://192.168.4.102:8436
# com.networknt.scheduler-1.0.0: https://scheduler-node1:8401,https://scheduler-node2:8402,https://scheduler-node3:8403
com.networknt.scheduler-1.0.0: https://192.168.4.102:8401,https://192.168.4.102:8402,https://192.168.4.102:8403

# handler.yml
handler.handlers:
# Light-framework cross-cutting concerns implemented in the microservice
- com.networknt.exception.ExceptionHandler@exception
# - com.networknt.metrics.MetricsHandler@metrics
- com.networknt.traceability.TraceabilityHandler@traceability
- com.networknt.correlation.CorrelationHandler@correlation
# Cors handler to handler post/put pre-flight. It is not used in the sidecar but only in the router.
- com.networknt.cors.CorsHttpHandler@cors
- com.networknt.openapi.OpenApiHandler@specification
- com.networknt.openapi.JwtVerifyHandler@security
- com.networknt.body.BodyHandler@body
- com.networknt.audit.AuditHandler@audit
- com.networknt.sanitizer.SanitizerHandler@sanitizer
- com.networknt.openapi.ValidatorHandler@validator
# Header middleware to manipulate request and/or response headers before or after downstream server
- com.networknt.header.HeaderHandler@header
# Rate limit middleware to prevent DDoS attacks externally or throttle requests internally
- com.networknt.limit.LimitHandler@limit
# IP whitelist handler to allow only one or several IPs to connect to the gateway.
# - com.networknt.whitelist.WhitelistHandler@whitelist
# Direct requests to named services based on the request path
# - com.networknt.router.middleware.GatewayServiceDictHandler@path
- com.networknt.router.middleware.PathPrefixServiceHandler@prefix
# - com.networknt.router.middleware.GatewaySAMLTokenHandler@saml
- com.networknt.router.RouterHandler@router
- com.networknt.proxy.LightProxyHandler@proxy
- com.networknt.proxy.ProxyServerInfoHandler@proxyServerInfo
- com.networknt.resource.VirtualHostHandler@virtual
# Customer business domain specific cross-cutting concerns handlers
# - com.example.validator.CustomizedValidator@custvalidator
# Framework endpoint handlers
# Control Pane middleware handlers and API handler
- com.networknt.chaos.KillappAssaultHandler@killapp
- com.networknt.chaos.LatencyAssaultHandler@latency
- com.networknt.chaos.MemoryAssaultHandler@memory
- com.networknt.chaos.ExceptionAssaultHandler@exchaos
- com.networknt.chaos.ChaosMonkeyGetHandler@chaosget
- com.networknt.chaos.ChaosMonkeyPostHandler@chaospost
- com.networknt.health.HealthGetHandler@health
- com.networknt.info.ServerInfoGetHandler@info
- com.networknt.logging.handler.LoggerGetHandler@getLogger
- com.networknt.logging.handler.LoggerPostHandler@postLogger
- com.networknt.logging.handler.LoggerGetLogContentsHandler@getLogContents
- com.networknt.config.reload.handler.ModuleRegistryGetHandler@modules
- com.networknt.config.reload.handler.ConfigReloadHandler@configReload
- com.networknt.specification.SpecDisplayHandler@spec
- com.networknt.specification.SpecSwaggerUIHandler@swaggerui
- com.networknt.specification.FaviconHandler@favicon
- com.networknt.router.OAuthServerHandler@oauth
- com.networknt.router.OAuthServerGetHandler@getOauth
- com.networknt.server.handler.ServerShutdownHandler@shutdown

handler.chains.default:
# - whitelist
- exception
# - metrics
- limit
- traceability
- correlation
- killapp
- latency
- memory
- exchaos
- cors
# - stateless
- header
# - body
# - specification
# - security
# - audit
# - sanitizer
# - validator
# - path
- prefix
- router

# cache.yml
cache.caches:
- cacheName: jwt
expiryInMinutes: 15
maxSize: 100
- cacheName: jwk
expiryInMinutes: 129600
maxSize: 100

# cors.yml
cors.enabled: true
cors.allowedOrigins:
- https://devsignin.lightapi.net
- https://dev.lightapi.net
- https://localhost:3000
cors.allowedMethods:
- GET
- POST
- PUT
- DELETE

#openapi-security.yml
openapi-security.skipPathPrefixes:
/adm

14 changes: 14 additions & 0 deletions config/light-portal/virtual-host.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
hosts:
- domain: local.lightapi.net
path: /
#base: /home/steve/light-chain/light-config-test/light-router/local-direct/lightapi/build
base: /lightapi/build
transferMinSize: 10245760
directoryListingEnabled: false
- domain: devsignin.lightapi.net
path: /
#base: /home/steve/light-chain/light-config-test/light-router/local-direct/signin/build
base: /signin/build
transferMinSize: 10245760
directoryListingEnabled: false

Binary file added config/server-proxy-petstore/client.keystore
Binary file not shown.
Binary file added config/server-proxy-petstore/client.truststore
Binary file not shown.
Binary file added config/server-proxy-petstore/server.keystore
Binary file not shown.
Binary file added config/server-proxy-petstore/server.truststore
Binary file not shown.
5 changes: 3 additions & 2 deletions docker/Dockerfile-Debug
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM openjdk:11.0.3-slim
ADD /target/light-proxy.jar server.jar
# We don't need this image as we can pass the environment variable to any container with JAVA_TOOL_OPTIONS
FROM amazoncorretto:11.0.21
ADD /target/light-gateway.jar server.jar
CMD ["/bin/sh","-c","exec java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -Dlight-4j-config-dir=/config -Dlogback.configurationFile=/config/logback.xml -jar /server.jar"]
2 changes: 1 addition & 1 deletion docker/Dockerfile-Slim
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM openjdk:11.0.3-slim
FROM amazoncorretto:11.0.21
ADD /target/light-gateway.jar server.jar
CMD ["/bin/sh","-c","exec java -Dlight-4j-config-dir=/config -Dlogback.configurationFile=/config/logback.xml -jar /server.jar"]
File renamed without changes.