Skip to content

Commit 506e998

Browse files
authoredAug 30, 2021
Merge pull request #2 from Halfi/3.4
feat(config): add updating config and remote source of config
2 parents 8804535 + ae8ea67 commit 506e998

39 files changed

+1248
-433
lines changed
 

‎.github/workflows/registry.yml

+66-4
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,80 @@ on:
88
env:
99
REGISTRY: ghcr.io
1010
IMAGE_NAME: ${{ github.repository }}
11-
BUILDX_VERSIONS: linux/amd64
11+
BUILDX_VERSIONS: linux/amd64,linux/arm64,linux/arm/v7
12+
GO_VERSION: 1.17
1213

1314
jobs:
14-
build-and-push-image:
15+
build-go:
1516
runs-on: ubuntu-latest
1617
permissions:
1718
contents: read
18-
packages: write
19-
2019
steps:
2120
- name: Checkout repository
2221
uses: actions/checkout@v2
2322
with:
2423
fetch-depth: 2
2524

25+
- name: Setup go
26+
id: go
27+
uses: actions/setup-go@v2
28+
with:
29+
go-version: ${{ env.GO_VERSION }}
30+
31+
- name: Cache go
32+
uses: actions/cache@v2.1.6
33+
with:
34+
path: |
35+
~/.cache/go-build
36+
~/go/pkg/mod
37+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
38+
restore-keys: |
39+
${{ runner.os }}-go-
40+
41+
- name: Cache app build
42+
id: app_cache
43+
uses: actions/cache@v2.1.6
44+
with:
45+
path: ./bin/
46+
key: ${{ runner.os }}-webapp-${{ hashFiles('bin') }}
47+
48+
- name: Build go binaries
49+
run: |
50+
export CGO_ENABLED=0
51+
for TARGETPLATFORM in $( echo ${{ env.BUILDX_VERSIONS }} | tr -s ',' ' ' ); do
52+
time go build -ldflags="-d -s -w" -o ./bin/${TARGETPLATFORM}/postmanq -a cmd/postmanq/main.go &
53+
time go build -ldflags="-d -s -w" -o ./bin/${TARGETPLATFORM}/pmq-grep -a cmd/tools/pmq-grep/main.go &
54+
time go build -ldflags="-d -s -w" -o ./bin/${TARGETPLATFORM}/pmq-publish -a cmd/tools/pmq-publish/main.go &
55+
time go build -ldflags="-d -s -w" -o ./bin/${TARGETPLATFORM}/pmq-report -a cmd/tools/pmq-report/main.go &
56+
time go build -ldflags="-d -s -w" -o ./bin/${TARGETPLATFORM}/healthcheck -a cmd/healthcheck/main.go &
57+
done
58+
wait
59+
60+
- uses: actions/upload-artifact@v2
61+
with:
62+
name: application
63+
path: |
64+
./bin/
65+
./build/
66+
./config.yaml
67+
68+
build-and-publish-image:
69+
needs: build-go
70+
runs-on: ubuntu-latest
71+
strategy:
72+
matrix:
73+
include:
74+
- docker: postman
75+
tagSuffix: ""
76+
- docker: postman/alpine
77+
tagSuffix: "-alpine"
78+
permissions:
79+
packages: write
80+
steps:
81+
- uses: actions/download-artifact@v2
82+
with:
83+
name: application
84+
2685
- name: Set up QEMU
2786
uses: docker/setup-qemu-action@v1
2887

@@ -45,6 +104,8 @@ jobs:
45104
type=ref,event=branch
46105
type=ref,event=pr
47106
type=semver,pattern={{major}}.{{minor}}.{{patch}}
107+
flavor: |
108+
suffix=${{ matrix.tagSuffix }},onlatest=true
48109
49110
- name: Cache Docker layers
50111
uses: actions/cache@v2.1.6
@@ -59,6 +120,7 @@ jobs:
59120
id: docker_build
60121
uses: docker/build-push-action@v2
61122
with:
123+
file: build/${{ matrix.docker }}/Dockerfile
62124
context: .
63125
cache-from: type=local,src=/tmp/.buildx-cache
64126
cache-to: type=local,dest=/tmp/.buildx-cache-new

‎Dockerfile

-33
This file was deleted.

‎analyser/service.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import (
1414
)
1515

1616
var (
17-
// сервис аналитики
18-
service = new(Service)
19-
2017
// поля для агрегации по коду
2118
codeFields = []interface{}{
2219
"Code",
@@ -74,12 +71,13 @@ type Service struct {
7471

7572
// возвращает объект сервиса
7673
func Inst() *Service {
77-
return service
74+
return new(Service)
7875
}
7976

8077
// инициализирует сервис
8178
func (s *Service) OnInit(event *common.ApplicationEvent) {
8279
s.events = make(chan *common.SendEvent)
80+
s.eventsClosed = false
8381
s.reports = make(RowWriters)
8482
s.mutex = new(sync.Mutex)
8583
}

0 commit comments

Comments
 (0)
Please sign in to comment.