diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 3777601f..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,4 +0,0 @@ -github: hunterlong -patreon: statping -open_collective: statping -custom: ['https://www.nfoservers.com/donate.pl?force_recipient=1&recipient=info%40socialeck.com', 'https://www.buymeacoffee.com/hunterlong'] diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md deleted file mode 100644 index fe7f2b99..00000000 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Bug Report -about: If you're having an issue or see an error - ---- - -### Describe the bug -Try to explain what issue your'e having in detail. You can copy and paste the issue from the log file in your root directory `/logs/statping.log`. - -You can set the environment variable `ALLOW_REPORTS` to `true` to allow errors to be sent to our error reporting server. It's super helpful. - -### To Reproduce -Steps to reproduce the behavior: -1. I'm using version: '...' -2. I went to '....' -3. Press this button '....' -4. And things did '....' - -### Expected Behavior -A clear and concise description of what you expected to happen. - -### Screenshots -If applicable, add screenshots to help explain your problem. - -[![Slack](https://slack.statping.com/badge.svg)](https://slack.statping.com/) [![GitHub release](https://img.shields.io/github/release/statping/statping.svg)](https://github.com/statping/statping/releases/latest) [![Build Status](https://travis-ci.com/statping/statping.svg?branch=master)](https://travis-ci.com/hunterlong/statping) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 9e2d1b42..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Feature Request -about: Suggest a feature and let's see what others say - ---- - -### What would you like on Statping? -A clear and concise description of what you want to happen. - -### Describe the solution you'd like -A clear and concise description of what you want to happen. - -### Describe alternatives you've considered -A clear and concise description of any alternative solutions or features you've considered. - -### Is your feature request related to a problem? Please describe. -I'm always frustrated when [...] - -### Additional context -Add any other context or screenshots about the feature request here. - -[![Slack](https://slack.statping.com/badge.svg)](https://slack.statping.com/) [![GitHub release](https://img.shields.io/github/release/statping/statping.svg)](https://github.com/statping/statping/releases/latest) [![Build Status](https://travis-ci.com/hunterlong/statping.svg?branch=master)](https://travis-ci.com/hunterlong/statping) diff --git a/.github/ISSUE_TEMPLATE/issue-report.md b/.github/ISSUE_TEMPLATE/issue-report.md deleted file mode 100644 index e1ad6123..00000000 --- a/.github/ISSUE_TEMPLATE/issue-report.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Issue Report -about: If you're having an issue or see an error - ---- - -### Describe the bug -A clear and concise description of what the bug is. - -You can set the environment variable `ALLOW_REPORTS` to `true` to allow errors to be sent to our error reporting server. It's super helpful. - -### To Reproduce -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -### Expected behavior -A clear and concise description of what you expected to happen. - -### Screenshots or Logs -If applicable, add screenshots to help explain your problem. If you can, provide any logs from the latest `logs/statping.log` file. - -[![Slack](https://slack.statping.com/badge.svg)](https://slack.statping.com/) [![GitHub release](https://img.shields.io/github/release/hunterlong/statup.svg)](https://github.com/statping/statping/releases/latest) [![Build Status](https://travis-ci.com/hunterlong/statup.svg?branch=master)](https://travis-ci.com/hunterlong/statup) diff --git a/.github/workflows/development.yml b/.github/workflows/1_dev.yml similarity index 72% rename from .github/workflows/development.yml rename to .github/workflows/1_dev.yml index 2553984c..7b00d255 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/1_dev.yml @@ -1,4 +1,4 @@ -name: Development Build +name: 1. Development Build and Testing on: push: branches: @@ -14,10 +14,10 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.17.x - uses: actions/setup-node@v1 with: - node-version: 12.18.2 + node-version: 16.14.0 - name: Set Version run: | @@ -54,19 +54,6 @@ jobs: 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: Upload Static Assets to S3 - run: | - tar -czvf source.tar.gz source/ - aws s3 cp source.tar.gz s3://assets.statping.com/commit/${{ github.sha }}/ - rm -rf source.tar.gz - build: needs: frontend runs-on: ubuntu-latest @@ -75,8 +62,12 @@ jobs: platform: [linux] arch: [386, amd64, arm-7, arm-6, arm64] include: + - platform: darwin + arch: arm64 - platform: darwin arch: amd64 + - platform: windows + arch: 386 - platform: windows arch: amd64 @@ -89,13 +80,6 @@ jobs: 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 "VERSION=$(cat version.txt)" >> $GITHUB_ENV @@ -108,15 +92,16 @@ jobs: echo "XGO_TAGS=netgo osusergo linux sqlite_omit_load_extension" >> $GITHUB_ENV shell: bash - - name: Set Darwin Build Flags + - name: Set MacOS (Darwin) Build Flags if: matrix.platform == 'darwin' - run: echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV + run : | + echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV shell: bash - name: Set Windows Build Flags if: matrix.platform == 'windows' run: | - echo "BUILD_FLAGS=-extldflags -static" >> $GITHUB_ENV + echo "BUILD_FLAGS=-extldflags -static -buildmode=exe" >> $GITHUB_ENV echo "XGO_TAGS=netgo osusergo sqlite_omit_load_extension" >> $GITHUB_ENV shell: bash @@ -127,12 +112,12 @@ jobs: COMMIT: ${{ github.sha }} with: xgo_version: latest - go_version: 1.15.x + go_version: 1.17.x dest: build prefix: statping targets: ${{ matrix.platform }}/${{ matrix.arch }} - v: false - x: false + v: true + x: true pkg: cmd buildmode: pie tags: ${{ env.XGO_TAGS }} @@ -152,19 +137,19 @@ jobs: if: matrix.platform == 'windows' run: | cd build - mv statping-windows-4.0-${{ matrix.arch }}.exe statping.exe + mv statping-windows-${{ matrix.arch }}.exe statping.exe chmod +x statping.exe zip statping-windows-${{ matrix.arch }}.zip statping.exe rm -rf statping.exe echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV - - name: Compress Darwin Builds + - name: Compress MacOS (Darwin) Builds if: matrix.platform == 'darwin' run: | cd build - mv statping-darwin-10.6-${{ matrix.arch }} statping + mv statping-darwin-${{ matrix.arch }} statping chmod +x statping - tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping + tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz * rm -rf statping echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV @@ -174,22 +159,6 @@ jobs: 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 @@ -217,10 +186,10 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.17.x - uses: actions/setup-node@v1 with: - node-version: 12.18.2 + node-version: 16.14.0 - name: Install Global Dependencies run: npm install -g yarn sass newman cross-env wait-on @sentry/cli @@ -228,7 +197,7 @@ jobs: - name: Setting ENV's run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash @@ -272,7 +241,7 @@ jobs: MOBILE_NUMBER: ${{ secrets.MOBILE_NUMBER }} PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }} PUSHOVER_API: ${{ secrets.PUSHOVER_API }} - SLACK_URL: ${{ secrets.SLACK_URL }} + SLACK_URL: https://hooks.slack.com/services/TTJ1B90DP/RENU20O9M/9uI823SUnYBuGcxYlpSimD6H TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} TELEGRAM_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL }} TWILIO_SID: ${{ secrets.TWILIO_SID }} @@ -287,12 +256,12 @@ jobs: SNS_REGION: ${{ secrets.SNS_REGION }} SNS_TOPIC: ${{ secrets.SNS_TOPIC }} - - name: Coveralls Testing Coverage - run: | - go get github.com/mattn/goveralls - goveralls -coverprofile=coverage.out -repotoken $COVERALLS - env: - COVERALLS: ${{ secrets.COVERALLS }} +# - name: Coveralls Testing Coverage +# run: | +# go get github.com/mattn/goveralls +# goveralls -coverprofile=coverage.out -repotoken $COVERALLS +# env: +# COVERALLS: ${{ secrets.COVERALLS }} test-postman-sqlite: needs: frontend @@ -301,12 +270,12 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.17.x - name: Setting ENV's run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash @@ -355,12 +324,12 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.17.x - name: Setting ENV's run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash @@ -412,12 +381,12 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.17.x - name: Setting ENV's run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash @@ -447,65 +416,3 @@ jobs: environment: ./dev/postman_env_postgres.json timeoutRequest: 30000 delayRequest: 600 - - docker-release: - needs: [test, build, test-postman-sqlite, test-postman-mysql, test-postman-postgres] - runs-on: ubuntu-latest - steps: - - name: Checkout Statping Repo - uses: actions/checkout@v2 - - - name: Setting ENV's - run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV - shell: bash - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - id: buildx - with: - install: true - - - name: Docker Login - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin - - - name: Cache Docker layers - uses: actions/cache@v2 - id: buildx-docker-master - with: - path: /tmp/.buildx-cache - key: buildx-docker-master - restore-keys: | - buildx-docker-master - - name: Docker Build :base - run: make buildx-base - - - name: Docker Build :dev - 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 "VERSION=$(cat version.txt)" >> $GITHUB_ENV -# shell: bash -# -# - name: Sentry Release -# run: make sentry-release diff --git a/.github/workflows/2_unstable.yml b/.github/workflows/2_unstable.yml new file mode 100644 index 00000000..7fd72300 --- /dev/null +++ b/.github/workflows/2_unstable.yml @@ -0,0 +1,501 @@ +name: 2. Unstable Build, Test and Deploy +on: + push: + branches: + - unstable + paths-ignore: + - '**.md' + +jobs: + + frontend: + runs-on: [self-hosted, linux, aboutcher-hosted, rocky8] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.17.x + - uses: actions/setup-node@v1 + with: + node-version: 16.14.0 + + - name: Set Version + run: | + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV + shell: bash + + - name: Install Global Dependencies + run: npm install -g yarn sass cross-env mjml + + - name: Download Frontend Dependencies + working-directory: ./frontend + run: yarn + + - name: Download Go mods + run: | + go mod download + go mod verify + make test-deps + + - name: Build Frontend Statping + env: + VERSION: ${{ env.VERSION }} + COMMIT: ${{ github.sha }} + MJML_APP: ${{ secrets.MJML_APP }} + MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + run: make clean generate compile + + - name: Upload Compiled Frontend (rice-box.go) + uses: actions/upload-artifact@v1 + with: + name: static-rice-box + path: ./source + + build: + needs: frontend + runs-on: ubuntu-latest + strategy: + matrix: + platform: [linux] + arch: [386, amd64, arm-7, arm-6, arm64] + include: + - platform: darwin + arch: arm64 + - platform: darwin + arch: amd64 + - platform: windows + arch: 386 + - 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: Add GOBIN to PATH + run: | + echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV + shell: bash + + - name: Set Linux Build Flags + if: matrix.platform == 'linux' + run: | + echo "BUILD_FLAGS=-extldflags -static" >> $GITHUB_ENV + echo "XGO_TAGS=netgo osusergo linux sqlite_omit_load_extension" >> $GITHUB_ENV + shell: bash + + - name: Set MacOS (Darwin) Build Flags + if: matrix.platform == 'darwin' + run : | + echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV + shell: bash + + - name: Set Windows Build Flags + if: matrix.platform == 'windows' + run: | + echo "BUILD_FLAGS=-extldflags -static -buildmode=exe" >> $GITHUB_ENV + echo "XGO_TAGS=netgo osusergo sqlite_omit_load_extension" >> $GITHUB_ENV + 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.17.x + dest: build + prefix: statping + targets: ${{ matrix.platform }}/${{ matrix.arch }} + v: true + x: true + pkg: cmd + buildmode: pie + tags: ${{ env.XGO_TAGS }} + 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 "compressed=statping-linux-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV + + - name: Compress Windows Builds + if: matrix.platform == 'windows' + run: | + cd build + mv statping-windows-${{ matrix.arch }}.exe statping.exe + chmod +x statping.exe + zip statping-windows-${{ matrix.arch }}.zip statping.exe + rm -rf statping.exe + echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV + + - name: Compress MacOS (Darwin) Builds + if: matrix.platform == 'darwin' + run: | + cd build + mv statping-darwin-${{ matrix.arch }} statping + chmod +x statping + tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz * + rm -rf statping + echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV + + - 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 }} + +# test: +# needs: frontend +# runs-on: [self-hosted, linux, aboutcher-hosted] +# services: +# postgres: +# image: postgres:10.8 +# env: +# POSTGRES_USER: root +# POSTGRES_PASSWORD: password123 +# POSTGRES_DB: statping +# ports: +# - 5432:5432 +# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + +# mysql: +# image: mysql:5.7 +# env: +# MYSQL_ROOT_PASSWORD: password123 +# MYSQL_DATABASE: statping +# ports: +# - 3306:3306 +# 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.17.x +# - uses: actions/setup-node@v1 +# with: +# node-version: 16.14.0 + +# - name: Install Global Dependencies +# run: npm install -g yarn sass newman cross-env wait-on @sentry/cli + +# - name: Setting ENV's +# run: | +# echo "$(go env GOPATH)/bin" >> $GITHUB_PATH +# echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH +# echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV +# shell: bash + +# - name: Download Compiled Frontend (rice-box.go) +# uses: actions/download-artifact@v1 +# with: +# name: static-rice-box +# path: ./source + +# - name: Install Statping +# env: +# VERSION: ${{ env.VERSION }} +# COMMIT: ${{ github.sha }} +# run: | +# make build certs +# chmod +x statping +# mv statping $(go env GOPATH)/bin/ + +# - name: Go Tests +# run: | +# go get gotest.tools/gotestsum +# gotestsum --no-summary=skipped --format testname -- -covermode=count -coverprofile=coverage.out -p=1 ./... +# env: +# VERSION: ${{ env.VERSION }} +# COMMIT: ${{ github.sha }} +# DB_CONN: sqlite3 +# STATPING_DIR: ${{ github.workspace }} +# API_SECRET: demopassword123 +# DISABLE_LOGS: false +# ALLOW_REPORTS: true +# SAMPLE_DATA: true +# COVERALLS: ${{ secrets.COVERALLS }} +# DISCORD_URL: ${{ secrets.DISCORD_URL }} +# EMAIL_HOST: ${{ secrets.EMAIL_HOST }} +# EMAIL_USER: ${{ secrets.EMAIL_USER }} +# EMAIL_PASS: ${{ secrets.EMAIL_PASS }} +# EMAIL_OUTGOING: ${{ secrets.EMAIL_OUTGOING }} +# EMAIL_SEND_TO: ${{ secrets.EMAIL_SEND_TO }} +# EMAIL_PORT: ${{ secrets.EMAIL_PORT }} +# MOBILE_ID: ${{ secrets.MOBILE_ID }} +# MOBILE_NUMBER: ${{ secrets.MOBILE_NUMBER }} +# PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }} +# PUSHOVER_API: ${{ secrets.PUSHOVER_API }} +# SLACK_URL: ${{ secrets.SLACK_URL }} +# TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} +# TELEGRAM_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL }} +# TWILIO_SID: ${{ secrets.TWILIO_SID }} +# TWILIO_SECRET: ${{ secrets.TWILIO_SECRET }} +# TWILIO_FROM: ${{ secrets.TWILIO_FROM }} +# TWILIO_TO: ${{ secrets.TWILIO_TO }} +# TEST_EMAIL: ${{ secrets.TEST_EMAIL }} +# GOTIFY_URL: ${{ secrets.GOTIFY_URL }} +# GOTIFY_TOKEN: ${{ secrets.GOTIFY_TOKEN }} +# SNS_TOKEN: ${{ secrets.SNS_TOKEN }} +# SNS_SECRET: ${{ secrets.SNS_SECRET }} +# SNS_REGION: ${{ secrets.SNS_REGION }} +# SNS_TOPIC: ${{ secrets.SNS_TOPIC }} + +# - name: Coveralls Testing Coverage +# run: | +# go get github.com/mattn/goveralls +# goveralls -coverprofile=coverage.out -repotoken $COVERALLS +# env: +# COVERALLS: ${{ secrets.COVERALLS }} + + test-postman-sqlite: + needs: frontend + runs-on: [self-hosted, linux, aboutcher-hosted, centos7] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.17.x + + - name: Setting ENV's + run: | + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH + echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV + shell: bash + + - name: Download Compiled Frontend (rice-box.go) + uses: actions/download-artifact@v1 + with: + name: static-rice-box + path: ./source + + - 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: + apiKey: ${{ secrets.POSTMAN_API }} + collection: ./dev/postman.json + environment: ./dev/postman_env_sqlite.json + timeoutRequest: 30000 + delayRequest: 600 + + test-postman-mysql: + needs: frontend + runs-on: ubuntu-latest + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password123 + MYSQL_DATABASE: statping + ports: + - 3306:3306 + 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.17.x + + - name: Setting ENV's + run: | + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH + echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV + shell: bash + + - name: Download Compiled Frontend (rice-box.go) + uses: actions/download-artifact@v1 + with: + name: static-rice-box + path: ./source + + - 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: + apiKey: ${{ secrets.POSTMAN_API }} + collection: ./dev/postman.json + environment: ./dev/postman_env_mysql.json + timeoutRequest: 30000 + delayRequest: 600 + + test-postman-postgres: + needs: frontend + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:10.8 + env: + POSTGRES_USER: root + POSTGRES_PASSWORD: password123 + POSTGRES_DB: statping + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.17.x + + - name: Setting ENV's + run: | + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH + echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV + shell: bash + + - name: Download Compiled Frontend (rice-box.go) + uses: actions/download-artifact@v1 + with: + name: static-rice-box + path: ./source + + - 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: + apiKey: ${{ secrets.POSTMAN_API }} + collection: ./dev/postman.json + environment: ./dev/postman_env_postgres.json + timeoutRequest: 30000 + delayRequest: 600 + + docker-release: + needs: [build, test-postman-sqlite, test-postman-mysql, test-postman-postgres] + runs-on: [self-hosted, linux, aboutcher-hosted, rocky8] + + steps: + - name: Checkout Statping Repo + uses: actions/checkout@v2 + + - name: Setting ENV's + run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV + shell: bash + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + id: buildx + with: + install: true + + - name: Cache Docker layers + uses: actions/cache@v2 + id: buildx-docker-master + with: + path: /tmp/.buildx-cache + key: buildx-docker-master + restore-keys: | + buildx-docker-master + +# - name: Docker Login +# env: +# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} +# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} +# run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin# + +# - name: Docker Build :base +# run: make buildx-base + + - name: Docker Login + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin + + - name: Docker Build :dev + run: make buildx-dev + + +# sentry-release: +# needs: [test, test-postman-sqlite, test-postman-postgres, test-postman-mysql] +# runs-on: [self-hosted, linux, aboutcher-hosted] +# 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 "VERSION=$(cat version.txt)" >> $GITHUB_ENV +# shell: bash +# +# - name: Sentry Release +# run: make sentry-release diff --git a/.github/workflows/master.yml b/.github/workflows/3_stable.yml similarity index 59% rename from .github/workflows/master.yml rename to .github/workflows/3_stable.yml index c7ca3ce4..c92e0963 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/3_stable.yml @@ -1,23 +1,23 @@ -name: Master Build +name: 3. Stable Build, Test and Deploy on: push: branches: - - master + - stable paths-ignore: - '**.md' jobs: frontend: - runs-on: ubuntu-latest + runs-on: [self-hosted, linux, aboutcher-hosted, rocky8] steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.17.x - uses: actions/setup-node@v1 with: - node-version: 12.18.2 + node-version: 16.14.0 - name: Set Version run: | @@ -54,29 +54,33 @@ jobs: 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: Upload Static Assets to S3 - run: | - tar -czvf source.tar.gz source/ - aws s3 cp source.tar.gz s3://assets.statping.com/commit/${{ github.sha }}/ - rm -rf source.tar.gz +# - 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/commit/${{ github.sha }}/ +# rm -rf source.tar.gz build: - needs: frontend + needs: [test-postman-sqlite, test-postman-mysql, test-postman-postgres] runs-on: ubuntu-latest strategy: matrix: platform: [linux] arch: [386, amd64, arm-7, arm-6, arm64] include: + - platform: darwin + arch: arm64 - platform: darwin arch: amd64 + - platform: windows + arch: 386 - platform: windows arch: amd64 @@ -89,12 +93,12 @@ jobs: 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: 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: | @@ -108,7 +112,7 @@ jobs: echo "XGO_TAGS=netgo osusergo linux sqlite_omit_load_extension" >> $GITHUB_ENV shell: bash - - name: Set Darwin Build Flags + - name: Set MacOS (Darwin) Build Flags if: matrix.platform == 'darwin' run: echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV shell: bash @@ -116,7 +120,7 @@ jobs: - name: Set Windows Build Flags if: matrix.platform == 'windows' run: | - echo "BUILD_FLAGS=-extldflags -static" >> $GITHUB_ENV + echo "BUILD_FLAGS=-extldflags -static -buildmode=exe" >> $GITHUB_ENV echo "XGO_TAGS=netgo osusergo sqlite_omit_load_extension" >> $GITHUB_ENV shell: bash @@ -127,7 +131,7 @@ jobs: COMMIT: ${{ github.sha }} with: xgo_version: latest - go_version: 1.15.x + go_version: 1.17.x dest: build prefix: statping targets: ${{ matrix.platform }}/${{ matrix.arch }} @@ -152,17 +156,17 @@ jobs: if: matrix.platform == 'windows' run: | cd build - mv statping-windows-4.0-${{ matrix.arch }}.exe statping.exe + mv statping-windows-${{ matrix.arch }}.exe statping.exe chmod +x statping.exe zip statping-windows-${{ matrix.arch }}.zip statping.exe rm -rf statping.exe echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV - - name: Compress Darwin Builds + - name: Compress MacOS (Darwin) Builds if: matrix.platform == 'darwin' run: | cd build - mv statping-darwin-10.6-${{ matrix.arch }} statping + mv statping-darwin-${{ matrix.arch }} statping chmod +x statping tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping rm -rf statping @@ -186,127 +190,127 @@ jobs: 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 }}/ +# - 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 - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: password123 - POSTGRES_DB: statping - ports: - - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - - mysql: - image: mysql:5.7 - env: - MYSQL_ROOT_PASSWORD: password123 - MYSQL_DATABASE: statping - ports: - - 3306:3306 - 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.15.x - - uses: actions/setup-node@v1 - with: - node-version: 12.18.2 - - - name: Install Global Dependencies - run: npm install -g yarn sass newman cross-env wait-on @sentry/cli - - - name: Setting ENV's - run: | - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH - echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV - shell: bash - - - name: Download Compiled Frontend (rice-box.go) - uses: actions/download-artifact@v1 - with: - name: static-rice-box - path: ./source - - - name: Install Statping - env: - VERSION: ${{ env.VERSION }} - COMMIT: ${{ github.sha }} - run: | - make build certs - chmod +x statping - mv statping $(go env GOPATH)/bin/ - - - name: Go Tests - run: | - go get gotest.tools/gotestsum - gotestsum --no-summary=skipped --format testname -- -covermode=count -coverprofile=coverage.out -p=1 ./... - env: - VERSION: ${{ env.VERSION }} - COMMIT: ${{ github.sha }} - DB_CONN: sqlite3 - STATPING_DIR: ${{ github.workspace }} - API_SECRET: demopassword123 - DISABLE_LOGS: false - ALLOW_REPORTS: true - SAMPLE_DATA: true - COVERALLS: ${{ secrets.COVERALLS }} - DISCORD_URL: ${{ secrets.DISCORD_URL }} - EMAIL_HOST: ${{ secrets.EMAIL_HOST }} - EMAIL_USER: ${{ secrets.EMAIL_USER }} - EMAIL_PASS: ${{ secrets.EMAIL_PASS }} - EMAIL_OUTGOING: ${{ secrets.EMAIL_OUTGOING }} - EMAIL_SEND_TO: ${{ secrets.EMAIL_SEND_TO }} - EMAIL_PORT: ${{ secrets.EMAIL_PORT }} - MOBILE_ID: ${{ secrets.MOBILE_ID }} - MOBILE_NUMBER: ${{ secrets.MOBILE_NUMBER }} - PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }} - PUSHOVER_API: ${{ secrets.PUSHOVER_API }} - SLACK_URL: ${{ secrets.SLACK_URL }} - TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} - TELEGRAM_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL }} - TWILIO_SID: ${{ secrets.TWILIO_SID }} - TWILIO_SECRET: ${{ secrets.TWILIO_SECRET }} - TWILIO_FROM: ${{ secrets.TWILIO_FROM }} - TWILIO_TO: ${{ secrets.TWILIO_TO }} - TEST_EMAIL: ${{ secrets.TEST_EMAIL }} - GOTIFY_URL: ${{ secrets.GOTIFY_URL }} - GOTIFY_TOKEN: ${{ secrets.GOTIFY_TOKEN }} - SNS_TOKEN: ${{ secrets.SNS_TOKEN }} - SNS_SECRET: ${{ secrets.SNS_SECRET }} - SNS_REGION: ${{ secrets.SNS_REGION }} - SNS_TOPIC: ${{ secrets.SNS_TOPIC }} - - - name: Coveralls Testing Coverage - run: | - go get github.com/mattn/goveralls - goveralls -coverprofile=coverage.out -repotoken $COVERALLS - env: - COVERALLS: ${{ secrets.COVERALLS }} +# test: +# needs: frontend +# runs-on: ubuntu-latest +# services: +# postgres: +# image: postgres:10.8 +# env: +# POSTGRES_USER: root +# POSTGRES_PASSWORD: password123 +# POSTGRES_DB: statping +# ports: +# - 5432:5432 +# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 +# +# mysql: +# image: mysql:5.7 +# env: +# MYSQL_ROOT_PASSWORD: password123 +# MYSQL_DATABASE: statping +# ports: +# - 3306:3306 +# 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.17.x +# - uses: actions/setup-node@v1 +# with: +# node-version: 16.14.0 +# +# - name: Install Global Dependencies +# run: npm install -g yarn sass newman cross-env wait-on @sentry/cli +# +# - name: Setting ENV's +# run: | +# echo "$(go env GOPATH)/bin" >> $GITHUB_PATH +# echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH +# echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV +# shell: bash +# +# - name: Download Compiled Frontend (rice-box.go) +# uses: actions/download-artifact@v1 +# with: +# name: static-rice-box +# path: ./source +# +# - name: Install Statping +# env: +# VERSION: ${{ env.VERSION }} +# COMMIT: ${{ github.sha }} +# run: | +# make build certs +# chmod +x statping +# mv statping $(go env GOPATH)/bin/ +# +# - name: Go Tests +# run: | +# go get gotest.tools/gotestsum +# gotestsum --no-summary=skipped --format testname -- -covermode=count -coverprofile=coverage.out -p=1 ./... +# env: +# VERSION: ${{ env.VERSION }} +# COMMIT: ${{ github.sha }} +# DB_CONN: sqlite3 +# STATPING_DIR: ${{ github.workspace }} +# API_SECRET: demopassword123 +# DISABLE_LOGS: false +# ALLOW_REPORTS: true +# SAMPLE_DATA: true +# COVERALLS: ${{ secrets.COVERALLS }} +# DISCORD_URL: ${{ secrets.DISCORD_URL }} +# EMAIL_HOST: ${{ secrets.EMAIL_HOST }} +# EMAIL_USER: ${{ secrets.EMAIL_USER }} +# EMAIL_PASS: ${{ secrets.EMAIL_PASS }} +# EMAIL_OUTGOING: ${{ secrets.EMAIL_OUTGOING }} +# EMAIL_SEND_TO: ${{ secrets.EMAIL_SEND_TO }} +# EMAIL_PORT: ${{ secrets.EMAIL_PORT }} +# MOBILE_ID: ${{ secrets.MOBILE_ID }} +# MOBILE_NUMBER: ${{ secrets.MOBILE_NUMBER }} +# PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }} +# PUSHOVER_API: ${{ secrets.PUSHOVER_API }} +# SLACK_URL: ${{ secrets.SLACK_URL }} +# TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} +# TELEGRAM_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL }} +# TWILIO_SID: ${{ secrets.TWILIO_SID }} +# TWILIO_SECRET: ${{ secrets.TWILIO_SECRET }} +# TWILIO_FROM: ${{ secrets.TWILIO_FROM }} +# TWILIO_TO: ${{ secrets.TWILIO_TO }} +# TEST_EMAIL: ${{ secrets.TEST_EMAIL }} +# GOTIFY_URL: ${{ secrets.GOTIFY_URL }} +# GOTIFY_TOKEN: ${{ secrets.GOTIFY_TOKEN }} +# SNS_TOKEN: ${{ secrets.SNS_TOKEN }} +# SNS_SECRET: ${{ secrets.SNS_SECRET }} +# SNS_REGION: ${{ secrets.SNS_REGION }} +# SNS_TOPIC: ${{ secrets.SNS_TOPIC }} +# +# - name: Coveralls Testing Coverage +# run: | +# go get github.com/mattn/goveralls +# goveralls -coverprofile=coverage.out -repotoken $COVERALLS +# env: +# COVERALLS: ${{ secrets.COVERALLS }} test-postman-sqlite: needs: frontend - runs-on: ubuntu-latest + runs-on: [self-hosted, linux, aboutcher-hosted, centos7] steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.17.x - name: Setting ENV's run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash @@ -355,12 +359,12 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.17.x - name: Setting ENV's run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash @@ -412,12 +416,12 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.17.x - name: Setting ENV's run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash @@ -449,8 +453,8 @@ jobs: delayRequest: 600 docker-release: - needs: [build, test, test-postman-sqlite, test-postman-postgres, test-postman-mysql] - runs-on: ubuntu-latest + needs: build + runs-on: [self-hosted, linux, aboutcher-hosted, rocky8] steps: - name: Checkout Statping Repo uses: actions/checkout@v2 @@ -468,12 +472,6 @@ jobs: with: install: true - - name: Docker Login - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin - - name: Cache Docker layers uses: actions/cache@v2 id: buildx-docker @@ -482,8 +480,21 @@ jobs: key: buildx-docker restore-keys: | buildx-docker - - name: Docker Build :base - run: make buildx-base + +# - name: Docker Login +# env: +# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} +# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} +# run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin +# +# - name: Docker Build :base +# run: make buildx-base + + - name: Docker Login + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin - name: Docker Build :lastest run: make buildx-latest @@ -510,37 +521,37 @@ jobs: # - name: Sentry Release # run: make sentry-release - homebrew-release: - needs: docker-release - runs-on: ubuntu-latest - steps: - - name: Checkout Statping Repo - uses: actions/checkout@v2 - - - name: Setting ENV's - run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV - shell: bash - - - name: Update Homebrew Package - env: - VERSION: ${{ env.VERSION }} - TRAVIS_API: ${{ secrets.TRAVIS_API }} - run: make publish-homebrew - - slack-update: - needs: docker-release - runs-on: ubuntu-latest - steps: - - name: Checkout Statping Repo - uses: actions/checkout@v2 - - - name: Setting ENV's - run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV - shell: bash - - - name: Slack Notification - uses: rtCamp/action-slack-notify@master - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_URL }} - SLACK_CHANNEL: dev - SLACK_USERNAME: StatpingDev +# homebrew-release: +# needs: docker-release +# runs-on: ubuntu-latest +# steps: +# - name: Checkout Statping Repo +# uses: actions/checkout@v2 +# +# - name: Setting ENV's +# run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV +# shell: bash +# +# - name: Update Homebrew Package +# env: +# VERSION: ${{ env.VERSION }} +# TRAVIS_API: ${{ secrets.TRAVIS_API }} +# run: make publish-homebrew +# +# slack-update: +# needs: docker-release +# runs-on: ubuntu-latest +# steps: +# - name: Checkout Statping Repo +# uses: actions/checkout@v2 +# +# - name: Setting ENV's +# run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV +# shell: bash +# +# - name: Slack Notification +# uses: rtCamp/action-slack-notify@master +# env: +# SLACK_WEBHOOK: ${{ secrets.SLACK_URL }} +# SLACK_CHANNEL: dev +# SLACK_USERNAME: StatpingDev diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 02777270..30cd68c1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,10 +20,10 @@ jobs: steps: - uses: actions/setup-go@v2 with: - go-version: '1.14.2' + go-version: '1.17.8' - uses: actions/setup-node@v1 with: - node-version: '12.18.2' + node-version: '16.14.0' - uses: actions/checkout@v2 - name: Add GOBIN to PATH @@ -86,7 +86,7 @@ jobs: go-version: 1.15.x - uses: actions/setup-node@v1 with: - node-version: 12.18.2 + node-version: 16.14.0 - uses: actions/checkout@v2 - name: Install Global Dependencies @@ -97,7 +97,7 @@ jobs: - name: Setting ENV's run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash @@ -140,7 +140,7 @@ jobs: - name: Setting ENV's run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH + echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f0f1685..08a08ecc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,370 +1,33 @@ -# 0.90.75 (12-20-2020) -- Removed favicons and PNG files from assets, now using base64 images -- Cleaned up some issues with UI +# 0.90.80 (01-26-2022) +- Fixed permissions on /app directory - Thanks twouters -# 0.90.74 (12-18-2020) -- Fixed issue with favicon/manifest.json throwing 404 errors -- Modified language go:generate script to slowdown for 429 errors -- Removed Sentry error logging functionality +# 0.90.79 (01-24-2022) +- Updated Russian Language - Thanks meatlayer +- Docker file fix for BASE_PATH and health checks - Thanks michaelkrieger +- Removed statping emailer notifier (not SMTP Mail) +- Fixes for notification failures (Issue statping#911) - Thanks glanchow +- Updated Home page uptime wording (24hr/7days) - Thanks Jonathanrbarney & thatInfrastructureGuy +- [GITHUB] Removed mailer tests -# 0.90.73 (12-15-2020) -- Removed complexity in code for http server -- Removed internal cache functionality (not useful, needs refactor) -- Merged PR https://github.com/statping/statping/pull/909 -- Merged PR https://github.com/statping/statping/pull/880 -- Merged PR https://github.com/statping/statping/pull/859 +# 0.90.78 (09-15-2021) +- HTTP Webhooks accept multiple HTTP Headers +- Modified Telegram notifier to allow chat_ids +- New Notifier - Mattermost +- Updated German Language - Thanks Flofeld +- Czech Language - Thanks Fjuro +- Some minor branding Changes +- Moved some asset dependancies from assets.statping.com +- Fixed the (Ubuntu) Snap Store build script +- Retrospectively updated the Changelog +- [GITHUB] Fixed Windows/Mac autobuilds +- [GITHUB] Unstable container build +- [GITHUB] Triggers SNAP builds -# 0.90.72 (10-28-2020) -- Fixed issue with graphs becoming stuck on reload +# 0.90.77 (08-18-2021) +- More branding changes +- Fix for go statping-ng/email deps (https://github.com/statping-ng/statping-ng/issues/9) +- [GITHUB] Fixed autobuilds -# 0.90.71 (10-13-2020) -- Reverted Docker user in Dockerfile - -# 0.90.70 (10-1-2020) -- Merged PR #806 - Enhance GRPC Monitoring -- Merged PR #692 - When login fields are autofilled the sign in button should be enabled -- Modified multiple Vue forms to use number models for integer inputs -- Fixed page freeze issue for incidents https://github.com/statping/statping/issues/842 -- Modified cache routine from 5 seconds to 60 seconds - -# 0.90.69 (09-18-2020) -- Fixed issue with service view not loading. #808 #811 #800 - -# 0.90.68 (09-17-2020) -- Added DB_DSN env for mysql, postgres or sqlite DSN database connection string -- Added READ_ONLY env for a read only connection to the database -- Added Custom OAuth OpenID toggle switch in settings (appends 'openid' in scope) -- Fixed Custom OAuth response_type issue -- Added Configs tab in Settings to edit the config.yml from frontend - -# 0.90.67 (09-14-2020) -- Modified core settings to update config.yml on save -- Modified Theme Editor to restart the HTTP router on create/delete (fixing 404's) - -# 0.90.66 (09-08-2020) -- Added Import and Export views in Dashboard -- Modified services list sparkline to use start/end of day timestamp -- Modified i18n language files, added go generate script to automatically translate - -# 0.90.65 (09-01-2020) -- Fixed issue with dashboard not logging in (notifier panic) -- Modified static email templates to github.com/statping/emails -- Modified Regenerate API function to keep API_SECRET env -- Added DEMO_MODE env variable, if true, 'admin' cannot be deleted -- Modified Service sparklines on Dashboard -- Added modal popup for UI deletes/edits - -# 0.90.64 (08-18-2020) -- Modified max-width for container to 1012px, larger UI -- Added failure sparklines in the Services list view -- Added "Update Available" alert on the top of Settings if new version is available -- Added Version and Github Commit hash to left navigation on Settings page -- Added "reason" for failures (will be used for more custom notification messages) [regex, lookup, timeout, connection, close, status_code] -- Added Help page that is generated from Statping's Wiki repo on build -- Modified Service Group failures on index page to show 90 days of failures -- Modified Service view page, updated Latency and Ping charts, added failures below -- Modified Service chart on index page to show ping data along with latency -- Added AWS SNS Notifier -- Modified dashboard services UI -- Modified service.Failures API to include 32 failures (max) - -# 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 -- Modified notifications to not send on initial startup -- Updated Incident UI -- Added additional testing for notifications -- Modified SCSS/SASS files to be generated from 1, main.scss to main.css -- Modified index page to use /assets directory for assets, (main.css, style.css) -- Modified index page to use CDN asset paths -- Fixed New Checkin form -- Modified email notifier template to be rendered from MJML (using go generate) -- Modified database relationships with services using gorm -- Modified "statping env" command to show user/group ID -- Removed "js" folder when exporting assets, js files are always version of release, not static JS files - -# 0.90.61 (07-22-2020) -- Modified sass layouts, organized and split up sections -- Modified Checkins to seconds rather than milliseconds (for cronjob) -- Modified Service View page to show data inside cards -- Fixed issue with uptime_data sending incorrect start/end timestamps -- Modified http cache to bypass if url has a "v" query param -- Added "Static Services" (a fake service that requires you to update the online/offline status) -- Added Update Static Service PATCH route (/api/services/{id}) -- Modified SASS api endpoints (base, layout, forms, mixins, mobile, variables) -- Added additional testing -- Modified node version from 10.x to 12.18.2 -- Modified Notifier's struct values to be NullString and NullInt to allow empty values -- Added Search ability to Logs in UI -- Fixed issue with Incidents and Checkins not being deleted once service is deleted - -# 0.90.60 (07-15-2020) -- Added LETSENCRYPT_ENABLE (boolean) env to enable/disable letsencrypt SSL - -# 0.90.59 (07-14-2020) -- Added LetsEncrypt SSL Generator by using LETSENCRYPT_HOST and LETSENCRYPT_EMAIL envs. -- Modified JWT token key to be sha256 of API Secret -- Modified github actions to build multi-arch Docker images -- Added "update" command to install latest version -- Fixed dashboard uptime_data API request to request correct start/time timestamp - -# 0.90.58 (07-09-2020) -- Fixed ICMP latency/ping durations -- Fixed webhook notifier -- Modified file structure for Vue admin dashboard components. -- Added Gotify notifier - -# 0.90.57 (07-04-2020) -- Fixed login issue - -# 0.90.56 (06-25-2020) -- Modified metrics now include service name for each service metric -- Added switch for true/false notifier values -- Added list for notifiers that have static values (in drop down) -- Fixed oAuth form saving -- Fixed some HTTP Cookie issues -- Added error if Theme Editor returns an error from API -- Added Pushover priority and sounds -- Added HTTP headers for outgoing requests (includes User-Agent=Statping and Statping-Version=0.90.55) -- Fixed Google oAuth handling -- Added Google oAuth email/domain user restrictions -- Modified notifiers to use dereferenced services and failures -- Added core.Example() function for testing -- Added Custom oAuth Authentication method -- Fixed setup form not creating user from values inputted in form -- Fixed issues with Telegram Notifier -- Modified notifier test handler to return notifier based on URL, not JSON payload - -# 0.90.55 (06-18-2020) -- Added 404 page -- Modified Statping's PR process, dev -> master -- Fixed Discord notifier -- Modified email template for SMTP emails -- Added OnSave() method for all notifiers - -# 0.90.54 (06-17-2020) -- Fixed Slack Notifier's failure/success data saving issue -- Added additional i18n Languages (help needed!) - -# 0.90.53 (06-16-2020) -- Modified most of the key's for prometheus metrics -- Added Database Stats in prometheus metrics -- Added object query counts in prometheus metrics - -# 0.90.52 (06-15-2020) -- Fixed NOT NULL sql field - -# 0.90.51 (06-15-2020) -- Fix Theme Editor codemirror inputs to show on load -- Added favicon folder for local assets can be used without remote access -- Modified Notifier's to return the response as a string for the frontend -- Modified Notifiers so they can use custom data for their request -- Added Notifier OnSuccess and onFailure custom data on frontend - -# 0.90.50 (06-13-2020) -- Removed PORT, replaced with SERVER_PORT -- Removed HOST/IP, replaced with SERVER_IP - -# 0.90.49 (06-12-2020) -- Added additional prometheus /metrics for better debugging - -# 0.90.48 (06-11-2020) -- Modified shutdown routine to make command exit with code 0 -- Modified install.sh for correct installation - -# 0.90.47 (06-10-2020) -- Fixed Urgent bug taking 100% of CPU (Timer) -- Modified HTTP server, now in it's own go routine/channel -- Fixed Service form for editing -- Added pprof golang debugging http server if `GO_ENV` == "test" -- Added `HOST` env variable (hostname for http server) -- Added `DISABLE_HTTP` env variable (defaults to false, disables the http server) -- Added `DISABLE_COLORS` env variable (default to false, disables color encoding for logs) -- Added `LOGS_MAX_COUNT` -- Added `LOGS_MAX_AGE` -- Added `LOGS_MAX_SIZE` -- Added `DEBUG` (starts a pprof golang debugging http server on port 9090, defaults to false) -- Confirmed `DISABLE_LOGS` is working -- Modified Mobile Notifier to fit new push notification server endpoint -- PR Merged: Fix time conversion in overview and charts #645 -- PR Merged: Wait for cmd reads to complete before calling Wait() #626 -- PR Merged: separate command options and option arguments #623 - -# 0.90.46 (06-04-2020) -- Add i18n language translations for frontend -- Added PR for heatmap https://github.com/statping/statping/pull/589 -- Added Statping newsletter option during /setup mode -- Fix for disabling logs with `DISABLE_LOGS` env - -# 0.90.45 (06-01-2020) -- Merged PR [#612](https://github.com/statping/statping/pull/612) for edit/create service issue. - -# 0.90.44 (05-25-2020) -- Modified Makefile to include "netgo" tag during golang build - -# 0.90.43 (05-21-2020) -- Fixed service TLS checkbox form for edit and create -- Modified ICMP ping's to use system's "ping" command (doesn't need root access) - -# 0.90.42 (05-20-2020) -- Fixed TCP services that dont use TLS. - -# 0.90.41 (05-20-2020) -- Added TLS Client Cert/Key feature for HTTP and TCP/UDP services -- Replaced environment variable ADMIN_PASS to ADMIN_PASSWORD. - -# 0.90.40 (05-18-2020) -- Fixed issues with MySQL and Postgres taking forever to insert sample data (now run in bulk) -- Removed API Authentication for /api/logout route -- Modified Core Sample/Upstart row to include NAME, DESCRIPTION, and DOMAIN environment vars (also added default values) - -# 0.90.39 (05-15-2020) -- Modified some SCSS designs for services failures in group -- Fixed Twilio notifier and tests - -# 0.90.38 (05-10-2020) -- Added service timeframe/interval on index charts -- Added --config flag to specify config.yml file -- Modified multiple files for simple UX fixes - -# 0.90.37 (05-04-2020) -- Fixed authentication issues dealing with cookies -- Modified build process, arm/arm64 couldnt run sqlite - -# 0.90.36 (05-02-2020) -- Fixed Notifier golang templating func to use correct variables - -# 0.90.35 (05-01-2020) -- Fixed issue with API endpoints cannot accepting Authorization header -- Fixed issue with sass executable not being found, SASS environment var re-implemented -- Added additional Postman API doc endpoints - -# 0.90.34 (04-28-2020) -- Added missing information to Mail notification ([#472](https://github.com/statping/statping/issues/472)) -- Added service.yml file to auto create services (https://github.com/statping/statping/wiki/services.yml) -- Removed Core API_KEY, (unused code, use API_SECRET) - -# 0.90.33 (04-24-2020) -- Fixed config loading method - -# 0.90.32 (04-23-2020) -- Modified the saving and loading process config.yml - -# 0.90.31 (04-21-2020) -- Version bump for github actions - -# 0.90.30 (04-19-2020) -- Attempt to fix Github Actions build process -- Fix for empty database connection string, and not starting in setup mode - -# 0.90.29 (04-19-2020) -- Added HTTP Redirects for services -- Removed use of SASS environment variable, now finds path or sends error -- Modified Makefile to create new snapcraft versions -- Fixed issue when logs are not initiated yet. Issue #502 -- Fixed issue when SQLite (statping.db) is not found Issue #499 -- Modified port flag in Docker image -- Fixed issue on startup without config.yml file not starting in setup mode - -# 0.90.28 (04-16-2020) -- Fixed postgres timestamp grouping -- Added postman (newman) API testing -- Added Viper and Cobra config/env parsing package -- Added more golang tests -- Modified handlers to use a more generic find method -- Added 'env' command to show variables used in config -- Added 'reset' command that will delete files and backup .db file for a fresh install -- Added error type that has common errors with http status code based on error - -# 0.90.27 (04-15-2020) -- Fixed postgres database table creation process -- Modified go build process, additional ARCHs -- Added 'SAMPLE_DATA' environment variable to disable example data on startup. (default: true) - -# 0.90.26 (04-13-2020) -- Fixed Delete Failures button/function -- Removed timezone field from Settings (core) -- Modified CDN asset URL -- Fixed single Service view, more complex charts - -# 0.90.25 -- Added string response on OnTest for Notifiers -- Modified UI to show user the response for a Notifier. -- Modified some Notifiers title's -- Added more Cypress e2e testing -- Modified Incidents form and UX. -- Added /api/services/{id}/uptime_data API endpoint to show online/offline durations as a series for charts. -- Modified index page to automatically refresh Service details on interval - -# 0.90.24 -- Fixed login form from not showing - -# 0.90.23 -- Added Incident Reporting -- Added Cypress tests -- Added Github and Google OAuth login (beta) -- Added Delete All Failures -- Added Checkin form -- Added Pushover notifier - -# 0.90.22 -- Added range input types for integer form fields -- Modified Sentry error logging details -- Modified form field layouts for better UX. -- Modified Notifier form -- Fixed Notifier Test form and logic - -# 0.90.21 -- Fixed BASE_PATH when using a path for Statping -- Added Cypress testing -- Modified SQLite golang package -- Modified SQLite connection limit, and idle limit. (defaults to 25) -- Fixed installation to use project name and description from form post - -# 0.90.20 -- Fixed Service Form from sending integer values as strings to API -- Added Cypress e2e testing (working on adding more) - -# 0.90.19 -- Fixed private Services from showing in API (/api/services and /api/services/{id}) -- Removed unused code - -# 0.90.18 -- Added service type gRPC, you can now check on gRPC services. (limited) - -# 0.90.17 -- Fixed notification fields for frontend -- Fixed notification JSON form to send integer if value is an integer. -- Added testing for notifiers - -# 0.90.16 -- Added Notify After (int) field for Services. Will send notifications after x amount of failures. -- Added new method in utils package for replacing `{{.Service.*}}` and `{{.Failure.*}}` variables from string to it's true value -- Fixed Notifer get endpoint -- Cleaned Notifier methods -- Updated recommended changes from [sonarcloud.io](https://sonarcloud.io/organizations/statping/projects) -- Organized utils package files - -# 0.90.15 -- Fixed /dashboard authentication state to show admin tabs if your an admin. [Issue #438](https://github.com/statping/statping/issues/438) -- Fixed Cache JS error on Dashboard - -# 0.90.14 -- Updated SCSS compiling, and confirmed it works. -- Added `$container-color` SCSS variable. -- Fixed issue with JWT token (nil pointer) for the Cookie name - -# 0.90.13 -- Added new function `utils.RenameDirectory` to rename directory -- Added new function `(*DbConfig) BackupAssets` to backup a customized theme and place into a directory named `assets_backup`. Only for migration 0.80 to 0.90+, entirely new frontend. -- Updated JS function `convertToChartData` to return an empty chart data if API response was empty. -- Updated `banner.png` to make a bit smaller, (680px) -- Fixed method that returns `no such table: services` on startup, check table first. -- Fixed version from not being added into Core table. [Issue #436](https://github.com/statping/statping/issues/436) - -# 0.90.12 -- Fixed MySQL timestamp formatting. (issue #432) +# 0.90.76 (08-13-2021) +- Forked statping and renamed to statping-ng +- Branding changes diff --git a/Dockerfile b/Dockerfile index 44866305..6997cc18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,57 @@ -FROM statping/statping:base AS base +FROM node:16.14.0-alpine AS frontend +LABEL maintainer="Statping-ng (https://github.com/statping-ng)" ARG BUILDPLATFORM +WORKDIR /statping +COPY ./frontend/package.json . +COPY ./frontend/yarn.lock . +RUN yarn install --pure-lockfile --network-timeout 1000000 +COPY ./frontend . +RUN yarn build && yarn cache clean + +# Statping Golang BACKEND building from source +# Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying +FROM golang:1.17-alpine AS backend +LABEL maintainer="Statping-NG (https://github.com/statping-ng)" +ARG VERSION +ARG COMMIT +ARG BUILDPLATFORM +ARG TARGETARCH +RUN apk add --update --no-cache libstdc++ gcc g++ make git autoconf \ + libtool ca-certificates linux-headers wget curl jq && \ + update-ca-certificates + +WORKDIR /root +RUN git clone https://github.com/sass/sassc.git +RUN . sassc/script/bootstrap && make -C sassc -j4 +# sassc binary: /root/sassc/bin/sassc + +WORKDIR /go/src/github.com/statping-ng/statping-ng +ADD go.mod go.sum ./ +RUN go mod download +ENV GO111MODULE on +ENV CGO_ENABLED 1 +RUN go get github.com/stretchr/testify/assert && \ + go get github.com/stretchr/testify/require && \ + go get github.com/GeertJohan/go.rice/rice && \ + go get github.com/cortesi/modd/cmd/modd && \ + go get github.com/crazy-max/xgo +COPY . . +COPY --from=frontend /statping/dist/ ./source/dist/ +RUN make clean generate embed +RUN go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT}" -o statping --tags "netgo linux" ./cmd +RUN chmod a+x statping && mv statping /go/bin/statping +# /go/bin/statping - statping binary +# /root/sassc/bin/sassc - sass binary +# /statping - Vue frontend (from frontend) + # Statping main Docker image that contains all required libraries FROM alpine:latest + RUN apk --no-cache add libgcc libstdc++ ca-certificates curl jq && update-ca-certificates -COPY --from=base /go/bin/statping /usr/local/bin/ -COPY --from=base /root/sassc/bin/sassc /usr/local/bin/ -COPY --from=base /usr/local/share/ca-certificates /usr/local/share/ +COPY --from=backend /go/bin/statping /usr/local/bin/ +COPY --from=backend /root/sassc/bin/sassc /usr/local/bin/ +COPY --from=backend /usr/local/share/ca-certificates /usr/local/share/ WORKDIR /app VOLUME /app @@ -15,9 +60,10 @@ ENV IS_DOCKER=true ENV SASS=/usr/local/bin/sassc ENV STATPING_DIR=/app ENV PORT=8080 +ENV BASE_PATH="" EXPOSE $PORT -HEALTHCHECK --interval=60s --timeout=10s --retries=3 CMD curl -s "http://localhost:$PORT/health" | jq -r -e ".online==true" +HEALTHCHECK --interval=60s --timeout=10s --retries=3 CMD if [ -z "$BASE_PATH" ]; then HEALTHPATH="/health"; else HEALTHPATH="/$BASE_PATH/health" ; fi && curl -s "http://localhost:80$HEALTHPATH" | jq -r -e ".online==true" CMD statping --port $PORT diff --git a/Dockerfile.base b/Dockerfile.base index 44c8ccb5..920b20f5 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -1,5 +1,5 @@ -FROM node:12.18.2-alpine AS frontend -LABEL maintainer="Hunter Long (https://github.com/hunterlong)" +FROM node:16.14.0-alpine AS frontend +LABEL maintainer="Statping-ng (https://github.com/statping-ng)" ARG BUILDPLATFORM WORKDIR /statping COPY ./frontend/package.json . @@ -10,8 +10,8 @@ RUN yarn build && yarn cache clean # Statping Golang BACKEND building from source # Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying -FROM golang:1.14-alpine AS backend -LABEL maintainer="Hunter Long (https://github.com/hunterlong)" +FROM golang:1.17-alpine AS backend +LABEL maintainer="Statping-NG (https://github.com/statping-ng)" ARG VERSION ARG COMMIT ARG BUILDPLATFORM @@ -25,7 +25,7 @@ RUN git clone https://github.com/sass/sassc.git RUN . sassc/script/bootstrap && make -C sassc -j4 # sassc binary: /root/sassc/bin/sassc -WORKDIR /go/src/github.com/statping/statping +WORKDIR /go/src/github.com/statping-ng/statping-ng ADD go.mod go.sum ./ RUN go mod download ENV GO111MODULE on diff --git a/Makefile b/Makefile index fbd195f9..ef78a2c5 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,14 @@ COMMIT=$(shell git rev-parse HEAD) SIGN_KEY=B76D61FAA6DB759466E83D9964B9C6AAE2D55278 BINARY_NAME=statping GOBUILD=go build -a -GOVERSION=1.14.0 -NODE_VERSION=12.18.2 +GOVERSION=1.17.8 +NODE_VERSION=16.14.0 XGO=xgo -go $(GOVERSION) --dest=build BUILDVERSION=-ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT}" TRVIS_SECRET=O3/2KTOV8krv+yZ1EB/7D1RQRe6NdpFUEJNJkMS/ollYqmz3x2mCO7yIgIJKCKguLXZxjM6CxJcjlCrvUwibL+8BBp7xJe4XFIOrjkPvbbVPry4HkFZCf2GfcUK6o4AByQ+RYqsW2F17Fp9KLQ1rL3OT3eLTwCAGKx3tlY8y+an43zkmo5dN64V6sawx26fh6XTfww590ey+ltgQTjf8UPNup2wZmGvMo9Hwvh/bYR/47bR6PlBh6vhlKWyotKf2Fz1Bevbu0zc35pee5YlsrHR+oSF+/nNd/dOij34BhtqQikUR+zQVy9yty8SlmneVwD3yOENvlF+8roeKIXb6P6eZnSMHvelhWpAFTwDXq2N3d/FIgrQtLxsAFTI3nTHvZgs6OoTd6dA0wkhuIGLxaL3FOeztCdxP5J/CQ9GUcTvifh5ArGGwYxRxQU6rTgtebJcNtXFISP9CEUR6rwRtb6ax7h6f1SbjUGAdxt+r2LbEVEk4ZlwHvdJ2DtzJHT5DQtLrqq/CTUgJ8SJFMkrJMp/pPznKhzN4qvd8oQJXygSXX/gz92MvoX0xgpNeLsUdAn+PL9KketfR+QYosBz04d8k05E+aTqGaU7FUCHPTLwlOFvLD8Gbv0zsC/PWgSLXTBlcqLEz5PHwPVHTcVzspKj/IyYimXpCSbvu1YOIjyc= PUBLISH_BODY='{ "request": { "branch": "master", "message": "Homebrew update version v${VERSION}", "config": { "env": { "VERSION": "${VERSION}", "COMMIT": "$(TRAVIS_COMMIT)" } } } }' -TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "merge_mode": "replace", "language": "go", "go": 1.14, "install": true, "sudo": "required", "services": ["docker"], "env": { "secure": "${TRVIS_SECRET}" }, "before_deploy": ["git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [{ "provider": "releases", "api_key": "$$GITHUB_TOKEN", "file_glob": true, "file": "build/*", "skip_cleanup": true, "on": { "branch": "master" } }], "before_script": ["rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install stable", "nvm install 10.17.0", "nvm use 10.17.0 --default", "npm install -g sass yarn cross-env", "pip install --user awscli"], "script": ["make release"], "after_success": [], "after_deploy": ["make post-release"] } } }' -TEST_DIR=$(GOPATH)/src/github.com/statping/statping +TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "merge_mode": "replace", "language": "go", "go": 1.17, "install": true, "sudo": "required", "services": ["docker"], "env": { "secure": "${TRVIS_SECRET}" }, "before_deploy": ["git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [{ "provider": "releases", "api_key": "$$GITHUB_TOKEN", "file_glob": true, "file": "build/*", "skip_cleanup": true, "on": { "branch": "master" } }], "before_script": ["rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install stable", "nvm install 16.14.0", "nvm use 16.14.0 --default", "npm install -g sass yarn cross-env", "pip install --user awscli"], "script": ["make release"], "after_success": [], "after_deploy": ["make post-release"] } } }' +TEST_DIR=$(GOPATH)/src/github.com/statping-ng/statping-ng PATH:=$(GOPATH)/bin:$(PATH) OS = freebsd linux openbsd ARCHS = 386 arm amd64 arm64 @@ -33,20 +33,20 @@ go-build: clean lint: go fmt ./... golint ./... - impi --local github.com/statping/statping/ --scheme stdLocalThirdParty ./... + impi --local github.com/statping-ng/statping-ng/ --scheme stdLocalThirdParty ./... goimports ./... up: - docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml up -d --remove-orphans + docker compose -f docker-compose.yml -f dev/docker-compose.full.yml up -d --remove-orphans make print_details down: - docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml down --volumes --remove-orphans + docker compose -f docker-compose.yml -f dev/docker-compose.full.yml down --volumes --remove-orphans lite: clean - docker build -t statping/statping:dev -f dev/Dockerfile.dev . - docker-compose -f dev/docker-compose.lite.yml down - docker-compose -f dev/docker-compose.lite.yml up --remove-orphans + docker build -t statping-ng/statping-ng:dev -f dev/Dockerfile.dev . + docker compose -f dev/docker-compose.lite.yml down + docker compose -f dev/docker-compose.lite.yml up --remove-orphans reup: down clean compose-build-full up @@ -94,50 +94,37 @@ go-run: go run ./cmd start: - docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml start + docker compose -f docker-compose.yml -f dev/docker-compose.full.yml start stop: - docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml stop + docker compose -f docker-compose.yml -f dev/docker-compose.full.yml stop logs: docker logs statping --follow db-up: - docker-compose -f dev/docker-compose.db.yml up -d --remove-orphans + docker compose -f dev/docker-compose.db.yml up -d --remove-orphans db-down: - docker-compose -f dev/docker-compose.db.yml down --volumes --remove-orphans + docker compose -f dev/docker-compose.db.yml down --volumes --remove-orphans console: docker exec -t -i statping /bin/sh -compose-build-full: docker-base - docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml build --parallel --build-arg VERSION=${VERSION} +compose-build-full: + docker compose -f docker-compose.yml -f dev/docker-compose.full.yml build --parallel --build-arg VERSION=${VERSION} -docker-base: - docker build -t statping/statping:base -f Dockerfile.base --build-arg VERSION=${VERSION} . - -docker-latest: docker-base - docker build -t statping/statping:latest --build-arg VERSION=${VERSION} . - -docker-vue: - docker build -t statping/statping:vue --build-arg VERSION=${VERSION} . +docker-latest: + docker build -t statping-ng/statping-ng:latest --build-arg VERSION=${VERSION} . docker-test: - docker-compose -f docker-compose.test.yml up --remove-orphans - -push-base: clean compile docker-base - docker push statping/statping:base - -push-vue: clean compile docker-base docker-vue - docker push statping/statping:base - docker push statping/statping:vue + docker compose -f docker-compose.test.yml up --remove-orphans modd: modd -f ./dev/modd.conf top: - docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml top + docker compose -f docker-compose.yml -f dev/docker-compose.full.yml top frontend-build: @echo "Removing old frontend distributions..." @@ -285,22 +272,15 @@ download-key: wget -O statping.gpg $(SIGN_URL) gpg --import statping.gpg -# push the :dev docker tag using curl -dockerhub-dev: - docker build --build-arg VERSION=${VERSION} -t statping/statping:dev --no-cache -f Dockerfile.base . - docker push statping/statping:dev - dockerhub: - docker build --build-arg VERSION=${VERSION} -t statping/statping:base --no-cache -f Dockerfile.base . - docker build --build-arg VERSION=${VERSION} -t statping/statping:latest --no-cache -f Dockerfile . - docker tag statping/statping statping/statping:v${VERSION} - docker push statping/statping:base - docker push statping/statping:v${VERSION} - docker push statping/statping + docker build --build-arg VERSION=${VERSION} -t adamboutcher/statping-ng:latest --no-cache -f Dockerfile . + docker tag adamboutcher/statping-ng adamboutcher/statping-ng:v${VERSION} + docker push adamboutcher/statping-ng:v${VERSION} + docker push adamboutcher/statping-ng docker-build-dev: - docker build --build-arg VERSION=${VERSION} -t statping/statping:latest --no-cache -f Dockerfile . - docker tag statping/statping:latest statping/statping:dev-v${VERSION} + docker build --build-arg VERSION=${VERSION} -t statping-ng/statping-ng:latest --no-cache -f Dockerfile . + docker tag statping-ng/statping-ng:latest statping-ng/statping-ng:dev-v${VERSION} post-release: frontend-build upload_to_s3 publish-homebrew dockerhub @@ -337,10 +317,10 @@ sentry-release: download-bins: clean mkdir build || true - wget "https://github.com/statping/statping/releases/download/v${VERSION}/statping-linux-386.tar.gz" - wget "https://github.com/statping/statping/releases/download/v${VERSION}/statping-linux-amd64.tar.gz" - wget "https://github.com/statping/statping/releases/download/v${VERSION}/statping-linux-arm.tar.gz" - wget "https://github.com/statping/statping/releases/download/v${VERSION}/statping-linux-arm64.tar.gz" + wget "https://github.com/statping-ng/statping-ng/releases/download/v${VERSION}/statping-linux-386.tar.gz" + wget "https://github.com/statping-ng/statping-ng/releases/download/v${VERSION}/statping-linux-amd64.tar.gz" + wget "https://github.com/statping-ng/statping-ng/releases/download/v${VERSION}/statping-linux-arm.tar.gz" + wget "https://github.com/statping-ng/statping-ng/releases/download/v${VERSION}/statping-linux-arm64.tar.gz" mv statping-linux-386.tar.gz build/ mv statping-linux-amd64.tar.gz build/ mv statping-linux-arm.tar.gz build/ @@ -381,23 +361,17 @@ 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 create --name statping-latest --driver-opt image=moby/buildkit:master docker buildx inspect --builder statping-latest --bootstrap - docker buildx build --builder statping-latest --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t statping/statping:latest -t statping/statping:v${VERSION} --build-arg=VERSION=${VERSION} --build-arg=COMMIT=${COMMIT} . + docker buildx build --builder statping-latest --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache,mode=max" --push --pull --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t adamboutcher/statping-ng:latest -t adamboutcher/statping-ng:v${VERSION} --build-arg=VERSION=${VERSION} --build-arg=COMMIT=${COMMIT} . docker buildx rm statping-latest buildx-dev: multiarch - docker buildx create --name statping-dev + docker buildx create --name statping-dev --driver-opt image=moby/buildkit:master docker buildx inspect --builder statping-dev --bootstrap - docker buildx build --builder statping-dev --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t statping/statping:dev --build-arg=VERSION=${VERSION} --build-arg=COMMIT=${COMMIT} . + docker buildx build --builder statping-dev --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache,mode=max" --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t adamboutcher/statping-ng:dev --build-arg=VERSION=${VERSION} --build-arg=COMMIT=${COMMIT} . docker buildx rm statping-dev -buildx-base: multiarch - docker buildx create --name statping-base - docker buildx inspect --builder statping-base --bootstrap - docker buildx build --builder statping-base --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile.base -t statping/statping:base --build-arg=VERSION=${VERSION} --build-arg=COMMIT=${COMMIT} . - docker buildx rm statping-base - multiarch: mkdir /tmp/.buildx-cache || true docker run --rm --privileged multiarch/qemu-user-static --reset -p yes @@ -408,7 +382,7 @@ delve: check: @echo "Checking the programs required for the build are installed..." - @echo "go: $(shell go version) - $(shell which go)" && go version >/dev/null 2>&1 || (echo "ERROR: go 1.14 is required."; exit 1) + @echo "go: $(shell go version) - $(shell which go)" && go version >/dev/null 2>&1 || (echo "ERROR: go 1.17 is required."; exit 1) @echo "node: $(shell node --version) - $(shell which node)" && node --version >/dev/null 2>&1 || (echo "ERROR: node 12.x is required."; exit 1) @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!" @@ -426,5 +400,5 @@ gen_help: marked -o html/$file.html $file --gfm done -.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 +.PHONY: all check build certs multiarch install-darwin go-build build-all 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 diff --git a/README.md b/README.md index de709f44..883f3323 100644 --- a/README.md +++ b/README.md @@ -1,109 +1,152 @@ -

- +

+ Statping-ng +

+

+ Statping-ng - Web and App Status Monitoring for Any Type of Project

-

- Statping - Web and App Status Monitoring for Any Type of Project
-View Wiki | Demo | iPhone | Android
API | Docker | EC2 | Mac | Linux | Windows +

+ Website | + Wiki +
+ Linux | + Windows | + Mac | + Containers

-# Statping - Status Page & Monitoring Server -An easy to use Status Page for your websites and applications. Statping will automatically fetch the application and render a beautiful status page with tons of features for you to build an even better status page. This Status Page generator allows you to use MySQL, Postgres, or SQLite on multiple operating systems. +

Statping-ng - Status Page & Monitoring Server

+

An easy to use Status Page for your websites and applications. Statping will automatically fetch the application and render a beautiful status page with tons of features for you to build an even better status page. This Status Page generator allows you to use MySQL, Postgres, or SQLite on multiple operating systems. +

+Statping-ng aims to be an updated drop-in replacement of statping after development stopped on the original fork. +

-![Master Release](https://github.com/statping/statping/workflows/Master%20Release/badge.svg?branch=master) [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/statping/statping) [![Slack](https://slack.statping.com/badge.svg)](https://slack.statping.com) [![](https://images.microbadger.com/badges/image/statping/statping.svg)](https://microbadger.com/images/statping/statping) [![Docker Pulls](https://img.shields.io/docker/pulls/statping/statping.svg)](https://hub.docker.com/r/statping/statping/builds/) +

+ License +

+ Last Commit + Dev Build Status + Unstable Build Status + Stable Build Status +

+ Docker Pulls + Docker Image Size +

+ Go Version + Go Report +

-

- -

A Future-Proof Status Page

-Statping strives to remain future-proof and remain intact if a failure is created. Your Statping service should not be running on the same instance you're trying to monitor. If your server crashes your Status Page should still remaining online to notify your users of downtime. +
+

About Statping-ng

-
(dashboard login is `admin`, password `admin`) -


- -

No Requirements

-Statping is built in Go Language so all you need is the precompile binary based on your operating system. You won't need to install anything extra once you have the Statping binary installed. You can even run Statping on a Raspberry Pi. -

-

-        -        -        -        -        - -

+ +

A Future-Proof Status Page

+

+ Statping-ng strives to remain future-proof and remain intact if a failure is created. Your Statping-ng service should not be running on the same instance you're trying to monitor. If your server crashes your Status Page should still remaining online to notify your users of downtime. +

+

+ Try Statping-ng via Play with Docker - Login is admin, password admin. +

+


- -

Lightweight and Fast

-Statping is a very lightweight application and is available for Linux, Mac, and Windows. The Docker image is only ~16Mb so you know that this application won't be filling up your hard drive space. +

No Requirements - Run on Any Server

+

+Statping-ng is built in Go Language so all you need is the pre-compiled binary based on your operating system. You won't need to install anything extra once you have the Statping binary installed. Windows, Linux or Mac, We compile to all the popular systems, including Raspberry Pi! +

+

+Linux +Windows +Apple Mac +Containers +Android Play Store +Apple Apps Store +

+
+


+ + + +

Lightweight and Fast

+

+Statping-ng is a very lightweight application and is available for Linux, Mac, and Windows. The Docker image is only ~20Mb so you know that this application won't be filling up your hard drive space. The Status binary for all other OS's is ~17Mb at most. -





+

+



- -

Mobile App is Gorgeous

-The Statping app is available on the App Store and Google Play for free. The app will allow you to view services, receive notifications when a service is offline, update groups, users, services, messages, and more! Start your own Statping server and then connect it to the app by scanning the QR code in settings. -

- - +

Want easy containers?

+

+No Worries, we provide docker containers for many different system architectures, with multiple docker-compose files to suit your needs, you can even bring your own SSL Certificate or automatically leverage Lets Encrypt to keep things secure. But it's can be as simple as a docker run! +

+


+ + + +

Custom SASS Styling

+Statping-ng will allow you to completely customize your Status Page using SASS styling with easy to use variables. The container image actually contains a pre-built SASS binary so you won't even need to setup anything! +



+ + + +

Compatible with the Statping App

+

+Statping-ng is 100% compatible with the statping app which is available on the Apple App Store and Google Play for free. The app will allow you to view services, receive notifications when a service is offline, update groups, users, services, messages, and more! Start your own Statping-ng server and then connect it to the app by scanning the QR code in settings.

+

+ + +

+

The mobile app is not maintained by statping-ng and includes in-app purchases to the developer of statping.

+


+ +

Notifications - Slack, Email, Twilio and more

+

Statping-ng includes email notification via SMTP and Slack integration using Incoming Webhook. Insert the webhook URL into the Settings page in Statping-ng and enable the Slack integration. Anytime a service fails, the channel that you specified on Slack will receive a message.

+

View the Plugin Wiki to see detailed information about Golang Plugins. Statping-ng isn't just another Status Page for your applications, it's a framework that allows you to create your own plugins to interact with every element of your status page. Notifier's can also be create with only 1 golang file.

+



+ + + +

Easy to use Dashboard

+

+Having a straight forward dashboard makes Statping-ng that much better. Quickly and Easy view statuses. Monitor your websites and applications with a basic HTTP GET request, or add a POST request with your own JSON to post to the endpoint.

+




+ + + + + + +

Quick Start

+

Here's a few quick start guides to get you going, fast.

+ +

Docker

+

Use the Statping Docker Image to create a status page in seconds. Checkout the Docker Wiki to view more details on how to get started using Docker.

-

- -## Run on Any Server -Whether you're a Docker fan-boy or a [AWS EC2](https://github.com/statping/statping/wiki/AWS-EC2) master, Statping gives you multiple options to simply get running. Our Amazon AMI image is only 8Gb and will automatically update to the most stable version of Statping. -Running on an EC2 server might be the most cost effective way to host your own Statping Status Page. The server runs on the smallest EC2 instance (t2.nano) AWS has to offer, which only costs around $4.60 USD a month for your dedicated Status Page. -Want to run it on your own Docker server? Awesome! Statping has multiple docker-compose.yml files to work with. Statping can automatically create a SSL Certification for your status page. -



- - -

Custom SASS Styling

-Statping will allow you to completely customize your Status Page using SASS styling with easy to use variables. The Docker image actually contains a prebuilt SASS binary so you won't even need to setup anything! -



- -## Slack, Email, Twilio and more -Statping includes email notification via SMTP and Slack integration using [Incoming Webhook](https://api.slack.com/incoming-webhooks). Insert the webhook URL into the Settings page in Statping and enable the Slack integration. Anytime a service fails, you're channel that you specified on Slack will receive a message. -



- -

User Created Notifiers

-View the [Plugin Wiki](https://github.com/statping/statping/wiki/Statping-Plugins) to see detailed information about Golang Plugins. Statping isn't just another Status Page for your applications, it's a framework that allows you to create your own plugins to interact with every element of your status page. [Notifier's](https://github.com/statping/statping/wiki/Notifiers) can also be create with only 1 golang file. -



- - - -



- - -

Easy to use Dashboard

-Having a straight forward dashboard makes Statping that much better. Monitor your websites and applications with a basic HTTP GET request, or add a POST request with your own JSON to post to the endpoint. -



- -## Run on Docker -Use the [Statping Docker Image](https://hub.docker.com/r/statping/statping) to create a status page in seconds. Checkout the [Docker Wiki](https://github.com/statping/statping/wiki/Docker) to view more details on how to get started using Docker. ```bash -docker run -it -p 8080:8080 statping/statping +docker run -it -p 8080:8080 adamboutcher/statping-ng ``` -There are multiple ways to startup a Statping server. You want to make sure Statping is on it's own instance that is not on the same server as the applications you wish to monitor. It doesn't look good when your Status Page goes down, I recommend a small EC2 instance so you can set it, and forget it. -



-## Docker Compose -In this folder there is a standard docker-compose file that include nginx, postgres, and Statping. +

Docker Compose

+

In the root (base) folder there is a standard docker-compose file that includes nginx, postgres, and Statping-ng.

+ ```bash docker-compose up -d ``` -



-## Docker Compose with Automatic SSL -You can automatically start a Statping server with automatic SSL encryption using this docker-compose file. First point your domain's DNS to the Statping server, and then run this docker-compose command with DOMAIN and EMAIL. Email is for letsencrypt services. +

Docker Compose with Automatic SSL

+

You can automatically start a Statping-ng server with automatic SSL encryption using this docker-compose file. First point your domain's DNS to the Statping-ng server, and then run this docker-compose command with DOMAIN and EMAIL. Email is for letsencrypt services.

+ ```bash LETSENCRYPT_HOST=mydomain.com \ LETSENCRYPT_EMAIL=info@mydomain.com \ docker-compose -f docker-compose-ssl.yml up -d ``` -Once your instance has started, it will take a moment to get your SSL certificate. Make sure you have a A or CNAME record on your domain that points to the IP/DNS of your server running Statping. -



-## Prometheus Exporter -Statping includes a [Prometheus Exporter](https://github.com/statping/statping/wiki/Prometheus-Exporter) so you can have even more monitoring power with your services. The Prometheus exporter can be seen on `/metrics`, simply create another exporter in your prometheus config. Use your Statping API Secret for the Authorization Bearer header, the `/metrics` URL is dedicated for Prometheus and requires the correct API Secret has `Authorization` header. +

Once your instance has started, it will take a moment to get your SSL certificate. Make sure you have a A or CNAME record on your domain that points to the IP/DNS of your server running Statping-ng.

+ +

Prometheus Exporter

+

Statping-ng includes a Prometheus Exporter so you can have even more monitoring power with your services. The Prometheus exporter can be seen on /metrics, simply create another exporter in your prometheus config. Use your Statping-ng API Secret for the Authorization Bearer header, the /metrics URL is dedicated for Prometheus and requires the correct API Secret has Authorization header.

+ ```yaml scrape_configs: - job_name: 'statping' @@ -111,61 +154,9 @@ scrape_configs: static_configs: - targets: ['statping:8080'] ``` -



-## Run on EC2 Server -Running Statping on the smallest EC2 server is very quick using the AWS AMI Image. Checkout the [AWS Wiki](https://github.com/statping/statping/wiki/AWS-EC2) to see a step by step guide on how to get your EC2 Statping service online. -



- -##### Create Security Groups -Create the AWS Security Groups with the commands below, Statping will expose port 80 and 443. -```bash -aws ec2 create-security-group --group-name StatpingPublicHTTP \ - --description "Statping HTTP Server on port 80 and 443" -# will response back a Group ID. Copy ID and use it for --group-id below. - -aws ec2 authorize-security-group-ingress \ - --group-id sg-7e8b830f --protocol tcp \ - --port 80 --cidr 0.0.0.0/0 - -aws ec2 authorize-security-group-ingress \ - --group-id sg-7e8b830f --protocol tcp \ - --port 443 --cidr 0.0.0.0/0 -``` -##### Create EC2 without SSL -```bash -aws ec2 run-instances \ - --image-id ami-7be8a103 \ - --count 1 --instance-type t2.nano \ - --key-name MYKEYHERE \ - --security-group-ids sg-7e8b830f -``` -##### Create EC2 with Automatic SSL Certification -The AWS-CLI command below will automatically create an EC2 server and create an SSL certificate from Lets Encrypt, for free. -```bash -wget https://raw.githubusercontent.com/statping/statping/master/servers/ec2-ssl.sh -# Edit ec2-ssl.sh and insert your domain you want to use, then run command below. -# Use the Security Group ID that you used above for --security-group-ids - -aws ec2 run-instances \ - --user-data file://ec2-ssl.sh \ - --image-id ami-7be8a103 \ - --count 1 --instance-type t2.nano \ - --key-name MYKEYHERE \ - --security-group-ids sg-7e8b830f -``` - -## Contributing -Statping accepts Push Requests to the `dev` branch! Feel free to add your own features and notifiers. You probably want to checkout the [Notifier Wiki](https://github.com/statping/statping/wiki/Notifiers) to get a better understanding on how to create your own notification methods for failing/successful services. Testing on Statping will test each function on MySQL, Postgres, and SQLite. I recommend running MySQL and Postgres Docker containers for testing. You can find multiple docker-compose files in the dev directory. - -![Dev Release](https://github.com/statping/statping/workflows/Dev%20Release/badge.svg?branch=dev) -[![Go Report Card](https://goreportcard.com/badge/github.com/statping/statping)](https://goreportcard.com/report/github.com/statping/statping) -[![Build Status](https://travis-ci.com/statping/statping.svg?branch=master)](https://travis-ci.com/statping/statping) [![Cypress.io tests](https://img.shields.io/badge/cypress.io-tests-green.svg?style=flat-square)](https://dashboard.cypress.io/#/projects/bi8mhr/runs) -[![Docker Pulls](https://img.shields.io/docker/pulls/statping/statping.svg)](https://hub.docker.com/r/statping/statping/builds/) [![Godoc](https://godoc.org/github.com/statping/statping?status.svg)](https://godoc.org/github.com/statping/statping)[![Coverage Status](https://coveralls.io/repos/github/statping/statping/badge.svg?branch=master)](https://coveralls.io/github/statping/statping?branch=master) - - -

- - - -

+

Contributing

+

Statping-ng accepts Push Requests to the dev branch!

+

Feel free to add your own features and notifiers.You probably want to checkout the Notifier Wiki to get a better understanding on how to create your own notification methods for failing/successful services.

+

Testing on Statping-ng will test each function on MySQL, Postgres, and SQLite. I recommend running MySQL and Postgres Docker containers for testing.

+

You can find multiple docker-compose files in the dev directory.

diff --git a/app.json b/app.json index a4f0abfb..c2119701 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { - "name": "Statping", + "name": "Statping-ng", "description": "Statping Server Monitoring with Status Page", - "repository": "https://github.com/statping/statping", + "repository": "https://github.com/adamboutcher/statping-ng", "logo": "https://assets.statping.com/banner.png", "keywords": ["statping", "server", "monitoring", "status page","golang", "go"] } diff --git a/cmd/cli.go b/cmd/cli.go index 4f06b8e1..ae205040 100644 --- a/cmd/cli.go +++ b/cmd/cli.go @@ -5,12 +5,12 @@ import ( "encoding/json" "fmt" "github.com/pkg/errors" - "github.com/statping/statping/handlers" - "github.com/statping/statping/source" - "github.com/statping/statping/types/configs" - "github.com/statping/statping/types/core" - "github.com/statping/statping/types/services" - "github.com/statping/statping/utils" + "github.com/statping-ng/statping-ng/handlers" + "github.com/statping-ng/statping-ng/source" + "github.com/statping-ng/statping-ng/types/configs" + "github.com/statping-ng/statping-ng/types/core" + "github.com/statping-ng/statping-ng/types/services" + "github.com/statping-ng/statping-ng/utils" "io/ioutil" "os" "path/filepath" @@ -351,7 +351,7 @@ func ask(format string) bool { func updateDisplay() error { gitCurrent, err := checkGithubUpdates() if err != nil { - return errors.Wrap(err, "Issue connecting to https://github.com/statping/statping") + return errors.Wrap(err, "Issue connecting to https://github.com/statping-ng/statping-ng") } if gitCurrent.TagName == "" { return nil @@ -395,7 +395,7 @@ func runOnce() error { } func checkGithubUpdates() (githubResponse, error) { - url := "https://api.github.com/repos/statping/statping/releases/latest" + url := "https://api.github.com/repos/statping-ng/statping-ng/releases/latest" contents, _, err := utils.HttpRequest(url, "GET", nil, nil, nil, time.Duration(2*time.Second), true, nil) if err != nil { return githubResponse{}, err diff --git a/cmd/cli_test.go b/cmd/cli_test.go index 586db178..8f0e5cb6 100644 --- a/cmd/cli_test.go +++ b/cmd/cli_test.go @@ -2,8 +2,8 @@ package main import ( "bytes" - "github.com/statping/statping/source" - "github.com/statping/statping/utils" + "github.com/statping-ng/statping-ng/source" + "github.com/statping-ng/statping-ng/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "io/ioutil" diff --git a/cmd/commands.go b/cmd/commands.go index b2850854..26c4eec8 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/statping/statping/utils" + "github.com/statping-ng/statping-ng/utils" "io" "os" "os/exec" diff --git a/cmd/doc.go b/cmd/doc.go index 3d50f0b2..1d3f5a21 100644 --- a/cmd/doc.go +++ b/cmd/doc.go @@ -23,5 +23,5 @@ // docker pull crazy-max/xgo // build-all // -// More info on: https://github.com/statping/statping +// More info on: https://github.com/adamboutcher/statping-ng package main diff --git a/cmd/flags.go b/cmd/flags.go index 42407ffe..a55f8b05 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -2,7 +2,7 @@ package main import ( "github.com/spf13/cobra" - "github.com/statping/statping/utils" + "github.com/statping-ng/statping-ng/utils" ) var ( diff --git a/cmd/main.go b/cmd/main.go index d3f7e082..e4453c01 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -3,15 +3,15 @@ package main import ( "fmt" "github.com/pkg/errors" - "github.com/statping/statping/database" - "github.com/statping/statping/handlers" - "github.com/statping/statping/notifiers" - "github.com/statping/statping/source" - "github.com/statping/statping/types/configs" - "github.com/statping/statping/types/core" - "github.com/statping/statping/types/metrics" - "github.com/statping/statping/types/services" - "github.com/statping/statping/utils" + "github.com/statping-ng/statping-ng/database" + "github.com/statping-ng/statping-ng/handlers" + "github.com/statping-ng/statping-ng/notifiers" + "github.com/statping-ng/statping-ng/source" + "github.com/statping-ng/statping-ng/types/configs" + "github.com/statping-ng/statping-ng/types/core" + "github.com/statping-ng/statping-ng/types/metrics" + "github.com/statping-ng/statping-ng/types/services" + "github.com/statping-ng/statping-ng/utils" "os" "os/signal" "syscall" diff --git a/database/database.go b/database/database.go index 79b6fc2a..7fe1cd48 100644 --- a/database/database.go +++ b/database/database.go @@ -4,8 +4,8 @@ import ( "database/sql" "fmt" "github.com/jinzhu/gorm" - "github.com/statping/statping/types/metrics" - "github.com/statping/statping/utils" + "github.com/statping-ng/statping-ng/types/metrics" + "github.com/statping-ng/statping-ng/utils" "strings" "time" diff --git a/database/grouping.go b/database/grouping.go index 28bce658..8699ff19 100644 --- a/database/grouping.go +++ b/database/grouping.go @@ -3,8 +3,8 @@ package database import ( "errors" "fmt" - "github.com/statping/statping/types" - "github.com/statping/statping/utils" + "github.com/statping-ng/statping-ng/types" + "github.com/statping-ng/statping-ng/utils" "net/http" "net/url" "strconv" diff --git a/database/routines.go b/database/routines.go index 591277da..3a0bf594 100644 --- a/database/routines.go +++ b/database/routines.go @@ -2,7 +2,7 @@ package database import ( "fmt" - "github.com/statping/statping/utils" + "github.com/statping-ng/statping-ng/utils" "time" _ "github.com/jinzhu/gorm/dialects/mysql" diff --git a/dev/docker-compose.full.m1.yml b/dev/docker-compose.full.m1.yml new file mode 100644 index 00000000..8f38b386 --- /dev/null +++ b/dev/docker-compose.full.m1.yml @@ -0,0 +1,275 @@ +version: '2.3' + + +############################################### +# Statping Full Stack +# +# Statping SQLIte => http://localhost:8080 +# Statping MySQL => http://localhost:8081 +# Statping Postgres => http://localhost:8082 +# Statping MariaDB => http://localhost:8083 +# +# Adminer => http://localhost:8282 +# Prometheus => http://localhost:7050 +# Grafana => http://localhost:3000 +# +# MySQL => http://localhost:3306 +# Postgres => http://localhost:5432 +# MariaDB => http://localhost:3307 +# +############################################### + +services: + + statping_sqlite: + container_name: statping_sqlite + platform: linux/amd64 + build: + context: ./ + restart: on-failure + volumes: + - ./dev/docker/statping/sqlite:/app + - ./dev/services.yml:/app/services.yml + environment: + DB_CONN: sqlite + API_SECRET: exampleapisecret + NAME: Statping + DOMAIN: http://localhost:8084 + DESCRIPTION: This is a dev environment on SQLite! + ADMIN_USER: admin + ADMIN_PASSWORD: admin + SAMPLE_DATA: 'false' + ports: + - 8084:8080 + networks: + - database + - frontend + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"] + timeout: 2s + interval: 10s + retries: 20 + + statping_mysql: + container_name: statping_mysql + platform: linux/amd64 + build: + context: ./ + restart: on-failure + volumes: + - ./dev/docker/statping/mysql:/app + - ./dev/services.yml:/app/services.yml + environment: + DB_CONN: mysql + DB_HOST: mysql + DB_USER: root + DB_PASS: password123 + DB_DATABASE: statping + DB_PORT: 3306 + API_SECRET: exampleapisecret + NAME: Statping MySQL + DOMAIN: http://localhost:8081 + DESCRIPTION: This is a dev environment on MySQL! + ADMIN_USER: admin + ADMIN_PASSWORD: admin + SAMPLE_DATA: 'false' + ports: + - 8081:8080 + networks: + - database + - frontend + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"] + timeout: 2s + interval: 10s + retries: 20 + depends_on: + mysql: + condition: service_healthy + + statping_postgres: + container_name: statping_postgres + platform: linux/amd64 + build: + context: ./ + restart: on-failure + volumes: + - ./dev/docker/statping/mysql:/app + - ./dev/services.yml:/app/services.yml + environment: + DB_CONN: postgres + DB_HOST: postgres + DB_USER: root + DB_PASS: password123 + DB_DATABASE: statping + DB_PORT: 5432 + API_SECRET: exampleapisecret + NAME: Statping Postgres + DOMAIN: http://localhost:8082 + DESCRIPTION: This is a dev environment on Postgres! + ADMIN_USER: admin + ADMIN_PASSWORD: admin + SAMPLE_DATA: 'false' + ports: + - 8082:8080 + networks: + - database + - frontend + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"] + timeout: 2s + interval: 10s + retries: 20 + depends_on: + postgres: + condition: service_healthy + + statping_mariadb: + container_name: statping_mariadb + platform: linux/amd64 + build: + context: ./ + restart: on-failure + volumes: + - ./dev/docker/statping/mariadb:/app + - ./dev/services.yml:/app/services.yml + environment: + DB_CONN: mysql + DB_HOST: mariadb + DB_USER: root + DB_PASS: password123 + DB_DATABASE: statping + DB_PORT: 3306 + API_SECRET: exampleapisecret + NAME: Statping MariaDB + DOMAIN: http://localhost:8083 + DESCRIPTION: This is a dev environment on MariaDB! + ADMIN_USER: admin + ADMIN_PASSWORD: admin + SAMPLE_DATA: 'false' + ports: + - 8083:8080 + networks: + - database + - frontend + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"] + timeout: 2s + interval: 10s + retries: 20 + depends_on: + mariadb: + condition: service_healthy + + postgres: + container_name: postgres + image: postgres + volumes: + - ./dev/docker/databases/postgres:/var/lib/postgresql/data + ports: + - 5432:5432 + environment: + POSTGRES_PASSWORD: password123 + POSTGRES_DB: statping + POSTGRES_USER: root + networks: + - database + healthcheck: + test: ["CMD-SHELL", "pg_isready -U root"] + interval: 15s + timeout: 10s + retries: 20 + + mysql: + container_name: mysql + image: mysql:5.7 + volumes: + - ./dev/docker/databases/mysql:/var/lib/mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: password123 + MYSQL_DATABASE: statping + ports: + - 3306:3306 + networks: + - database + healthcheck: + test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] + timeout: 20s + interval: 15s + retries: 30 + + mariadb: + container_name: mariadb + image: mariadb + volumes: + - ./dev/docker/databases/mariadb:/var/lib/mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: password123 + MYSQL_DATABASE: statping + ports: + - 3307:3306 + networks: + - database + healthcheck: + test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] + timeout: 20s + interval: 15s + retries: 30 + + adminer: + container_name: adminer + image: adminer + restart: always + networks: + - database + - frontend + ports: + - 8282:8080 + + prometheus: + container_name: prometheus + platform: linux/amd64 + image: prom/prometheus:v2.0.0 + restart: on-failure + volumes: + - ./dev/prometheus.yml:/etc/prometheus/prometheus.yml + - ./dev/docker/databases/prometheus:/prometheus + ports: + - 7050:9090 + networks: + - database + healthcheck: + test: "/bin/wget -q -Y off http://localhost:9090/status -O /dev/null > /dev/null 2>&1" + interval: 10s + timeout: 3s + + grafana: + container_name: grafana + image: grafana/grafana + restart: on-failure + ports: + - 3000:3000 + volumes: + - ./dev/docker/grafana:/var/lib/grafana + - ./dev/grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml + - ./dev/grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml + - ./dev/grafana/statping_dashboard.json:/etc/grafana/provisioning/dashboards/statping_dashboard.json + environment: + - GF_USERS_ALLOW_SIGN_UP=false + - GF_AUTH_ANONYMOUS_ENABLED=true + depends_on: + prometheus: + condition: service_healthy + networks: + - frontend + - database + healthcheck: + test: "/usr/bin/wget -q -Y off http://localhost:3000/api/health -O /dev/null > /dev/null 2>&1" + interval: 10s + retries: 20 + +networks: + frontend: + database: diff --git a/dev/docker-compose.full.yml b/dev/docker-compose.full.yml index 740c75b8..fde6b0bb 100644 --- a/dev/docker-compose.full.yml +++ b/dev/docker-compose.full.yml @@ -24,11 +24,11 @@ services: statping_sqlite: container_name: statping_sqlite build: - context: ../ + context: ./ restart: on-failure volumes: - - ./docker/statping/sqlite:/app - - ./services.yml:/app/services.yml + - ./dev/docker/statping/sqlite:/app + - ./dev/services.yml:/app/services.yml environment: DB_CONN: sqlite API_SECRET: exampleapisecret @@ -39,7 +39,7 @@ services: ADMIN_PASSWORD: admin SAMPLE_DATA: 'false' ports: - - 8080:8080 + - 8084:8080 networks: - database - frontend @@ -52,11 +52,11 @@ services: statping_mysql: container_name: statping_mysql build: - context: ../ + context: ./ restart: on-failure volumes: - - ./docker/statping/mysql:/app - - ./services.yml:/app/services.yml + - ./dev/docker/statping/mysql:/app + - ./dev/services.yml:/app/services.yml environment: DB_CONN: mysql DB_HOST: mysql @@ -88,11 +88,11 @@ services: statping_postgres: container_name: statping_postgres build: - context: ../ + context: ./ restart: on-failure volumes: - - ./docker/statping/mysql:/app - - ./services.yml:/app/services.yml + - ./dev/docker/statping/mysql:/app + - ./dev/services.yml:/app/services.yml environment: DB_CONN: postgres DB_HOST: postgres @@ -124,11 +124,11 @@ services: statping_mariadb: container_name: statping_mariadb build: - context: ../ + context: ./ restart: on-failure volumes: - - ./docker/statping/mariadb:/app - - ./services.yml:/app/services.yml + - ./dev/docker/statping/mariadb:/app + - ./dev/services.yml:/app/services.yml environment: DB_CONN: mysql DB_HOST: mariadb @@ -161,7 +161,7 @@ services: container_name: postgres image: postgres volumes: - - ./docker/databases/postgres:/var/lib/postgresql/data + - ./dev/docker/databases/postgres:/var/lib/postgresql/data ports: - 5432:5432 environment: @@ -180,7 +180,7 @@ services: container_name: mysql image: mysql:5.7 volumes: - - ./docker/databases/mysql:/var/lib/mysql + - ./dev/docker/databases/mysql:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: password123 @@ -201,7 +201,7 @@ services: container_name: mariadb image: mariadb volumes: - - ./docker/databases/mariadb:/var/lib/mysql + - ./dev/docker/databases/mariadb:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: password123 @@ -233,8 +233,8 @@ services: image: prom/prometheus:v2.0.0 restart: on-failure volumes: - - ./prometheus.yml:/etc/prometheus/prometheus.yml - - ./docker/databases/prometheus:/prometheus + - ./dev/prometheus.yml:/etc/prometheus/prometheus.yml + - ./dev/docker/databases/prometheus:/prometheus ports: - 7050:9090 networks: @@ -251,10 +251,10 @@ services: ports: - 3000:3000 volumes: - - ./docker/grafana:/var/lib/grafana - - ./grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml - - ./grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml - - ./grafana/statping_dashboard.json:/etc/grafana/provisioning/dashboards/statping_dashboard.json + - ./dev/docker/grafana:/var/lib/grafana + - ./dev/grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml + - ./dev/grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml + - ./dev/grafana/statping_dashboard.json:/etc/grafana/provisioning/dashboards/statping_dashboard.json environment: - GF_USERS_ALLOW_SIGN_UP=false - GF_AUTH_ANONYMOUS_ENABLED=true diff --git a/dev/docker-compose.lite.yml b/dev/docker-compose.lite.yml index 75e48a54..66b9c85e 100644 --- a/dev/docker-compose.lite.yml +++ b/dev/docker-compose.lite.yml @@ -4,19 +4,19 @@ services: statping_dev: container_name: statping_dev - image: statping/statping:dev + image: statping-ng/statping-ng:dev restart: on-failure volumes: - - ./cmd:/go/src/github.com/statping/statping/cmd/ - - ./core:/go/src/github.com/statping/statping/core/ - - ./database:/go/src/github.com/statping/statping/database/ - - ./dev:/go/src/github.com/statping/statping/dev/ - - ./frontend:/go/src/github.com/statping/statping/frontend/ - - ./handlers:/go/src/github.com/statping/statping/handlers/ - - ./notifiers:/go/src/github.com/statping/statping/notifiers/ - - ./source:/go/src/github.com/statping/statping/source/ - - ./types:/go/src/github.com/statping/statping/types/ - - ./utils:/go/src/github.com/statping/statping/utils/ + - ./cmd:/go/src/github.com/statping-ng/statping-ng/cmd/ + - ./core:/go/src/github.com/statping-ng/statping-ng/core/ + - ./database:/go/src/github.com/statping-ng/statping-ng/database/ + - ./dev:/go/src/github.com/statping-ng/statping-ng/dev/ + - ./frontend:/go/src/github.com/statping-ng/statping-ng/frontend/ + - ./handlers:/go/src/github.com/statping-ng/statping-ng/handlers/ + - ./notifiers:/go/src/github.com/statping-ng/statping-ng/notifiers/ + - ./source:/go/src/github.com/statping-ng/statping-ng/source/ + - ./types:/go/src/github.com/statping-ng/statping-ng/types/ + - ./utils:/go/src/github.com/statping-ng/statping-ng/utils/ environment: DB_CONN: sqlite API_SECRET: exampleapisecret diff --git a/dev/postman.json b/dev/postman.json index 4aaf42be..cd061232 100644 --- a/dev/postman.json +++ b/dev/postman.json @@ -2,7 +2,7 @@ "info": { "_postman_id": "3c6a7841-0b39-4878-a3a6-1c76832b7679", "name": "Statping", - "description": "The Statping API allows you to programmatically access data on your Statping server.\n\nThe easiest way to get started with the API is by running your own Docker or local instance of the Statping server.\n\n\n\n# Authentication\n\nAn API Key is required to be sent as part of every request to the Statping API, by using the `Authorization` and the API Secret Key as a header.\n\n> If you do not have an API Secret Key, you can find it on the Settings page.\n\nYou can Authenticate by implementing the following...\n- Using the `Authorization` header with API Secret Key\n- Setting `GO_ENV` to `test` to bypass all authentication\n- Adding `?api=` URL Query along with the API Secret Key\n- Adding `?api=` URL Query along with the API Key for a user\n- Being logged into Statping as an admin (using JWT sessions/cookies)\n\n> Authentication will create a cookie named `statping_auth`.\n\n# Environment Variables\nStatping includes many environment variables that can give you more control over your instance. Please view the [Environment Variables Wiki](https://github.com/statping/statping/wiki/Environment-Variables) page to view a complete list. Below are a couple important ones...\n- `STATPING_DIR` - Statping's working directory. By default, this will be set to the current working directory. This path will contain the `config.yml` file, `logs`, and `assets` folder. \n- `SASS` - Absolute path to the `sass` executable. By default it will attempt to find `sass` in your `$PATH`. \n\n# Demo\nYou can checkout the Statping Demo instance at [https://demo.statping.com](https://demo.statping.com). All features are available for you to experiment with. The API Secret Key is `demoapisecret123`. Since this instance is public, it will be reset with sample data **every 90 minutes**.\n", + "description": "The Statping API allows you to programmatically access data on your Statping server.\n\nThe easiest way to get started with the API is by running your own Docker or local instance of the Statping server.\n\n\n\n# Authentication\n\nAn API Key is required to be sent as part of every request to the Statping API, by using the `Authorization` and the API Secret Key as a header.\n\n> If you do not have an API Secret Key, you can find it on the Settings page.\n\nYou can Authenticate by implementing the following...\n- Using the `Authorization` header with API Secret Key\n- Setting `GO_ENV` to `test` to bypass all authentication\n- Adding `?api=` URL Query along with the API Secret Key\n- Adding `?api=` URL Query along with the API Key for a user\n- Being logged into Statping as an admin (using JWT sessions/cookies)\n\n> Authentication will create a cookie named `statping_auth`.\n\n# Environment Variables\nStatping includes many environment variables that can give you more control over your instance. Please view the [Environment Variables Wiki](https://github.com/statping-ng/statping-ng/wiki/Environment-Variables) page to view a complete list. Below are a couple important ones...\n- `STATPING_DIR` - Statping's working directory. By default, this will be set to the current working directory. This path will contain the `config.yml` file, `logs`, and `assets` folder. \n- `SASS` - Absolute path to the `sass` executable. By default it will attempt to find `sass` in your `$PATH`. \n\n# Demo\nYou can checkout the Statping Demo instance at [https://demo.statping.com](https://demo.statping.com). All features are available for you to experiment with. The API Secret Key is `demoapisecret123`. Since this instance is public, it will be reset with sample data **every 90 minutes**.\n", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ @@ -667,7 +667,7 @@ "metrics" ] }, - "description": "Point your Prometheus endpoint to `/metrics`, it will include most data from all elements including golang processes. View more information by checking out the [Prometheus Wiki](https://github.com/statping/statping/wiki/Prometheus-Exporter)." + "description": "Point your Prometheus endpoint to `/metrics`, it will include most data from all elements including golang processes. View more information by checking out the [Prometheus Wiki](https://github.com/statping-ng/statping-ng/wiki/Prometheus-Exporter)." }, "response": [ { @@ -4598,59 +4598,9 @@ "body": "{\n \"success\": true,\n \"response\": \"There's been a glitch… | Slack

There’s been a glitch…

We’re not quite sure what went wrong. You can go back, or try looking on our Help Center if you need a hand.

\\n\\n\\n\\n\"\n}" } ] - }, - { - "name": "Statping Emailer", - "event": [ - { - "listen": "test", - "script": { - "id": "00f5c79e-e927-4305-b276-265b4d51b1e1", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"email\": \"info@socialeck.com\",\n \"core\": {\n \"allow_reports\": true,\n \"created_at\": \"2020-06-21T05:00:12.735144154Z\",\n \"description\": \"This status page has sample data included\",\n \"domain\": \"http://localhost:8080\",\n \"footer\": null,\n \"language\": \"en\",\n \"migration_id\": 1592715612,\n \"name\": \"Statping Sample Data\",\n \"setup\": true,\n \"started_on\": \"2020-06-21T05:01:01.406134998Z\",\n \"updated_at\": \"2020-06-21T05:00:59.652965634Z\",\n \"using_cdn\": false,\n \"version\": \"0.90.54\"\n },\n \"service\": {\n \"name\": \"Statping Website\",\n \"domain\": \"https://statping.com\",\n \"last_error\": \"2020-06-21T01:01:01.406134998Z\",\n \"last_success\": \"2020-06-21T05:01:01.406134998Z\",\n \"expected\": \"\",\n \"online\": true,\n \"expected_status\": 200,\n \"check_interval\": 30,\n \"type\": \"http\",\n \"method\": \"GET\",\n \"post_data\": \"\",\n \"port\": 0,\n \"timeout\": 30,\n \"order_id\": 0\n },\n \"failure\": {\n \"created_at\": \"2020-06-21T05:01:00.67942464Z\",\n \"error_code\": 406,\n \"id\": 1613,\n \"issue\": \"HTTP Status Code 406 did not match 200\",\n \"method_id\": 0,\n \"ping\": 10889\n }\n}", - "options": { - "raw": {} - } - }, - "url": { - "raw": "https://news.statping.com/notifier", - "protocol": "https", - "host": [ - "news", - "statping", - "com" - ], - "path": [ - "notifier" - ] - }, - "description": "This endpoint will send emails from our servers rather than you using your own SMTP email settings. Once you save the Statping Emailer Notifier, we will send you a verification email. Once you've confirmed your email address you will recieve emails whenever your service status changes." - }, - "response": [] } ], - "description": "Statping contains multiple notifiers that will send you a notification whenever a service become offline, or online. You can create your own 3rd party notifier by reading more on the [Notifiers Wiki](https://github.com/statping/statping/wiki/Notifiers) on the Github repo.", + "description": "Statping contains multiple notifiers that will send you a notification whenever a service become offline, or online. You can create your own 3rd party notifier by reading more on the [Notifiers Wiki](https://github.com/statping-ng/statping-ng/wiki/Notifiers) on the Github repo.", "auth": { "type": "bearer", "bearer": [ @@ -6242,4 +6192,4 @@ } ], "protocolProfileBehavior": {} -} \ No newline at end of file +} diff --git a/doc.go b/doc.go index cd6d3a0d..ba3274bb 100644 --- a/doc.go +++ b/doc.go @@ -1,10 +1,10 @@ // Package statping is a server monitoring application that includes a status page server. Visit the Statping repo at -// https://github.com/statping/statping to get a full understanding of what this application can do. +// https://github.com/adamboutcher/statping-ng to get a full understanding of what this application can do. // // Install Statping // // Statping is available for Mac, Linux and Windows 64x. You can download the tar.gz file or use a couple other methods. Download -// the latest release at https://github.com/statping/statping/releases/latest or view below. If you're on windows, download +// the latest release at https://github.com/statping-ng/statping-ng/releases/latest or view below. If you're on windows, download // the zip file from the latest releases link. // // // MacOS using homebrew @@ -20,5 +20,5 @@ // Statping can be built in many way, the best way is to use Docker! // docker run -it -p 8080:8080 statping/statping // -// Enjoy Statping and tell me any issues you might be having on Github. https://github.com/hunterlong -package statping +// Enjoy Statping and tell me any issues you might be having on Github. https://github.com/adamboutcher +package statping_ng diff --git a/docker-compose.yml b/docker-compose.yml index a276180a..395b773e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '2.3' services: statping: container_name: statping - image: statping/statping:dev + image: adamboutcher/statping-ng:latest restart: always volumes: - statping_data:/app diff --git a/frontend/cypress/integration/settings_spec.js b/frontend/cypress/integration/settings_spec.js index c92fd1d2..eb40fa0c 100644 --- a/frontend/cypress/integration/settings_spec.js +++ b/frontend/cypress/integration/settings_spec.js @@ -72,7 +72,7 @@ context('Settings Tests', () => { cy.visit('/dashboard/settings') cy.get('#v-pills-style-tab').click() cy.get('#pills-vars-tab').click() - cy.get('#assets_dir').should('contain', 'github.com/statping/statping/assets') + cy.get('#assets_dir').should('contain', 'github.com/statping-ng/statping-ng/assets') }) it('should save Local Assets', () => { diff --git a/frontend/public/base.gohtml b/frontend/public/base.gohtml index 696d733f..3cae161e 100644 --- a/frontend/public/base.gohtml +++ b/frontend/public/base.gohtml @@ -25,7 +25,7 @@ {{if USE_CDN}} - + {{else}} <% _.each(htmlWebpackPlugin.tags.headTags, function(headTag) { %> <%= headTag %> <% }) %> @@ -39,10 +39,10 @@
{{if USE_CDN}} - - - - + + + + {{else}} <% _.each(htmlWebpackPlugin.tags.bodyTags, function(bodyTag) { %> <%= bodyTag %> <% }) %> diff --git a/frontend/public/img/banner.png b/frontend/public/img/banner.png index 5aa272e1..996f9039 100644 Binary files a/frontend/public/img/banner.png and b/frontend/public/img/banner.png differ diff --git a/frontend/public/index.html b/frontend/public/index.html index cf620e9a..02d1d682 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -5,11 +5,11 @@ - Statping + Statping-ng
diff --git a/frontend/src/API.js b/frontend/src/API.js index 3e62d295..d6e8bad5 100644 --- a/frontend/src/API.js +++ b/frontend/src/API.js @@ -7,8 +7,8 @@ const tokenKey = "statping_auth"; class Api { constructor() { - this.version = "0.90.74"; - this.commit = "df8e1f73d9f7fdf218bc5c26130d7d8a6af6719a"; + this.version = "0.91.0"; + this.commit = "b7ecf0c31b0c75c394061d2f6457a925e4440f1e"; } async oauth() { @@ -275,7 +275,7 @@ class Api { } async github_release() { - return fetch('https://api.github.com/repos/statping/statping/releases/latest').then(response => response.json()) + return fetch('https://api.github.com/repos/statping-ng/statping-ng/releases/latest').then(response => response.json()) } async allActions(...all) { diff --git a/frontend/src/components/Dashboard/TopNav.vue b/frontend/src/components/Dashboard/TopNav.vue index 8136fff8..c8692de6 100644 --- a/frontend/src/components/Dashboard/TopNav.vue +++ b/frontend/src/components/Dashboard/TopNav.vue @@ -1,6 +1,6 @@