-
Notifications
You must be signed in to change notification settings - Fork 0
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
[TS-1163] Initial version #1
Open
cordwelt
wants to merge
1
commit into
master
Choose a base branch
from
ts-1163
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.sha }} | ||
- name: Checkout tool | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: exactpro-th2/ci-github-action | ||
ref: master | ||
token: ${{ secrets.PAT_CI_ACTION }} | ||
path: ci-github-action | ||
- name: Run CI action | ||
uses: ./ci-github-action | ||
with: | ||
ref: ${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Dev build and publish Docker distributions to Github Container Registry ghcr.io | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- master | ||
- version-* | ||
paths-ignore: | ||
- README.md | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Prepare custom build version | ||
- name: Get branch name | ||
id: branch | ||
run: echo ::set-output name=branch_name::${GITHUB_REF#refs/*/} | ||
- name: Get release_version | ||
id: ver | ||
uses: christian-draeger/[email protected] | ||
with: | ||
path: gradle.properties | ||
property: release_version | ||
- name: Build custom release version | ||
id: release_ver | ||
run: echo ::set-output name=value::"${{ steps.ver.outputs.value }}-${{ steps.branch.outputs.branch_name }}-${{ github.run_id }}" | ||
- name: Show custom release version | ||
run: echo ${{ steps.release_ver.outputs.value }} | ||
# Build and publish image | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- run: echo "::set-output name=REPOSITORY_NAME::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" | ||
id: meta | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ steps.release_ver.outputs.value }} | ||
labels: com.exactpro.th2.${{ steps.meta.outputs.REPOSITORY_NAME }}=${{ steps.ver.outputs.value }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build and publish Docker distributions to Github Container Registry ghcr.io | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- version-* | ||
paths: | ||
- gradle.properties | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.CR_PAT }} | ||
- run: echo "::set-output name=REPOSITORY_NAME::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" | ||
id: meta | ||
- name: Read version from gradle.properties | ||
id: read_property | ||
uses: christian-draeger/[email protected] | ||
with: | ||
path: ./gradle.properties | ||
property: release_version | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ steps.read_property.outputs.value }} | ||
labels: com.exactpro.th2.${{ steps.meta.outputs.REPOSITORY_NAME }}=${{ steps.read_property.outputs.value }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build/ | ||
out/ | ||
.gradle/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
variables: | ||
APP_NAME: th2-conn-soup-bin-tcp | ||
|
||
include: | ||
- project: vivarium/th2/pipelines | ||
ref: v2 | ||
file: /.gitlab-ci-java.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM gradle:7.5.1-jdk11 AS build | ||
ARG release_version | ||
COPY ./ . | ||
RUN gradle --no-daemon clean build dockerPrepare -Prelease_version=${release_version} | ||
|
||
FROM adoptopenjdk/openjdk11:alpine | ||
WORKDIR /home | ||
COPY --from=build /home/gradle/build/docker . | ||
ENTRYPOINT ["/home/service/bin/service"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,110 @@ | ||
# th2-conn-soup-bin-tcp | ||
# th2-conn-soup-bin-tcp | ||
|
||
This microservice allows sending and receiving messages via SoupBinTCP protocol | ||
|
||
## Configuration | ||
|
||
+ *sessions* - list of session settings | ||
+ *maxBatchSize* - max size of outgoing message batch (`1000` by default) | ||
+ *maxFlushTime* - max message batch flush time (`1000` by default) | ||
+ *batchByGroup* - batch messages by group instead of session alias and direction (`true` by default) | ||
+ *publishSentEvents* - enables/disables publish of "message sent" events (`true` by default) | ||
+ *publishConnectEvents* - enables/disables publish of "connect/disconnect" events (`true` by default) | ||
|
||
## Session settings | ||
|
||
+ *sessionAlias* - session alias for incoming/outgoing th2 messages | ||
+ *sessionGroup* - session group for incoming/outgoing th2 messages (same as session alias by default) | ||
+ *handler* - handler settings | ||
+ *mangler* - mangler settings | ||
|
||
## Handler settings | ||
|
||
+ *host* - service host | ||
+ *port* - service port | ||
+ *security* - connection security settings | ||
+ *username* - login username | ||
+ *password* - login password | ||
+ *requestedSession* - requested login session (empty by default) | ||
+ *requestedSequenceNumber* - requested login sequence number (`0` by default) | ||
+ *heartbeatInterval* - millisecond interval for sending client heartbeats (`1000` by default) | ||
+ *idleTimeout* - millisecond interval to disconnect after if there were no incoming messages (`15000` by default) | ||
+ *autoReconnect* - enables/disables auto-reconnect (`true` by default) | ||
+ *reconnectDelay* - delay between reconnects (`5000` by default) | ||
+ *maxMessageRate* - max outgoing message rate for this session (unlimited by default) | ||
|
||
### Security settings | ||
|
||
+ *ssl* - enables SSL on connection (`false` by default) | ||
+ *sni* - enables SNI support (`false` by default) | ||
+ *certFile* - path to server certificate (`null` by default) | ||
+ *acceptAllCerts* - accept all server certificates (`false` by default, takes precedence over `certFile`) | ||
|
||
**NOTE**: when using infra 1.7.0+ it is recommended to load value for `certFile` from a secret by using `${secret_path:secret_name}` syntax. | ||
|
||
## Mangler settings | ||
|
||
There's no mangler implementation at the moment | ||
|
||
## MQ pins | ||
|
||
+ input queue with `subscribe`, `send` and `raw` attributes for outgoing messages | ||
+ output queue with `publish`, `first` (for incoming messages) or `second` (for outgoing messages) and `raw` attributes | ||
|
||
## Deployment via infra-mgr | ||
|
||
Here's an example of `infra-mgr` config required to deploy this service | ||
|
||
```yaml | ||
apiVersion: th2.exactpro.com/v1 | ||
kind: Th2Box | ||
metadata: | ||
name: soup-bin-tcp-conn | ||
spec: | ||
image-name: ghcr.io/th2-net/th2-conn-soup-bin-tcp | ||
image-version: 0.0.1 | ||
type: th2-conn | ||
custom-config: | ||
maxBatchSize: 1000 | ||
maxFlushTime: 1000 | ||
batchByGroup: false | ||
publishSentEvents: true | ||
publishConnectEvents: true | ||
sessions: | ||
- sessionAlias: sbt-session | ||
handler: | ||
security: | ||
ssl: false | ||
host: 127.0.0.1 | ||
port: 4567 | ||
autoReconnect: true | ||
reconnectDelay: 5000 | ||
maxMessageRate: 100000 | ||
mangler: { } | ||
pins: | ||
- name: to_send | ||
connection-type: mq | ||
attributes: | ||
- subscribe | ||
- send | ||
- raw | ||
settings: | ||
storageOnDemand: false | ||
queueLength: 1000 | ||
- name: outgoing | ||
connection-type: mq | ||
attributes: | ||
- publish | ||
- store | ||
- raw | ||
extended-settings: | ||
service: | ||
enabled: false | ||
resources: | ||
limits: | ||
memory: 500Mi | ||
cpu: 1000m | ||
requests: | ||
memory: 100Mi | ||
cpu: 100m | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
plugins { | ||
id 'com.palantir.docker' version '0.25.0' | ||
id 'org.jetbrains.kotlin.jvm' version "${kotlin_version}" | ||
id 'application' | ||
} | ||
|
||
apply plugin: 'kotlin-kapt' | ||
|
||
group = 'com.exactpro.th2' | ||
version = release_version | ||
|
||
sourceCompatibility = 11 | ||
targetCompatibility = 11 | ||
|
||
compileKotlin { | ||
kotlinOptions.jvmTarget = '11' | ||
} | ||
|
||
compileTestKotlin { | ||
kotlinOptions.jvmTarget = '11' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
|
||
maven { | ||
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' | ||
} | ||
|
||
maven { | ||
url 'https://s01.oss.sonatype.org/content/repositories/releases/' | ||
} | ||
|
||
mavenLocal() | ||
|
||
configurations.all { | ||
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' | ||
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds' | ||
} | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes( | ||
'Created-By': "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})", | ||
'Specification-Title': '', | ||
'Specification-Vendor': 'Exactpro Systems LLC', | ||
'Implementation-Title': project.archivesBaseName, | ||
'Implementation-Vendor': 'Exactpro Systems LLC', | ||
'Implementation-Vendor-Id': 'com.exactpro', | ||
'Implementation-Version': project.version | ||
) | ||
} | ||
} | ||
|
||
dependencies { | ||
api platform('com.exactpro.th2:bom:3.2.0') | ||
|
||
implementation 'com.exactpro.th2:conn-dirty-tcp-core:2.0.0' | ||
implementation 'com.exactpro.th2:common:3.40.0-TH2-3789-2817159492-SNAPSHOT' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we use release version instead There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a dev build with session-group support. Did we release session-groups? |
||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" | ||
implementation 'org.slf4j:slf4j-api' | ||
implementation 'io.github.microutils:kotlin-logging:2.1.14' | ||
implementation 'io.netty:netty-buffer:4.1.79.Final' | ||
implementation 'com.google.auto.service:auto-service:1.0.1' | ||
|
||
kapt 'com.google.auto.service:auto-service:1.0.1' | ||
} | ||
|
||
application { | ||
mainClassName 'com.exactpro.th2.conn.dirty.tcp.core.Main' | ||
} | ||
|
||
applicationName = 'service' | ||
|
||
distTar { | ||
archiveName "${applicationName}.tar" | ||
} | ||
|
||
dockerPrepare { | ||
dependsOn distTar | ||
} | ||
|
||
docker { | ||
copySpec.from(tarTree("$buildDir/distributions/${applicationName}.tar")) | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kotlin.code.style=official | ||
kotlin_version=1.6.21 | ||
release_version=0.0.1 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
could you please discuss @Xanclry about using common workflow from .github repository
https://github.com/th2-net/.github/pull/7/files
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.
@Xanclry could you please help? Because I don't really understand what should be done here. Should I add some of the workflows from the PR above?