Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/health-check.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Scheduled Health Check

# Controls when the action will run.
# Controls when the action will run.
on:
schedule:
- cron: "30 * * * *"
- cron: "30 * * * *"

jobs:
health_check_job:
runs-on: ubuntu-latest
name: Check all sites
steps:
- uses: actions/checkout@v2
- name: Run Shell Script
id: shell_script_run
run: bash ./health-check.sh
- uses: actions/checkout@v2
- name: Run Shell Script
id: shell_script_run
run: bash ./health-check.sh
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[![Health Check](../../actions/workflows/health-check.yml/badge.svg)](../../actions/workflows/health-check.yml)

# Statsig's Open-Source Status Page

We tried various Status Pages out there, and built this as a fun little hobby project to make status pages as simple as possible.

## Demo

* https://status.statsig.com
* Live view of this repo: https://statsig-io.github.io/statuspage/
- https://status.statsig.com

## Setup instructions

Expand Down
47 changes: 29 additions & 18 deletions health-check.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
# In the original repository we'll just print the result of status checks,
# without committing. This avoids generating several commits that would make
# later upstream merges messy for anyone who forked us.
commit=true
origin=$(git remote get-url origin)
if [[ $origin == *statsig-io/statuspage* ]]
then
commit=false
fi

KEYSARRAY=()
URLSARRAY=()

urlsConfig="./urls.cfg"
echo "Reading $urlsConfig"
while read -r line
do
echo "$line"
echo " $line"
IFS='=' read -ra TOKENS <<< "$line"
echo $TOKENS

KEYSARRAY+=(${TOKENS[0]})
URLSARRAY+=(${TOKENS[1]})
done < "$urlsConfig"


echo "***********************"
echo $KEYSARRAY
echo $URLSARRAY
echo ${#KEYSARRAY[@]}
echo "***********************"
echo "Starting health checks with ${#KEYSARRAY[@]} configs:"

mkdir -p logs

for (( index=0; index < ${#KEYSARRAY[@]}; index++))
do
key="${KEYSARRAY[index]}"
url="${URLSARRAY[index]}"

echo $key
echo $url
echo " $key=$url"

for i in 1 2 3 4;
do
Expand All @@ -43,12 +46,20 @@ do
sleep 5
done
dateTime=$(date +'%Y-%m-%d %H:%M')
echo $dateTime, $result >> "logs/${key}_report.log"
if [[ $commit == true ]]
then
echo $dateTime, $result >> "logs/${key}_report.log"
else
echo " $dateTime, $result"
fi
done

git config --global user.name 'Vijaye Raji'
git config --global user.email 'vijaye@statsig.com'
git add -A --force logs/
git commit -am 'Status logs - automated'
git push

if [[ $commit == true ]]
then
# Let's make Vijaye the most productive person on GitHub.
git config --global user.name 'Vijaye Raji'
git config --global user.email 'vijaye@statsig.com'
git add -A --force logs/
git commit -am '[Automated] Update Health Check Logs'
git push
fi