Check script
This is a script to check all those important services for Greenstand:
#!/bin/bash
set -e
env_to_check=$1
# check if env is set, and is one of the allowed values
if [ -z "$env_to_check" ]; then
echo "Please provide an environment to check"
exit 1
fi
if [ "$env_to_check" != "dev" ] && [ "$env_to_check" != "prod" ]; then
echo "Please provide a valid environment to check"
exit 1
fi
echo "Checking important services..."
# define function to check if a service is running
check_service_by_url () {
echo "Checking $1..."
if curl -s --head --request GET $2 | grep "200 OK" > /dev/null; then
echo "$1 is running"
else
echo "$1 is not running"
exit 1
fi
}
# check services
if [ "$env_to_check" == "dev" ]; then
check_service_by_url "web-map" "https://alpha-dev.treetracker.org/"
check_service_by_url "tile-server+pgpool+db" "https://dev-k8s.treetracker.org/tiles/1/1/1.png"
check_service_by_url "airflow" "https://dev-k8s.treetracker.org/airflow/login/"
check_service_by_url "treetracker-api" "https://dev-k8s.treetracker.org/treetracker/"
check_service_by_url "admin-panel-api" "https://dev-k8s.treetracker.org/api/admin/"
check_service_by_url "query-api+db" "https://dev-k8s.treetracker.org/query/planters"
check_service_by_url "wallet-api" "https://dev-k8s.treetracker.org/wallet/"
check_service_by_url "reporting-api" "https://dev-k8s.treetracker.org/reporting/"
elif [ "$env_to_check" == "prod" ]; then
check_service_by_url "web-map" "https://map.treetracker.org/"
check_service_by_url "tile-server+pgpool+db" "https://prod-k8s.treetracker.org/tiles/"
check_service_by_url "airflow" "https://prod-k8s.treetracker.org/airflow/login/"
check_service_by_url "treetracker-api" "https://prod-k8s.treetracker.org/treetracker/"
check_service_by_url "admin-panel-api" "https://prod-k8s.treetracker.org/api/admin/"
check_service_by_url "query-api+db" "https://prod-k8s.treetracker.org/query/planters"
check_service_by_url "wallet-api" "https://prod-k8s.treetracker.org/wallet/"
check_service_by_url "reporting-api" "https://prod-k8s.treetracker.org/reporting/"
fi
echo "All services are running"
echo "Done"
This repository contains code to run e2e tests against the data ingestion pipeline https://github.com/Greenstand/testing-tools/tree/main/ingest-field-data
Last updated
Was this helpful?