ing
This commit is contained in:
commit
37d61e6f30
68
.gitignore
vendored
Normal file
68
.gitignore
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff:
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/dictionaries
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.xml
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
### Go template
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
|
||||
.glide/
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
vendor/
|
||||
glide.lock
|
||||
.DS_Store
|
||||
dist/
|
||||
debug
|
32
.vscode/launch.json
vendored
Normal file
32
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"remotePath": "",
|
||||
"port": 2345,
|
||||
"host": "127.0.0.1",
|
||||
"program": "${workspaceRoot}/main.go",
|
||||
"env": {},
|
||||
"args": [],
|
||||
"showLog": true
|
||||
},
|
||||
{
|
||||
"name": "File Debug",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"remotePath": "",
|
||||
"port": 2345,
|
||||
"host": "127.0.0.1",
|
||||
"program": "${fileDirname}",
|
||||
"env": {},
|
||||
"args": [],
|
||||
"showLog": true
|
||||
}
|
||||
|
||||
]
|
||||
}
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
}
|
36
Dockerfile
Normal file
36
Dockerfile
Normal file
|
@ -0,0 +1,36 @@
|
|||
FROM alpine:latest
|
||||
|
||||
ENV APP_VERSION=1.0.0 \
|
||||
APP_HOME=/opt \
|
||||
APP_NAME=overflow_gateway_webapp
|
||||
|
||||
ENV APP_CONFIG_PATH="${APP_HOME}/config" \
|
||||
APP_LOGS_PATH="${APP_HOME}/logs" \
|
||||
PATH="$PATH:${APP_HOME}/bin"
|
||||
|
||||
ADD dist/${APP_NAME} ${APP_HOME}/bin/
|
||||
ADD _docker/bin/*.sh ${APP_HOME}/bin/
|
||||
|
||||
RUN apk add --no-cache curl \
|
||||
&& chmod +x ${APP_HOME}/bin/*.sh \
|
||||
&& mkdir -p ${APP_LOGS_PATH}
|
||||
|
||||
ENV TINI_VERSION='0.15.0' \
|
||||
TINI_SHA='4007655082f573603c02bc1d2137443c8e153af047ffd088d02ccc01e6f06170'
|
||||
|
||||
# Use tini as subreaper in Docker container to adopt zombie processes
|
||||
RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini \
|
||||
&& chmod +x /bin/tini \
|
||||
&& echo "$TINI_SHA /bin/tini" | sha256sum -c -
|
||||
|
||||
VOLUME ${APP_CONFIG_PATH}
|
||||
VOLUME ${APP_LOGS_PATH}
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
ENTRYPOINT ["/bin/tini", "--"]
|
||||
CMD ["docker-entrypoint.sh"]
|
||||
|
||||
|
||||
# docker build -f Dockerfile -t docker.loafle.net/overflow/overflow_service_websocket:1.0.0-alpine .
|
||||
# docker run -d -p 18081:80 -t docker.loafle.net/overflow/overflow_service_websocket:1.0.0-alpine
|
7
_docker/bin/docker-entrypoint.sh
Normal file
7
_docker/bin/docker-entrypoint.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
/opt/bin/overflow_gateway_app -config=/opt/config/
|
||||
|
||||
exec "$@"
|
67
_docker/config/config.json
Normal file
67
_docker/config/config.json
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"server": {
|
||||
"name": "Gateway APP",
|
||||
"network": "tcp4",
|
||||
"addr": ":80",
|
||||
"tls": false,
|
||||
"concurrency": 262144,
|
||||
"maxStopWaitTime": 0
|
||||
},
|
||||
"auth": {
|
||||
"signingKey": "tWB0lUXiCwX4U3qsJZcZ10mKvEH793RHkTJDbDuZVshQTk4uNB6ck59UQ96lhsRi4XNUiEnlIbP8XYQMPabeNtERX3iyHeDcwocgUVAor1nkAajYeq1gNyJszGpMhEOT"
|
||||
},
|
||||
"websocket": {
|
||||
"handshakeTimeout": 0,
|
||||
"readBufferSize": 8192,
|
||||
"writeBufferSize": 8192,
|
||||
"enableCompression": false
|
||||
},
|
||||
"gRPC": {
|
||||
"addr": "192.168.1.50:50006",
|
||||
"tls": false,
|
||||
"pool": {
|
||||
"maxIdle": 1,
|
||||
"maxCapacity": 3,
|
||||
"idleTimeout": 240,
|
||||
"wait": false
|
||||
}
|
||||
},
|
||||
"redis": {
|
||||
"network": "tcp",
|
||||
"addr": "192.168.1.50:6379",
|
||||
"tls": false,
|
||||
"pool": {
|
||||
"maxIdle": 1,
|
||||
"maxCapacity": 3,
|
||||
"idleTimeout": 240,
|
||||
"wait": false
|
||||
}
|
||||
},
|
||||
"handlers": {
|
||||
"web": {
|
||||
"entry": "/web",
|
||||
"socket": {
|
||||
"maxMessageSize": 8192,
|
||||
"writeTimeout": 0,
|
||||
"readTimeout": 0,
|
||||
"pongTimeout": 60,
|
||||
"pingTimeout": 10,
|
||||
"pingPeriod": 10,
|
||||
"binaryMessage": false
|
||||
}
|
||||
},
|
||||
"file": {
|
||||
"entry": "/file",
|
||||
"socket": {
|
||||
"maxMessageSize": 8192,
|
||||
"writeTimeout": 0,
|
||||
"readTimeout": 0,
|
||||
"pongTimeout": 60,
|
||||
"pingTimeout": 10,
|
||||
"pingPeriod": 10,
|
||||
"binaryMessage": false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
27
_docker/config/logging.json
Normal file
27
_docker/config/logging.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"level": "debug",
|
||||
"development": true,
|
||||
"disableCaller": true,
|
||||
"disableStacktrace": true,
|
||||
"sampling": {
|
||||
"initial": 100,
|
||||
"thereafter": 100
|
||||
},
|
||||
"encoding": "console",
|
||||
"encoderConfig": {
|
||||
"messageKey": "message",
|
||||
"levelKey": "level",
|
||||
"timeKey": "time",
|
||||
"nameKey": "name",
|
||||
"callerKey": "caller",
|
||||
"stacktraceKey": "stacktrace",
|
||||
"lineEnding": "\n",
|
||||
"levelEncoder": "color",
|
||||
"timeEncoder": "ISO8601",
|
||||
"durationEncoder": "string",
|
||||
"callerEncoder": "full",
|
||||
"nameEncoder": "full"
|
||||
},
|
||||
"outputPaths": ["/opt/logs/log"],
|
||||
"errorOutputPaths": ["stderr"]
|
||||
}
|
4
build.sh
Normal file
4
build.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
rm ./dist/*
|
||||
CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags="-s" -o ./dist/overflow_gateway_webapp
|
||||
|
||||
docker build -f Dockerfile -t docker.loafle.net/overflow/overflow_gateway_webapp:1.0.0-alpine .
|
67
config.json
Normal file
67
config.json
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"server": {
|
||||
"name": "Gateway Web APP",
|
||||
"network": "tcp4",
|
||||
"addr": ":19090",
|
||||
"tls": false,
|
||||
"concurrency": 262144,
|
||||
"maxStopWaitTime": 0
|
||||
},
|
||||
"auth": {
|
||||
"signingKey": "tWB0lUXiCwX4U3qsJZcZ10mKvEH793RHkTJDbDuZVshQTk4uNB6ck59UQ96lhsRi4XNUiEnlIbP8XYQMPabeNtERX3iyHeDcwocgUVAor1nkAajYeq1gNyJszGpMhEOT"
|
||||
},
|
||||
"websocket": {
|
||||
"handshakeTimeout": 0,
|
||||
"readBufferSize": 8192,
|
||||
"writeBufferSize": 8192,
|
||||
"enableCompression": false
|
||||
},
|
||||
"gRPC": {
|
||||
"addr": "127.0.0.1:50006",
|
||||
"tls": false,
|
||||
"pool": {
|
||||
"maxIdle": 1,
|
||||
"maxCapacity": 3,
|
||||
"idleTimeout": 240,
|
||||
"wait": false
|
||||
}
|
||||
},
|
||||
"redis": {
|
||||
"network": "tcp",
|
||||
"addr": "192.168.1.50:6379",
|
||||
"tls": false,
|
||||
"pool": {
|
||||
"maxIdle": 1,
|
||||
"maxCapacity": 3,
|
||||
"idleTimeout": 240,
|
||||
"wait": false
|
||||
}
|
||||
},
|
||||
"handlers": {
|
||||
"web": {
|
||||
"entry": "/web",
|
||||
"socket": {
|
||||
"maxMessageSize": 8192,
|
||||
"writeTimeout": 0,
|
||||
"readTimeout": 0,
|
||||
"pongTimeout": 60,
|
||||
"pingTimeout": 10,
|
||||
"pingPeriod": 10,
|
||||
"binaryMessage": false
|
||||
}
|
||||
},
|
||||
"file": {
|
||||
"entry": "/file",
|
||||
"socket": {
|
||||
"maxMessageSize": 8192,
|
||||
"writeTimeout": 0,
|
||||
"readTimeout": 0,
|
||||
"pongTimeout": 60,
|
||||
"pingTimeout": 10,
|
||||
"pingPeriod": 10,
|
||||
"binaryMessage": false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
33
docker-compose.yml
Normal file
33
docker-compose.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
overflow_gateway_web:
|
||||
restart: always
|
||||
image: docker.loafle.net/overflow/overflow_gateway_app:1.0.0-alpine
|
||||
container_name: overflow_gateway_app
|
||||
volumes:
|
||||
- /service/overflow_gateway_app/data/opt/config:/opt/config
|
||||
- /service/overflow_gateway_app/data/opt/logs:/opt/logs
|
||||
# - /home/crusader/Temp/docker/overflow_gateway_app/config:/opt/config
|
||||
# - /home/crusader/Temp/docker/overflow_gateway_app/logs:/opt/logs
|
||||
ports:
|
||||
- "19090:80"
|
||||
- "19443:443"
|
||||
|
||||
# postgresql:
|
||||
# restart: always
|
||||
# image: postgres:9.6-alpine
|
||||
# container_name: overFlow-dao-postgres
|
||||
# environment:
|
||||
# - POSTGRES_DB=overflow
|
||||
# - POSTGRES_USER=overflow
|
||||
# - POSTGRES_PASSWORD=qwer5795
|
||||
# # - POSTGRES_INITDB_ARGS="--data-checksums"
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
|
||||
# docker-compose up -d
|
||||
# docker-compose stop
|
||||
# docker-compose rm
|
||||
# or
|
||||
# docker-compose -f ./docker-compose.yml up -d
|
Loading…
Reference in New Issue
Block a user