Skip to content

Commit 1d646ee

Browse files
authored
Merge pull request #53 from KnowWhereGraph/deployment-fixes
Beef up deployment validation checks
2 parents 97eb8c4 + fb4c951 commit 1d646ee

2 files changed

Lines changed: 84 additions & 23 deletions

File tree

makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ BUILD_FILES_STAGE := docker-compose.yaml -f nginx/docker-compose.stage.yaml -f n
88
help: ## Show this help.
99
@sed -ne '/@sed/!s/## //p' $(MAKEFILE_LIST)
1010

11-
start-prod: ## Brings the stack online, for https://stko-kwg.geog.ucsb.edu building images if needed
11+
stop-graphdb: # Gracefully shuts GraphDB down. Use this to stop GraphDB.
12+
docker kill -s SIGTERM graphdb && docker wait graphdb
13+
start-prod: validate-deployment ## Brings the stack online, for https://stko-kwg.geog.ucsb.edu,building images if needed
1214
docker compose -f ${BUILD_FILES_PROD} up -d $(c)
13-
stop-prod: ## Brings the stack offline
15+
stop-prod: stop-graphdb ## Brings the stack offline
1416
docker compose -f ${BUILD_FILES_PROD} down $(c)
15-
start-local: ## Brings the stack online, for running on a local development machine
17+
start-local: validate-deployment ## Brings the stack online, for running on a local development machine
1618
docker compose -f ${BUILD_FILES_LOCAL} up -d $(c)
17-
stop-local: ## Brings the stack offline
19+
stop-local: stop-graphdb ## Brings the stack offline
1820
docker compose -f ${BUILD_FILES_LOCAL} down $(c)
19-
start-stage: ## Brings the stack online for staging.knowwheregraph.org, building images if needed
21+
start-stage: validate-deployment ## Brings the stack online for staging.knowwheregraph.org, building images if needed
2022
docker compose -f ${BUILD_FILES_STAGE} up -d $(c)
21-
stop-stage: ## Brings the stack offline for staging.knowwheregraph.org
23+
stop-stage: stop-graphdb ## Brings the stack offline for staging.knowwheregraph.org
2224
docker compose -f ${BUILD_FILES_STAGE} down $(c)
2325
start-local-preload: # Ingests data into GraphDB for the first time. Only launches GraphDB. For local development
2426
docker compose -f docker-compose.yaml -f graphdb/docker-compose.local.preload.yaml up -d $(c)
@@ -34,4 +36,4 @@ repository-setup: # Fetches the GitHub repos needed & configures them
3436
git clone https://github.com/KnowWhereGraph/kwg-ontologies.git nginx/sites/onto/
3537
cp nginx/robots.txt nginx/sites/robots.txt
3638
validate-deployment: # Checks the local deployment files
37-
sh validate.sh
39+
sh validate.sh

validate.sh

Lines changed: 75 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@ ORANGE='\033[0;31m'
33
DEFAULT='\033[0m'
44
GREEN='\033[0;32m'
55

6-
echo "===== KnowWhereGraph Install Validation Tool ====="
76

8-
echo "\n Checking SSL Certificates... \n"
7+
BUILD_FILES_PROD := docker-compose.yaml -f nginx/docker-compose.prod.yaml -f nginx/metrics/docker-compose.yaml -f graphdb/docker-compose.prod.yaml -f elasticsearch/docker-compose.yaml -f prometheus/docker-compose.yaml -f kwg-api/docker-compose.prod.yaml -f grafana/docker-compose.prod.yaml -f loki/docker-compose.yaml
8+
BUILD_FILES_LOCAL := docker-compose.yaml -f nginx/docker-compose.local.yaml -f nginx/metrics/docker-compose.yaml -f graphdb/docker-compose.local.yaml -f elasticsearch/docker-compose.yaml -f prometheus/docker-compose.yaml -f kwg-api/docker-compose.local.yaml -f grafana/docker-compose.local.yaml -f loki/docker-compose.yaml
9+
BUILD_FILES_STAGE := docker-compose.yaml -f nginx/docker-compose.stage.yaml -f nginx/metrics/docker-compose.yaml -f graphdb/docker-compose.stage.yaml -f elasticsearch/docker-compose.yaml -f prometheus/docker-compose.yaml -f kwg-api/docker-compose.stage.yaml -f grafana/docker-compose.stage.yaml -f loki/docker-compose.yaml
10+
11+
12+
13+
14+
15+
echo "\n\n===== KnowWhereGraph Deployment Configuration Test ====="
16+
echo "===== ====="
17+
echo " Checking SSL Certificates "
18+
echo " ......................... "
919

1020
# Check for nginx's local certificates
1121
if [ ! -f ./nginx/local-certs/cert.ped ]; then
@@ -21,53 +31,102 @@ else
2131
echo "${GREEN}Good${DEFAULT}: Located local certificates for GraphDB."
2232
fi
2333

24-
echo "\n Checking Web Applications... \n"
34+
echo "\n Checking Web Applications "
35+
echo " ......................... "
36+
2537
# Check for the faceted search folder
2638
if [ ! -d ./nginx/sites/kwg-faceted-search ]; then
27-
echo "${ORANGE}Warning${DEFAULT}: Failed to locate the faceted search folder. Has it been cloned into nginx/sites?"
39+
echo "${ORANGE}Error${DEFAULT}: Failed to locate the faceted search folder. Has it been cloned into nginx/sites?"
2840
else
2941
echo "${GREEN}Good${DEFAULT}: Located the Faceted Search folder."
3042
fi
3143

3244
# Check for Faceted Search's build directory
3345
if [ ! -d ./nginx/sites/kwg-faceted-search/dist/faceted-search ]; then
34-
echo "${ORANGE}Warning${DEFAULT}: Failed to locate the Faceted Search build directory. Try building using the docker-compose files within the faceted search folder."
46+
echo "${ORANGE}Error${DEFAULT}: Failed to locate the Faceted Search build directory. Try building using the docker-compose files within the faceted search folder."
3547
else
3648
echo "${GREEN}Good${DEFAULT}: Located the Faceted Search build artifacts."
3749
fi
3850

39-
# Check for void file
40-
if [ ! -f nginx/sites/void/void.ttl ]; then
41-
echo "${ORANGE}Warning${DEFAULT}: Void ttl file not detected!\n"
42-
else
43-
echo "${GREEN}Good${DEFAULT}: Located the void.ttl file."
44-
fi
45-
4651
# Check for KW Panels
4752
if [ ! -d nginx/sites/kw-panels ]; then
48-
echo "${ORANGE}Warning${DEFAULT}: Failed to locate the KW-Panels. Try cloning the repository into nginx/sites.\n"
53+
echo "${ORANGE}Error${DEFAULT}: Failed to locate the KW-Panels. Try cloning the repository into nginx/sites."
4954
else
5055
echo "${GREEN}Good${DEFAULT}: Located the kw-panels folder."
5156
fi
5257

5358
# Check for Node Browser src
5459
if [ ! -d nginx/sites/node-browser/node-browser ]; then
55-
echo "${ORANGE}Warning${DEFAULT}: Failed to locate the node browser. Try cloning the repository into nginx/sites.\n"
60+
echo "${ORANGE}Error${DEFAULT}: Failed to locate the node browser. Try cloning the repository into nginx/sites."
5661
else
5762
echo "${GREEN}Good${DEFAULT}: Located the node browser source."
5863
fi
5964

6065
# Check for Node Browser dist
6166
if [ ! -d nginx/sites/node-browser/node-browser/dist/node-browser ]; then
62-
echo "${ORANGE}Warning${DEFAULT}: Failed to locate the node browser's build artifacts. Try building the source with its docker-compose file.\n"
67+
echo "${ORANGE}Error${DEFAULT}: Failed to locate the node browser's build artifacts. Try building the source with its docker-compose file.\n"
6368
else
6469
echo "${GREEN}Good${DEFAULT}: Located the node browser build artifacts."
6570
fi
6671

72+
echo "\n Checking Web Artifacts "
73+
echo " ...................... "
74+
75+
76+
# Check for void file
77+
if [ ! -f nginx/sites/void/void.ttl ]; then
78+
echo "${ORANGE}Error${DEFAULT}: Void ttl file not detected!\n This file comes from the kwg-ontologies repository. Check the makefile for the clone command."
79+
else
80+
echo "${GREEN}Good${DEFAULT}: Located the void.ttl file."
81+
fi
82+
83+
6784
# Check for robots.txt
6885
if [ ! -f nginx/sites/robots.txt ]; then
69-
echo "${ORANGE}Warning${DEFAULT}: Failed to locate robots.txt.\n"
86+
echo "${ORANGE}Error${DEFAULT}: Failed to locate robots.txt"
7087
else
7188
echo "${GREEN}Good${DEFAULT}: Located the robots.txt"
7289
fi
7390

91+
echo "\n Checking System Artifacts "
92+
echo " ......................... "
93+
94+
# Check for an exiting Grafana database file
95+
if [ -f grafana/persistent_storage/grafana.db ]; then
96+
echo "${ORANGE}Warning${DEFAULT}: Found an existing Grafana database file. Any Grafana password changes will not persist."
97+
else
98+
echo "${GREEN}Good${DEFAULT}: Failed to find an existing Grafana database file. A new one will be created"
99+
fi
100+
101+
# Check for any existing GraphDB repositories
102+
103+
if [ -d graphdb/ ]; then
104+
echo "${ORANGE}Info${DEFAULT}: Found existing GraphDB repositories. These will be loaded when GraphDB starts."
105+
else
106+
echo "${GREEN}Info${DEFAULT}: Failed to find any GraphDB repositories. GraphDB will not be started with any repositories."
107+
fi
108+
109+
echo ""
110+
echo""
111+
112+
113+
echo "\n Checking Variables "
114+
echo " ......................... "
115+
116+
# Check for an exiting Grafana database file
117+
if [ -f grafana/persistent_storage/grafana.db ]; then
118+
echo "${ORANGE}Warning${DEFAULT}: Found an existing Grafana database file. Any Grafana password changes will not persist."
119+
else
120+
echo "${GREEN}Good${DEFAULT}: Failed to find an existing Grafana database file. A new one will be created"
121+
fi
122+
123+
# Check for any existing GraphDB repositories
124+
125+
if [ -d graphdb/ ]; then
126+
echo "${ORANGE}Info${DEFAULT}: Found existing GraphDB repositories. These will be loaded when GraphDB starts."
127+
else
128+
echo "${GREEN}Info${DEFAULT}: Failed to find any GraphDB repositories. GraphDB will not be started with any repositories."
129+
fi
130+
131+
echo ""
132+
echo""

0 commit comments

Comments
 (0)