-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
134 lines (116 loc) · 5.02 KB
/
Copy pathMakefile
File metadata and controls
134 lines (116 loc) · 5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Makefile for managing the Okta OPP JDBC Docker environment
-include .env
export
.PHONY: help start start-logs stop stop-logs restart restart-logs logs build configure check-prereqs
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " start - Checks prerequisites, starts containers in the background."
@echo " stop - Stops and removes all containers."
@echo " restart - Restarts containers in the background."
@echo " logs - Follows container logs."
@echo " start-logs - Checks prerequisites, starts containers in the background, and follows logs."
@echo " start-live - Checks prerequisites, starts containers in live mode"
@echo " restart-logs - Restarts containers in the background and follows logs."
@echo " build - Build all the images."
@echo " rebuild - Forces a rebuild of the images from scratch."
@echo " kill - Kill the containers and remove orphans"
@echo " configure - Runs the interactive Okta agent configuration script."
@echo " check-prereqs - Runs prerequisite checks without starting the services."
@echo " check-build-prereqs - Runs buil prerequisite checks without starting the services."
start: check-prereqs
@echo "--> Starting containers in detached mode..."
@docker compose up -d
start-live: check-prereqs
@echo "--> Starting containers in detached mode..."
@docker compose up
stop:
@echo "--> Stopping containers..."
@docker compose down
restart: stop start
logs:
@echo "--> Tailing and following logs..."
@docker compose logs -f --tail=500
start-logs: check-prereqs
@echo "--> Starting containers and attaching logs..."
@docker compose up -d &
@sleep 5
@$(MAKE) logs
restart-logs: stop start-logs
rebuild: check-prereqs
@echo "--> Forcing a rebuild of all images..."
@docker compose build --no-cache --pull --force-rm
build: check-prereqs
@echo "--> Build all images..."
@docker compose build
kill:
@echo "--> Killing the containers and remove orphans"
@docker compose kill --remove-orphans
configure:
@echo "--> Launching Okta agent configuration script..."
@docker compose exec okta-opp /opt/OktaProvisioningAgent/configure_agent.sh
check-prereqs:
@echo ""
@echo "--> Checking prerequisites..."
@$(MAKE) check-docker
@if [ ! -f .env ]; then \
echo "\033[0;31m [x] ERROR: .env file not found!\033[0m"; \
echo "Please copy the sample environment file: cp .env-sample .env"; \
exit 1; \
else \
echo "\033[0;32m [✔] .env file exists\033[0m"; \
fi
@for var in MARIADB_DATABASE MARIADB_USER MARIADB_PASSWORD MARIADB_ROOT_PASSWORD; do \
eval value=\$$$$var; \
if [ -z "$$value" ]; then \
echo "\033[0;31m [x] ERROR: $$var is not set in .env file!\033[0m"; \
exit 1; \
fi; \
done
@echo "\033[0;32m [✔] All required environment variables are set\033[0m"
@echo "\033[0;32m[✔] All prerequisites check passed\033[0m"
@echo ""
check-build-prereqs:
@echo ""
@echo "--> Checking build prerequisites..."
@$(MAKE) check-docker
@if ! ls ./docker/okta-opp/packages/OktaProvisioningAgent-*.rpm 1>/dev/null 2>&1; then \
echo "\033[0;31m [x] ERROR: Okta Provisioning Agent RPM not found!\033[0m"; \
echo "Please place the OktaProvisioningAgent-*.rpm file in the './docker/okta-opp/packages/' directory."; \
exit 1; \
else \
echo "\033[0;32m [✔] Okta Provisioning Agent RPM found\033[0m"; \
fi
@if ! ls ./docker/okta-scim/packages/OktaOnPremScimServer-*.rpm 1>/dev/null 2>&1; then \
echo "\033[0;31m [x] ERROR: Okta SCIM Server RPM not found!\033[0m"; \
echo "Please place the OktaOnPremScimServer-*.rpm file in the './docker/okta-scim/packages/' directory."; \
exit 1; \
else \
echo "\033[0;32m [✔] Okta SCIM Server RPM found\033[0m"; \
fi
@if ! ls ./docker/okta-scim/packages/*.jar 1>/dev/null 2>&1; then \
echo "\033[0;33m [i] INFO: JDBC driver JAR files not found!\033[0m The MySQL JDBC driver will be downloaded automatically during build."; \
else \
echo "\033[0;32m [✔] JDBC driver JAR files found\033[0m"; \
fi
@if [ -z "$$(find ./docker/okta-opp/packages ./docker/okta-scim/packages -type f \( -name '*.pem' -o -name '*.crt' \) 2>/dev/null)" ]; then \
echo "\033[0;33m [i] INFO: No certificate files (.pem/.crt) found!\033[0m The containers may not work with custom VPN."; \
else \
echo "\033[0;32m [✔] Certificate files found\033[0m"; \
fi
@echo "\033[0;32m[✔] All prerequisites check passed\033[0m"
@echo ""
check-docker:
@if ! docker info > /dev/null 2>&1; then \
echo "\033[0;31m [x] ERROR: Docker is not running, not installed, not in PATH or you don't have permissions to access it!\033[0m"; \
exit 1; \
else \
echo "\033[0;32m [✔] Docker is running and accessible\033[0m"; \
fi
@if ! command -v docker-compose &> /dev/null; then \
echo "\033[0;31m [x] ERROR: Docker Compose is not installed or not in PATH!\033[0m"; \
exit 1; \
else \
echo "\033[0;32m [✔] Docker Compose is installed\033[0m"; \
fi