-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3ca46c9
Showing
19 changed files
with
958 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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: Go Matrix | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
|
||
cross: | ||
name: Go | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
CGO_ENABLED: 0 | ||
|
||
strategy: | ||
matrix: | ||
go-version: [ 1.19, 1.x ] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
||
steps: | ||
# https://github.com/marketplace/actions/setup-go-environment | ||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
# https://github.com/marketplace/actions/checkout | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
# https://github.com/marketplace/actions/cache | ||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
# In order: | ||
# * Module download cache | ||
# * Build cache (Linux) | ||
# * Build cache (Mac) | ||
# * Build cache (Windows) | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
~/Library/Caches/go-build | ||
%LocalAppData%\go-build | ||
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.go-version }}-go- | ||
- name: Test | ||
run: go test -v -cover ./... |
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,72 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
|
||
main: | ||
name: Main Process | ||
runs-on: ubuntu-latest | ||
env: | ||
GO_VERSION: 1.19 | ||
GOLANGCI_LINT_VERSION: v1.50.0 | ||
YAEGI_VERSION: v0.14.2 | ||
CGO_ENABLED: 0 | ||
defaults: | ||
run: | ||
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} | ||
|
||
steps: | ||
|
||
# https://github.com/marketplace/actions/setup-go-environment | ||
- name: Set up Go ${{ env.GO_VERSION }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
# https://github.com/marketplace/actions/checkout | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
path: go/src/github.com/${{ github.repository }} | ||
fetch-depth: 0 | ||
|
||
# https://github.com/marketplace/actions/cache | ||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ github.workspace }}/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
# https://golangci-lint.run/usage/install#other-ci | ||
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} | ||
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION} | ||
|
||
- name: Install Yaegi ${{ env.YAEGI_VERSION }} | ||
run: curl -sfL https://raw.githubusercontent.com/traefik/yaegi/master/install.sh | bash -s -- -b $(go env GOPATH)/bin ${YAEGI_VERSION} | ||
|
||
- name: Setup GOPATH | ||
run: go env -w GOPATH=${{ github.workspace }}/go | ||
|
||
- name: Check and get dependencies | ||
run: | | ||
go mod tidy | ||
git diff --exit-code go.mod | ||
# git diff --exit-code go.sum | ||
go mod download | ||
go mod vendor | ||
# git diff --exit-code ./vendor/ | ||
- name: Lint and Tests | ||
run: make | ||
|
||
- name: Run tests with Yaegi | ||
run: make yaegi_test | ||
env: | ||
GOPATH: ${{ github.workspace }}/go |
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,6 @@ | ||
.idea/ | ||
.vscode/ | ||
.DS_Store | ||
|
||
postgres/ | ||
go.work |
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,75 @@ | ||
run: | ||
timeout: 3m | ||
skip-files: [] | ||
skip-dirs: [] | ||
|
||
linters-settings: | ||
govet: | ||
enable-all: true | ||
disable: | ||
- fieldalignment | ||
golint: | ||
min-confidence: 0 | ||
gocyclo: | ||
min-complexity: 12 | ||
goconst: | ||
min-len: 5 | ||
min-occurrences: 4 | ||
misspell: | ||
locale: US | ||
funlen: | ||
lines: -1 | ||
statements: 50 | ||
godox: | ||
keywords: | ||
- FIXME | ||
gofumpt: | ||
extra-rules: true | ||
|
||
linters: | ||
enable-all: true | ||
disable: | ||
- deadcode # deprecated | ||
- exhaustivestruct # deprecated | ||
- golint # deprecated | ||
- ifshort # deprecated | ||
- interfacer # deprecated | ||
- maligned # deprecated | ||
- nosnakecase # deprecated | ||
- scopelint # deprecated | ||
- scopelint # deprecated | ||
- structcheck # deprecated | ||
- varcheck # deprecated | ||
- sqlclosecheck # not relevant (SQL) | ||
- rowserrcheck # not relevant (SQL) | ||
- execinquery # not relevant (SQL) | ||
- cyclop # duplicate of gocyclo | ||
- bodyclose # Too many false positives: https://github.com/timakin/bodyclose/issues/30 | ||
- dupl | ||
- testpackage | ||
- tparallel | ||
- paralleltest | ||
- nlreturn | ||
- wsl | ||
- exhaustive | ||
- exhaustruct | ||
- goerr113 | ||
- wrapcheck | ||
- ifshort | ||
- noctx | ||
- lll | ||
- gomnd | ||
- forbidigo | ||
- varnamelen | ||
|
||
issues: | ||
exclude-use-default: false | ||
max-per-linter: 0 | ||
max-same-issues: 0 | ||
exclude: [] | ||
exclude-rules: | ||
- path: (.+)_test.go | ||
linters: | ||
- goconst | ||
- funlen | ||
- godot |
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,17 @@ | ||
displayName: Umami Feeder | ||
type: middleware | ||
iconPath: .assets/icon.png | ||
|
||
import: github.com/astappiev/traefik-umami-feeder | ||
|
||
summary: 'Traefik plugin that sends HTTP requests to Umami as pageview events.' | ||
|
||
testData: | ||
umamiHost: "" | ||
umamiToken: "" | ||
umamiUsername: "" | ||
umamiPassword: "" | ||
websites: | ||
domain: websiteId | ||
createNewWebsites: false | ||
debug: false |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Oleh Astappiev | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,20 @@ | ||
.PHONY: lint test vendor clean | ||
|
||
export GO111MODULE=on | ||
|
||
default: lint test | ||
|
||
lint: | ||
golangci-lint run | ||
|
||
test: | ||
go test -v -cover ./... | ||
|
||
yaegi_test: | ||
yaegi test -v . | ||
|
||
vendor: | ||
go mod vendor | ||
|
||
clean: | ||
rm -rf ./vendor |
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,10 @@ | ||
http: | ||
middlewares: | ||
umami: | ||
plugin: | ||
umami-feeder: | ||
debug: true | ||
umamiHost: http://umami:3000 | ||
umamiUsername: "admin" | ||
umamiPassword: "umami" | ||
createNewWebsites: true |
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,70 @@ | ||
services: | ||
traefik: | ||
image: traefik:3 | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.traefik.service=api@internal" | ||
- "traefik.http.routers.traefik.rule=Host(`localhost`)" | ||
- "traefik.http.routers.traefik.entrypoints=traefik" | ||
networks: | ||
- traefik | ||
ports: | ||
- target: 8080 | ||
published: 8080 | ||
protocol: tcp | ||
- target: 8081 | ||
published: 8081 | ||
protocol: tcp | ||
volumes: | ||
# So that Traefik can listen to the Docker events | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
# To persist ACME data (certificates, account, etc) | ||
- ./traefik.yml:/traefik.yml:ro | ||
- ./config.yml:/config/config.yml:ro | ||
# mount plugin | ||
- ../:/plugins-local/src/github.com/astappiev/traefik-umami-feeder | ||
|
||
restart: unless-stopped | ||
|
||
whoami: | ||
image: containous/whoami | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.services.whoami.loadbalancer.server.port=80" | ||
- "traefik.http.routers.whoami.service=whoami" | ||
- "traefik.http.routers.whoami.rule=Host(`localhost`)" | ||
- "traefik.http.routers.whoami.entrypoints=whoami" | ||
# middleware | ||
- "traefik.http.routers.whoami.middlewares=umami@file" | ||
|
||
networks: | ||
- traefik | ||
|
||
umami: | ||
image: ghcr.io/umami-software/umami:postgresql-latest | ||
depends_on: | ||
- postgres | ||
environment: | ||
- DATABASE_URL=postgres://umami:umami@postgres:5432/umami | ||
ports: | ||
- target: 3000 | ||
published: 3000 | ||
protocol: tcp | ||
networks: | ||
- traefik | ||
- umami_postgres | ||
|
||
postgres: | ||
image: postgres:16 | ||
environment: | ||
- POSTGRES_PASSWORD=umami | ||
- POSTGRES_DB=umami | ||
- POSTGRES_USER=umami | ||
networks: | ||
- umami_postgres | ||
volumes: | ||
- ./postgres:/var/lib/postgresql/data | ||
|
||
networks: | ||
traefik: | ||
umami_postgres: |
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,30 @@ | ||
log: | ||
level: INFO | ||
|
||
# accessLog: {} | ||
|
||
providers: | ||
docker: | ||
endpoint: "unix:///var/run/docker.sock" | ||
exposedByDefault: false | ||
network: traefik | ||
watch: true | ||
file: | ||
directory: /config | ||
watch: true | ||
|
||
entryPoints: | ||
"traefik": # traefik dashboard | ||
address: ":8080" | ||
"whoami": # http | ||
address: ":8081" | ||
"umami": # umami dashboard | ||
address: ":3000" | ||
|
||
api: | ||
dashboard: true | ||
|
||
experimental: | ||
localPlugins: | ||
umami-feeder: | ||
moduleName: "github.com/astappiev/traefik-umami-feeder" |
Oops, something went wrong.