-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdetect-dev-env-problems
executable file
·84 lines (65 loc) · 2.38 KB
/
detect-dev-env-problems
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
#!/bin/bash
set -euo pipefail
source "$(dirname "$0")/.common"
enforce_inotify_watches_limit_sufficient
ensure_program_in_path docker
if groups | grep -q '\bdocker\b'; then
echo "Current user is in the docker group."
else
echo 'Error: you are not in the docker group. Please follow the instructions from https://docs.docker.com/engine/install/linux-postinstall/'
exit 255
fi
echo "Testing if docker works"
if [ "$(docker context inspect | grep '"Name"' | grep -c "desktop-linux")" -eq "1" ]; then
echo -e "$RED"
echo "Warning: You are using the docker desktop docker context. Other developers have reported problems with this setup."
echo "If you encounter problems with running docker try the following:"
echo "1. Install the normal docker engine (https://docs.docker.com/engine/install/) instead of docker desktop"
echo "2. Run command: docker context use default"
echo -e "$RESET_EVERYTHING"
fi
DOCKER_OUTPUT=$(docker run hello-world | grep 'Hello from Docker!')
echo "$DOCKER_OUTPUT"
echo ""
echo "Checking if langs exists"
BASEDIR="$(dirname "${BASH_SOURCE[0]}")"
FOLDER_PATH="$BASEDIR/../services/tmc/"
if [ -n "$(find "$FOLDER_PATH" -maxdepth 1 -type f -name "tmc-langs-cli-*")" ]; then
echo "Found langs"
else
echo "Langs not found, please run bin/download-tmc-langs"
exit 255
fi
echo ""
DOMAIN="project-331.local"
ensure_program_in_path minikube
ensure_program_in_path getent
if [ "$(minikube status --format '{{.APIServer}}')" = "Running" ]; then
echo "Minikube is running."
run_command minikube status
else
echo "Minikube is not running. Please start it with bin/minikube-start and run this again."
exit 255
fi
echo ""
if ! getent hosts "$DOMAIN" > /dev/null; then
echo "Error: cannot resolve an ip for $DOMAIN. Please update your /etc/hosts according to the documentation."
exit 255
fi
PROJECT_DOMAIN_IP=$(getent hosts "$DOMAIN" | awk '{ print $1 }')
echo "Resolved ip for $DOMAIN: $PROJECT_DOMAIN_IP"
MINIKUBE_IP=$(minikube ip)
echo "Minikube ip: $MINIKUBE_IP"
if [ "$PROJECT_DOMAIN_IP" = "$MINIKUBE_IP" ]; then
echo "The ips match."
echo ""
else
echo "The ips don't match. Please update your /etc/hosts"
exit 255
fi
echo "Checking if the ingress works"
run_command kubectl get pods --namespace ingress-nginx
echo ""
run_command kubectl wait --namespace ingress-nginx --for=condition=available deployment/ingress-nginx-controller
echo ""
echo "Checks done."