Merge pull request #788 from statping/dev

v.90.63
pull/789/head^2
Hunter Long 2020-08-17 18:43:36 -07:00 committed by GitHub
commit fa31ac6bdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 579 additions and 518 deletions

View File

@ -1,63 +1,47 @@
name: Dev Release
name: Development Build
on:
push:
branches:
- dev
paths-ignore:
- '**.md'
pull_request:
branches:
- dev
paths-ignore:
- '**.md'
jobs:
compile:
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- uses: actions/setup-node@v1
with:
node-version: '12.18.2'
- name: Configure AWS credentials from account
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- uses: actions/checkout@v2
node-version: 12.18.2
- name: Add GOBIN to PATH
- name: Set Version
run: |
echo "::add-path::$(go env GOPATH)/bin"
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Font Awesome authentication
env:
FONTAWESOME_TOKEN: ${{ secrets.FONTAWESOME_TOKEN }}
run: |
npm config set "@fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" $FONTAWESOME_TOKEN
- name: Install Global Dependencies
run: npm install -g yarn sass cross-env
- name: Download Frontend Dependencies
if: steps.nodecache.outputs.cache-hit != 'true'
working-directory: ./frontend
run: yarn
- name: Download Go mods
if: steps.golangcache.outputs.cache-hit != 'true'
run: |
go mod download
go mod verify
make test-deps
- name: Build Frontend Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: make clean compile
- name: Upload Compiled Frontend (rice-box.go)
@ -66,16 +50,130 @@ jobs:
name: static-rice-box
path: ./source
- name: Upload Assets to S3
- name: Configure AWS credentials for Asset uploads
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Upload Static Assets to S3
run: |
tar -czvf source.tar.gz source/
aws s3 cp source.tar.gz s3://assets.statping.com/
aws s3 cp source.tar.gz s3://assets.statping.com/commit/${{ github.sha }}/
rm -rf source.tar.gz
test:
needs: compile
build:
needs: frontend
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux]
arch: [386, amd64, arm-7, arm-6, arm64]
include:
- platform: darwin
arch: amd64
- platform: windows
arch: amd64
steps:
- uses: actions/checkout@v2
- name: Download Compiled Frontend (rice-box.go)
uses: actions/download-artifact@v1
with:
name: static-rice-box
path: ./source
- name: Configure AWS credentials for Asset uploads
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Add GOBIN to PATH
run: |
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Set Linux Build Flags
if: matrix.platform != 'darwin'
run: echo ::set-env name=BUILD_FLAGS::'-extldflags -static'
shell: bash
- name: Build ${{ matrix.platform }}/${{ matrix.arch }}
uses: crazy-max/ghaction-xgo@v1
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
with:
xgo_version: latest
go_version: 1.15.x
dest: build
prefix: statping
targets: ${{ matrix.platform }}/${{ matrix.arch }}
v: false
x: false
pkg: cmd
buildmode: pie
ldflags: -s -w -X main.VERSION=${{ env.VERSION }} -X main.COMMIT=${{ env.COMMIT }} ${{ env.BUILD_FLAGS }}
- name: Compress Linux Builds
if: matrix.platform == 'linux'
run: |
cd build
mv statping-linux-${{ matrix.arch }} statping
chmod +x statping
tar -czvf statping-linux-${{ matrix.arch }}.tar.gz statping
rm -rf statping
echo ::set-env name=compressed::statping-linux-${{ matrix.arch }}.tar.gz
- name: Compress Windows Builds
if: matrix.platform == 'windows'
run: |
cd build
mv statping-windows-4.0-${{ matrix.arch }}.exe statping.exe
chmod +x statping.exe
zip statping-windows-${{ matrix.arch }}.zip statping.exe
rm -rf statping.exe
echo ::set-env name=compressed::statping-windows-${{ matrix.arch }}.zip
- name: Compress Darwin Builds
if: matrix.platform == 'darwin'
run: |
cd build
mv statping-darwin-10.6-${{ matrix.arch }} statping
chmod +x statping
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping
rm -rf statping
echo ::set-env name=compressed::statping-darwin-${{ matrix.arch }}.tar.gz
- name: Upload Compiled Statping Binary
uses: actions/upload-artifact@v1
with:
name: statping-${{ matrix.platform }}-${{ matrix.arch }}
path: ./build
- name: Upload Releases
id: upload-assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
with:
tag_name: dev-v${{ env.VERSION }}
draft: true
prerelease: true
files: build/${{ env.compressed }}
- name: Upload Compiled Binaries to S3
run: |
aws s3 cp build/${{ env.compressed }} s3://assets.statping.com/commit/${{ github.sha }}/
test:
needs: frontend
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
@ -97,13 +195,13 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- uses: actions/setup-node@v1
with:
node-version: '12.18.2'
- uses: actions/checkout@v2
node-version: 12.18.2
- name: Install Global Dependencies
run: npm install -g yarn sass newman cross-env wait-on @sentry/cli
@ -124,6 +222,7 @@ jobs:
- name: Install Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: |
make build certs
chmod +x statping
@ -172,13 +271,13 @@ jobs:
COVERALLS: ${{ secrets.COVERALLS }}
test-postman-sqlite:
needs: compile
needs: frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- name: Setting ENV's
run: |
@ -196,16 +295,15 @@ jobs:
- name: Install Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: |
make build
chmod +x statping
mv statping $(go env GOPATH)/bin/
- name: Run Statping
run: |
API_SECRET=demosecret123 statping --port=8585 > /dev/null &
sleep 5
- name: Postman SQLite Tests
uses: matt-ball/newman-action@master
with:
@ -216,7 +314,7 @@ jobs:
delayRequest: 600
test-postman-mysql:
needs: compile
needs: frontend
runs-on: ubuntu-latest
services:
@ -233,7 +331,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- name: Setting ENV's
run: |
@ -251,18 +349,17 @@ jobs:
- name: Install Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
MJML_APP: ${{ secrets.MJML_APP }}
MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }}
run: |
make build
chmod +x statping
mv statping $(go env GOPATH)/bin/
- name: Run Statping
run: |
API_SECRET=demosecret123 statping --port=8585 > /dev/null &
sleep 5
- name: Postman MySQL Tests
uses: matt-ball/newman-action@master
with:
@ -273,7 +370,7 @@ jobs:
delayRequest: 600
test-postman-postgres:
needs: compile
needs: frontend
runs-on: ubuntu-latest
services:
@ -291,7 +388,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- name: Setting ENV's
run: |
@ -314,12 +411,10 @@ jobs:
make build
chmod +x statping
mv statping $(go env GOPATH)/bin/
- name: Run Statping
run: |
API_SECRET=demosecret123 statping --port=8585 > /dev/null &
sleep 5
- name: Postman Postgres Tests
uses: matt-ball/newman-action@master
with:
@ -329,66 +424,8 @@ jobs:
timeoutRequest: 30000
delayRequest: 600
build-binaries:
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
- uses: actions/checkout@v2
- name: Install cross compiling libraries
run: |
sudo apt-get update
sudo apt-get install -y automake autogen build-essential ca-certificates libsqlite3-dev \
gcc-5-arm-linux-gnueabi g++-5-arm-linux-gnueabi libc6-dev-armel-cross linux-headers-generic \
gcc-5-arm-linux-gnueabihf g++-5-arm-linux-gnueabihf libc6-dev-armhf-cross \
gcc-5-aarch64-linux-gnu g++-5-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-5-mips-linux-gnu g++-5-mips-linux-gnu libc6-dev-mips-cross \
gcc-5-mipsel-linux-gnu g++-5-mipsel-linux-gnu libc6-dev-mipsel-cross \
gcc-5-mips64-linux-gnuabi64 g++-5-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
gcc-5-mips64el-linux-gnuabi64 g++-5-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \
gcc-5-multilib g++-5-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \
gcc-6-arm-linux-gnueabi g++-6-arm-linux-gnueabi libc6-dev-armel-cross \
gcc-6-arm-linux-gnueabihf g++-6-arm-linux-gnueabihf libc6-dev-armhf-cross \
gcc-6-aarch64-linux-gnu g++-6-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-6-mips-linux-gnu g++-6-mips-linux-gnu libc6-dev-mips-cross \
gcc-6-mipsel-linux-gnu g++-6-mipsel-linux-gnu libc6-dev-mipsel-cross \
gcc-6-mips64-linux-gnuabi64 g++-6-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
gcc-6-mips64el-linux-gnuabi64 g++-6-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \
gcc-6-multilib gcc-7-multilib g++-6-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \
libtool libxml2-dev uuid-dev libssl-dev swig openjdk-8-jdk pkg-config patch \
make xz-utils cpio wget zip unzip p7zip git mercurial bzr texinfo help2man cmake --no-install-recommends
sudo ln -s /usr/include/asm-generic/ /usr/include/asm
- name: Setting ENV's
run: |
echo "::add-path::$(go env GOPATH)/bin"
echo "::add-path::/opt/hostedtoolcache/node/12.18.2/x64/bin"
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Download Go mods
run: |
make test-deps
- name: Download Compiled Frontend (rice-box.go)
uses: actions/download-artifact@v1
with:
name: static-rice-box
path: ./source
- name: Build Binaries
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
MJML_APP: ${{ secrets.MJML_APP }}
MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }}
run: make build-folders build-linux build-linux-arm build-darwin build-win compress-folders
docker-release:
needs: [test, test-postman-sqlite, test-postman-mysql, test-postman-postgres]
needs: [test, build, test-postman-sqlite, test-postman-mysql, test-postman-postgres]
runs-on: ubuntu-latest
steps:
- name: Checkout Statping Repo
@ -415,15 +452,30 @@ jobs:
key: buildx-docker-master
restore-keys: |
buildx-docker-master
- name: Docker Build :base
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: make buildx-base
- name: Docker Build :dev
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: make buildx-dev
sentry-release:
needs: [test, test-postman-sqlite, test-postman-postgres, test-postman-mysql]
runs-on: ubuntu-latest
steps:
- name: Checkout Statping Repo
uses: actions/checkout@v2
- name: Setup Sentry CLI
uses: mathrix-education/setup-sentry-cli@master
with:
version: latest
url: ${{ secrets.SENTRY_URL }}
token: ${{ secrets.SENTRY_AUTH_TOKEN }}
organization: statping
- name: Setting ENV's
run: echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Sentry Release
run: make sentry-release

View File

@ -1,4 +1,4 @@
name: Master Release
name: Master Build
on:
push:
branches:
@ -7,52 +7,41 @@ on:
- '**.md'
jobs:
compile:
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- uses: actions/setup-node@v1
with:
node-version: '12.18.2'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- uses: actions/checkout@v2
node-version: 12.18.2
- name: Add GOBIN to PATH
- name: Set Version
run: |
echo "::add-path::$(go env GOPATH)/bin"
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Font Awesome authentication
env:
FONTAWESOME_TOKEN: ${{ secrets.FONTAWESOME_TOKEN }}
run: |
npm config set "@fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" $FONTAWESOME_TOKEN
- name: Install Global Dependencies
run: npm install -g yarn sass cross-env
- name: Download Frontend Dependencies
if: steps.nodecache.outputs.cache-hit != 'true'
working-directory: ./frontend
run: yarn
- name: Download Go mods
if: steps.golangcache.outputs.cache-hit != 'true'
run: |
go mod download
go mod verify
make test-deps
- name: Build Frontend Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: make clean compile
- name: Upload Compiled Frontend (rice-box.go)
@ -61,23 +50,130 @@ jobs:
name: static-rice-box
path: ./source
- name: Upload Assets to S3
- name: Configure AWS credentials for Asset uploads
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Upload Static Assets to S3
run: |
tar -czvf source.tar.gz source/
cp source.tar.gz source-${VERSION}.tar.gz
aws s3 cp source.tar.gz s3://assets.statping.com/
aws s3 cp source-${VERSION}.tar.gz s3://assets.statping.com/
aws s3 cp source.tar.gz s3://assets.statping.com/commit/${{ github.sha }}/
rm -rf source.tar.gz
rm -rf source-${VERSION}.tar.gz
aws s3 cp source/dist/css/ s3://assets.statping.com/css/ --recursive
aws s3 cp source/dist/js/ s3://assets.statping.com/js/ --recursive
aws s3 cp source/dist/scss/ s3://assets.statping.com/scss/ --recursive
aws s3 cp install.sh s3://assets.statping.com/
build:
needs: frontend
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux]
arch: [386, amd64, arm-7, arm-6, arm64]
include:
- platform: darwin
arch: amd64
- platform: windows
arch: amd64
steps:
- uses: actions/checkout@v2
- name: Download Compiled Frontend (rice-box.go)
uses: actions/download-artifact@v1
with:
name: static-rice-box
path: ./source
- name: Configure AWS credentials for Asset uploads
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Add GOBIN to PATH
run: |
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Set Linux Build Flags
if: matrix.platform != 'darwin'
run: echo ::set-env name=BUILD_FLAGS::'-extldflags -static'
shell: bash
- name: Build ${{ matrix.platform }}/${{ matrix.arch }}
uses: crazy-max/ghaction-xgo@v1
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
with:
xgo_version: latest
go_version: 1.15.x
dest: build
prefix: statping
targets: ${{ matrix.platform }}/${{ matrix.arch }}
v: false
x: false
pkg: cmd
buildmode: pie
ldflags: -s -w -X main.VERSION=${{ env.VERSION }} -X main.COMMIT=${{ env.COMMIT }} ${{ env.BUILD_FLAGS }}
- name: Compress Linux Builds
if: matrix.platform == 'linux'
run: |
cd build
mv statping-linux-${{ matrix.arch }} statping
chmod +x statping
tar -czvf statping-linux-${{ matrix.arch }}.tar.gz statping
rm -rf statping
echo ::set-env name=compressed::statping-linux-${{ matrix.arch }}.tar.gz
- name: Compress Windows Builds
if: matrix.platform == 'windows'
run: |
cd build
mv statping-windows-4.0-${{ matrix.arch }}.exe statping.exe
chmod +x statping.exe
zip statping-windows-${{ matrix.arch }}.zip statping.exe
rm -rf statping.exe
echo ::set-env name=compressed::statping-windows-${{ matrix.arch }}.zip
- name: Compress Darwin Builds
if: matrix.platform == 'darwin'
run: |
cd build
mv statping-darwin-10.6-${{ matrix.arch }} statping
chmod +x statping
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping
rm -rf statping
echo ::set-env name=compressed::statping-darwin-${{ matrix.arch }}.tar.gz
- name: Upload Compiled Statping Binary
uses: actions/upload-artifact@v1
with:
name: statping-${{ matrix.platform }}-${{ matrix.arch }}
path: ./build
- name: Upload Releases
id: upload-assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
with:
tag_name: v${{ env.VERSION }}
draft: true
prerelease: true
files: build/${{ env.compressed }}
- name: Upload Compiled Binaries to S3
run: |
aws s3 cp build/${{ env.compressed }} s3://assets.statping.com/commit/${{ github.sha }}/
test:
needs: compile
needs: frontend
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
@ -99,13 +195,13 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- uses: actions/setup-node@v1
with:
node-version: '12.18.2'
- uses: actions/checkout@v2
node-version: 12.18.2
- name: Install Global Dependencies
run: npm install -g yarn sass newman cross-env wait-on @sentry/cli
@ -126,6 +222,7 @@ jobs:
- name: Install Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: |
make build certs
chmod +x statping
@ -137,6 +234,7 @@ jobs:
gotestsum --no-summary=skipped --format dots -- -covermode=count -coverprofile=coverage.out -p=1 ./...
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
DB_CONN: sqlite3
STATPING_DIR: ${{ github.workspace }}
API_SECRET: demopassword123
@ -173,13 +271,13 @@ jobs:
COVERALLS: ${{ secrets.COVERALLS }}
test-postman-sqlite:
needs: compile
needs: frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- name: Setting ENV's
run: |
@ -197,16 +295,15 @@ jobs:
- name: Install Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: |
make build
chmod +x statping
mv statping $(go env GOPATH)/bin/
- name: Run Statping
run: |
API_SECRET=demosecret123 statping --port=8585 > /dev/null &
sleep 5
- name: Postman SQLite Tests
uses: matt-ball/newman-action@master
with:
@ -217,7 +314,7 @@ jobs:
delayRequest: 600
test-postman-mysql:
needs: compile
needs: frontend
runs-on: ubuntu-latest
services:
@ -234,7 +331,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- name: Setting ENV's
run: |
@ -252,18 +349,17 @@ jobs:
- name: Install Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
MJML_APP: ${{ secrets.MJML_APP }}
MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }}
run: |
make build
chmod +x statping
mv statping $(go env GOPATH)/bin/
- name: Run Statping
run: |
API_SECRET=demosecret123 statping --port=8585 > /dev/null &
sleep 5
- name: Postman MySQL Tests
uses: matt-ball/newman-action@master
with:
@ -274,7 +370,7 @@ jobs:
delayRequest: 600
test-postman-postgres:
needs: compile
needs: frontend
runs-on: ubuntu-latest
services:
@ -292,7 +388,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- name: Setting ENV's
run: |
@ -310,16 +406,15 @@ jobs:
- name: Install Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: |
make build
chmod +x statping
mv statping $(go env GOPATH)/bin/
- name: Run Statping
run: |
API_SECRET=demosecret123 statping --port=8585 > /dev/null &
sleep 5
- name: Postman Postgres Tests
uses: matt-ball/newman-action@master
with:
@ -329,113 +424,8 @@ jobs:
timeoutRequest: 30000
delayRequest: 600
build-binaries:
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
- uses: actions/checkout@v2
- name: Install cross compiling libraries
run: |
sudo apt-get update
sudo apt-get install -y automake autogen build-essential ca-certificates libsqlite3-dev \
gcc-5-arm-linux-gnueabi g++-5-arm-linux-gnueabi libc6-dev-armel-cross linux-headers-generic \
gcc-5-arm-linux-gnueabihf g++-5-arm-linux-gnueabihf libc6-dev-armhf-cross \
gcc-5-aarch64-linux-gnu g++-5-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-5-mips-linux-gnu g++-5-mips-linux-gnu libc6-dev-mips-cross \
gcc-5-mipsel-linux-gnu g++-5-mipsel-linux-gnu libc6-dev-mipsel-cross \
gcc-5-mips64-linux-gnuabi64 g++-5-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
gcc-5-mips64el-linux-gnuabi64 g++-5-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \
gcc-5-multilib g++-5-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \
gcc-6-arm-linux-gnueabi g++-6-arm-linux-gnueabi libc6-dev-armel-cross \
gcc-6-arm-linux-gnueabihf g++-6-arm-linux-gnueabihf libc6-dev-armhf-cross \
gcc-6-aarch64-linux-gnu g++-6-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-6-mips-linux-gnu g++-6-mips-linux-gnu libc6-dev-mips-cross \
gcc-6-mipsel-linux-gnu g++-6-mipsel-linux-gnu libc6-dev-mipsel-cross \
gcc-6-mips64-linux-gnuabi64 g++-6-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
gcc-6-mips64el-linux-gnuabi64 g++-6-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \
gcc-6-multilib gcc-7-multilib g++-6-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \
libtool libxml2-dev uuid-dev libssl-dev swig openjdk-8-jdk pkg-config patch \
make xz-utils cpio wget zip unzip p7zip git mercurial bzr texinfo help2man cmake --no-install-recommends
sudo ln -s /usr/include/asm-generic/ /usr/include/asm
- name: Setting ENV's
run: |
echo "::add-path::$(go env GOPATH)/bin"
echo "::add-path::/opt/hostedtoolcache/node/12.18.2/x64/bin"
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Download Go mods
run: |
make test-deps
- name: Download Compiled Frontend (rice-box.go)
uses: actions/download-artifact@v1
with:
name: static-rice-box
path: ./source
- name: Build Binaries
env:
VERSION: ${{ env.VERSION }}
COMMIT: $GITHUB_SHA
MJML_APP: ${{ secrets.MJML_APP }}
MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }}
run: make build-folders build-linux build-linux-arm build-darwin build-win compress-folders
- name: Upload Builds
uses: actions/upload-artifact@v1
with:
name: builds
path: ./build
upload-release:
needs: [test, test-postman-sqlite, test-postman-mysql, test-postman-postgres, build-binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setting ENV's
run: |
echo "::add-path::$(go env GOPATH)/bin"
echo "::add-path::/opt/hostedtoolcache/node/12.18.2/x64/bin"
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Download Builds
uses: actions/download-artifact@v1
with:
name: builds
path: ./builds
- name: Upload Releases
id: upload-assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
with:
tag_name: v${{ env.VERSION }}
draft: false
prerelease: true
files: |
builds/statping-linux-386.tar.gz
builds/statping-linux-amd64.tar.gz
builds/statping-linux-arm6.tar.gz
builds/statping-linux-arm7.tar.gz
builds/statping-linux-arm64.tar.gz
builds/statping-darwin-amd64.tar.gz
builds/statping-darwin-386.tar.gz
builds/statping-windows-386.zip
builds/statping-windows-amd64.zip
builds/statping-windows-arm.zip
docker-release:
needs: upload-release
needs: [build, test, test-postman-sqlite, test-postman-postgres, test-postman-mysql]
runs-on: ubuntu-latest
steps:
- name: Checkout Statping Repo
@ -462,54 +452,36 @@ jobs:
key: buildx-docker
restore-keys: |
buildx-docker
- name: Docker Build :base
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: make buildx-base
- name: Docker Build :lastest
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: make buildx-latest
sentry-release:
needs: upload-release
needs: [test, test-postman-sqlite, test-postman-postgres, test-postman-mysql]
runs-on: ubuntu-latest
steps:
- name: Checkout Statping Repo
uses: actions/checkout@v2
- name: Setup Sentry CLI
uses: mathrix-education/setup-sentry-cli@master
with:
version: latest
url: ${{ secrets.SENTRY_URL }}
token: ${{ secrets.SENTRY_AUTH_TOKEN }}
organization: statping
- name: Setting ENV's
run: echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Sentry Backend Release
uses: tclindner/sentry-releases-action@v1.0.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
SENTRY_ORG: statping
SENTRY_PROJECT: backend
with:
tagName: v${{ env.VERSION }}
environment: production
- name: Sentry Frontend Release
uses: tclindner/sentry-releases-action@v1.0.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
SENTRY_ORG: statping
SENTRY_PROJECT: frontend
with:
tagName: v${{ env.VERSION }}
environment: production
- name: Sentry Release
run: make sentry-release
homebrew-release:
needs: upload-release
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout Statping Repo
@ -526,7 +498,7 @@ jobs:
run: make publish-homebrew
slack-update:
needs: upload-release
needs: [release]
runs-on: ubuntu-latest
steps:
- name: Checkout Statping Repo
@ -537,7 +509,7 @@ jobs:
shell: bash
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2.0.0
uses: rtCamp/action-slack-notify@master
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_URL }}
SLACK_CHANNEL: dev

View File

@ -6,6 +6,13 @@ on:
- '*/*' # matches every branch containing a single '/'
- '!master' # excludes master
- '!dev' # excludes dev
pull_request:
branches:
- '*' # matches every branch
- '*/*' # matches every branch containing a single '/'
- '!master' # excludes master
- '!dev' # excludes dev
jobs:
compile:
@ -25,13 +32,6 @@ jobs:
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Font Awesome authentication
env:
FONTAWESOME_TOKEN: ${{ secrets.FONTAWESOME_TOKEN }}
run: |
npm config set "@fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" $FONTAWESOME_TOKEN
- name: Install Global Dependencies
run: npm install -g yarn sass cross-env
@ -83,10 +83,10 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: 1.15.x
- uses: actions/setup-node@v1
with:
node-version: '12.18.2'
node-version: 12.18.2
- uses: actions/checkout@v2
- name: Install Global Dependencies
@ -120,6 +120,7 @@ jobs:
SASS=`which sass` gotestsum --no-summary=skipped --format dots -- -covermode=count -coverprofile=coverage.out -p=1 ./...
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
DB_CONN: sqlite3
STATPING_DIR: ${{ github.workspace }}
API_SECRET: demopassword123
@ -152,6 +153,7 @@ jobs:
- name: Install Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: |
make build
chmod +x statping

View File

@ -1,3 +1,7 @@
# 0.90.63 (08-17-2020)
- Modified build process to use xgo for all arch builds
- Modified Statping's Push Notifications server notifier to match with Firebase/gorush params
# 0.90.62 (08-07-2020)
- Added Notification logs
- Fixed issues with Notifer After (x) failures for notifications

View File

@ -330,9 +330,12 @@ valid-sign:
gpg --verify statping.asc
sentry-release:
sentry-cli releases new -p backend -p frontend v${VERSION}
sentry-cli releases set-commits --auto v${VERSION}
sentry-cli releases finalize v${VERSION}
sentry-cli releases --org statping --project backend new v${VERSION}
sentry-cli releases --org statping --project backend set-commits v${VERSION} --auto
sentry-cli releases --org statping --project backend finalize v${VERSION}
sentry-cli releases --org statping --project frontend new v${VERSION}
sentry-cli releases --org statping --project frontend set-commits v${VERSION} --auto
sentry-cli releases --org statping --project frontend finalize v${VERSION}
download-bins: clean
mkdir build || true
@ -376,6 +379,9 @@ certs:
-keyout key.pem \
-subj "/C=US/ST=California/L=Santa Monica/O=Statping/OU=Development/CN=localhost"
xgo-latest:
xgo --go $(GOVERSION) --targets=linux/amd64,linux/386,linux/arm-7,linux/arm-6,linux/arm64,windows/386,windows/amd64,darwin/386,darwin/amd64 --out='statping' --pkg='cmd' --dest=build --tags 'netgo' --ldflags='-X main.VERSION=${VERSION} -X main.COMMIT=$(COMMIT) -linkmode external -extldflags "-static"' .
buildx-latest: multiarch
docker buildx create --name statping-latest
docker buildx inspect --builder statping-latest --bootstrap
@ -409,5 +415,10 @@ check:
@echo "yarn: $(shell yarn --version) - $(shell which yarn)" && yarn --version >/dev/null 2>&1 || (echo "ERROR: yarn is required."; exit 1)
@echo "All required programs are installed!"
#sentry-release:
# sentry-cli releases new -p $SENTRY_PROJECT $VERSION
# sentry-cli releases set-commits --auto $VERSION
# sentry-cli releases files $VERSION upload-sourcemaps dist
.PHONY: all check build certs multiarch install-darwin go-build build-all buildx-base buildx-dev buildx-latest build-alpine test-all test test-api docker frontend up down print_details lite sentry-release snapcraft build-linux build-mac build-win build-all postman
.SILENT: travis_s3_creds

View File

@ -25,6 +25,15 @@
</div>
</div>
<div v-for="message in messagesInRange" class="bg-light shadow-sm p-3 pr-4 pl-4 col-12 mb-4">
<font-awesome-icon icon="calendar" class="mr-3" size="1x"/> {{message.description}}
<span class="d-block small text-muted mt-3">
Starts at <strong>{{niceDate(message.start_on)}}</strong> till <strong>{{niceDate(message.end_on)}}</strong>
({{dur(parseISO(message.start_on), parseISO(message.end_on))}})
</span>
</div>
<div v-for="(service, index) in services" class="service_block" v-bind:key="index">
<ServiceInfo :service=service />
</div>
@ -32,6 +41,10 @@
</template>
<script>
import isAfter from "date-fns/isAfter";
import parseISO from "date-fns/parseISO";
import isBefore from "date-fns/isBefore";
const ServiceInfo = () => import(/* webpackChunkName: "dashboard" */ '@/components/Dashboard/ServiceInfo')
export default {
@ -45,6 +58,9 @@
}
},
computed: {
messagesInRange() {
return this.$store.getters.globalMessages.filter(m => this.isAfter(this.now(), m.start_on) && this.isBefore(this.now(), m.end_on))
},
services() {
return this.$store.getters.services
}

View File

@ -9,7 +9,7 @@
<span class="d-block text-dim float-right small mt-3 mb-1">Failure #{{failure.id}}</span>
</code>
</div>
<div v-if="loaded" v-for="message in messages" class="bg-light shadow-sm p-3 pr-4 pl-4 col-12 mt-3">
<div v-if="loaded" v-for="message in $store.getters.serviceMessages(service.id)" class="bg-light shadow-sm p-3 pr-4 pl-4 col-12 mt-3">
<font-awesome-icon icon="calendar" class="mr-3" size="1x"/> {{message.description}}
<span class="d-block small text-muted mt-3">
Starts at <strong>{{niceDate(message.start_on)}}</strong> till <strong>{{niceDate(message.end_on)}}</strong>
@ -44,7 +44,6 @@ name: "ServiceEvents",
},
data() {
return {
messages: null,
incidents: null,
failure: null,
loaded: false,
@ -53,6 +52,11 @@ name: "ServiceEvents",
mounted() {
this.load()
},
computed: {
messages() {
return this.$store.getters.serviceMessages(this.service.id)
}
},
methods: {
async load() {
this.loaded = false
@ -64,7 +68,7 @@ name: "ServiceEvents",
this.loaded = true
},
async getMessages() {
this.messages = await Api.messages()
// this.messages = this.$store.getters.serviceMessages(this.service.id)
},
async getFailure() {
const f = await Api.service_failures(this.service.id, null, null, 1)
@ -76,7 +80,3 @@ name: "ServiceEvents",
}
}
</script>
<style scoped>
</style>

View File

@ -1,9 +1,10 @@
import Vue from "vue";
const { startOfToday, startOfMonth, lastDayOfMonth, subSeconds, getUnixTime, fromUnixTime, differenceInSeconds, formatDistance, addMonths, isWithinInterval } = require('date-fns')
const { startOfToday, startOfMonth, lastDayOfMonth, subSeconds, getUnixTime, fromUnixTime, differenceInSeconds, formatDistance, addMonths, addSeconds, isWithinInterval } = require('date-fns')
import formatDistanceToNow from 'date-fns/formatDistanceToNow'
import format from 'date-fns/format'
import parseISO from 'date-fns/parseISO'
import addSeconds from 'date-fns/addSeconds'
import isBefore from 'date-fns/isBefore'
import isAfter from 'date-fns/isAfter'
export default Vue.mixin({
methods: {
@ -34,6 +35,12 @@ export default Vue.mixin({
nowSubtract(seconds) {
return subSeconds(new Date(), seconds)
},
isAfter(date, compare) {
return isAfter(date, parseISO(compare))
},
isBefore(date, compare) {
return isBefore(date, parseISO(compare))
},
dur(t1, t2) {
return formatDistance(t1, t2)
},
@ -178,6 +185,9 @@ export default Vue.mixin({
},
addMonths(date, amount) {
return addMonths(date, amount)
},
addSeconds(date, amount) {
return addSeconds(date, amount)
}
}
});

View File

@ -52,12 +52,12 @@ export default new Vuex.Store({
isAdmin: state => state.admin,
isUser: state => state.user,
globalMessages: state => state.messages.filter(s => !s.service || s.service === 0),
servicesInOrder: state => state.services.sort((a, b) => a.order_id - b.order_id),
servicesNoGroup: state => state.services.filter(g => g.group_id === 0).sort((a, b) => a.order_id - b.order_id),
groupsInOrder: state => state.groups.sort((a, b) => a.order_id - b.order_id),
groupsClean: state => state.groups.filter(g => g.name !== '').sort((a, b) => a.order_id - b.order_id),
groupsCleanInOrder: state => state.groups.filter(g => g.name !== '').sort((a, b) => a.order_id - b.order_id).sort((a, b) => a.order_id - b.order_id),
serviceCheckins: (state) => (id) => {
return state.checkins.filter(c => c.service_id === id)
},

5
go.mod
View File

@ -9,9 +9,9 @@ require (
github.com/fatih/structs v1.1.0
github.com/foomo/simplecert v1.7.5
github.com/foomo/tlsconfig v0.0.0-20180418120404-b67861b076c9
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/getsentry/sentry-go v0.5.1
github.com/go-mail/mail v2.3.1+incompatible
github.com/golang/protobuf v1.4.0
github.com/gorilla/mux v1.7.4
github.com/hako/durafmt v0.0.0-20200605151348-3a43fc422dd9
github.com/jinzhu/gorm v1.9.12
@ -24,14 +24,15 @@ require (
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.0.0
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.6.3
github.com/stretchr/testify v1.5.1
github.com/t-tiger/gorm-bulk-insert/v2 v2.0.1
github.com/tdewolff/minify/v2 v2.8.0
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 // indirect
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c // indirect
google.golang.org/grpc v1.28.1
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/mail.v2 v2.3.1 // indirect

8
go.sum
View File

@ -114,7 +114,6 @@ github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
@ -398,7 +397,6 @@ github.com/liquidweb/liquidweb-go v1.6.1/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVL
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2/go.mod h1:0KeJpeMD6o+O4hW7qJOT7vyQPKrWmj26uf5wMc/IiIs=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
@ -576,12 +574,6 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/t-tiger/gorm-bulk-insert/v2 v2.0.1 h1:HGVkRrwDCbmSP6h1CoBDj6l/mhnvsP5JbYaQ4ss0R6o=
github.com/t-tiger/gorm-bulk-insert/v2 v2.0.1/go.mod h1:I3xbaE9ud9/TEXzehwkHx86SyJwqeSNsX2X5oV61jIg=
github.com/tdewolff/minify/v2 v2.8.0 h1:t3tOPWkTpKhsgxm3IM9Sy8hE2eIt30Oaa+2havJGGIE=
github.com/tdewolff/minify/v2 v2.8.0/go.mod h1:6zN8VLhMfFxNrwHROcboYNo2+huPNu4SV8DPh3PUQ8E=
github.com/tdewolff/parse/v2 v2.4.4 h1:uMdbQRtYbKR/msP9CbI7li9wK6pionYiH6s7ipltyGY=
github.com/tdewolff/parse/v2 v2.4.4/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho=
github.com/tdewolff/test v1.0.6 h1:76mzYJQ83Op284kMT+63iCNCI7NEERsIN8dLM+RiKr4=
github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
github.com/timewasted/linode v0.0.0-20160829202747-37e84520dcf7 h1:CpHxIaZzVy26GqJn8ptRyto8fuoYOd1v0fXm9bG3wQ8=
github.com/timewasted/linode v0.0.0-20160829202747-37e84520dcf7/go.mod h1:imsgLplxEC/etjIhdr3dNzV3JeT27LbVu5pYWm0JCBY=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=

View File

@ -42,13 +42,8 @@ var Mobile = &mobilePush{&notifications.Notification{
Placeholder: "A list of your Mobile device push notification ID's.",
DbField: "var1",
IsHidden: true,
}, {
Type: "number",
Title: "Array of device numbers",
Placeholder: "1 for iphone 2 for android",
DbField: "var2",
IsHidden: true,
}}},
},
}},
}
func dataJson(s services.Service, f failures.Failure) map[string]interface{} {
@ -120,7 +115,7 @@ func (m *mobilePush) OnTest() (string, error) {
// Send will send message to Statping push notifications endpoint
func (m *mobilePush) Send(pushMessage *pushArray) error {
pushMessage.Tokens = []string{m.Var1.String}
pushMessage.Platform = utils.ToInt(m.Var2)
pushMessage.Platform = 2
_, err := pushRequest(pushMessage)
if err != nil {
return err
@ -138,8 +133,7 @@ func pushRequest(msg *pushArray) ([]byte, error) {
if err != nil {
return nil, err
}
url := "https://push.statping.com/api/push"
body, _, err = utils.HttpRequest(url, "POST", "application/json", nil, bytes.NewBuffer(body), time.Duration(20*time.Second), false, nil)
body, _, err = utils.HttpRequest("https://push.statping.com/api/push", "POST", "application/json", nil, bytes.NewBuffer(body), time.Duration(20*time.Second), false, nil)
return body, err
}

View File

@ -40,7 +40,7 @@ func SentryInit(v *string, allow bool) {
}
goEnv := Params.GetString("GO_ENV")
allowReports := Params.GetBool("ALLOW_REPORTS")
if allowReports || allow || goEnv == "test" {
if allow || goEnv == "test" || allowReports {
if err := sentry.Init(sentry.ClientOptions{
Dsn: errorReporter,
Environment: goEnv,
@ -60,9 +60,16 @@ func SentryErr(err error) {
sentry.CaptureException(err)
}
func sentryTags() map[string]string {
val := make(map[string]string)
val["database"] = Params.GetString("DB_CONN")
return val
}
func SentryLogEntry(entry *Logger.Entry) {
e := sentry.NewEvent()
e.Message = entry.Message
e.Tags = sentryTags()
e.Release = Version
e.Contexts = entry.Data
sentry.CaptureEvent(e)

View File

@ -1 +1 @@
0.90.62
0.90.63