-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile.docker
111 lines (94 loc) · 3.64 KB
/
Makefile.docker
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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
ENVIRONMENT_CONFIG_JSON = $(shell scripts/get-config.sh --docker -o json | jq -c)
DOCKER_BUILD_ARCH_FLAGS = --arch $$(dpkg --print-architecture)
DOCKER_BUILD_PUSH_FLAGS =
login-wip-acr:
# do nothing. We don't push any images local docker mode.
set-localsettings: ensure-data-plane-cert
install_path=$$(realpath "install/local")
run_secrets_path="$${install_path}/control-plane/run-secrets"
ephemeral_buffers_path="$${install_path}//ephemeral"
logs_path="/docker-volumes/run-logs"
host_path_translations=$$(echo "$$TYGER_DOCKER_HOST_PATH_TRANSLATIONS" | tr ':' '\n' \
| awk -F= '{ \
s=$$1; d=$$2; \
if (substr(s, length(s), 1) != "/") s = s"/"; \
if (substr(d, length(d), 1) != "/") d = d"/"; \
printf "\"%s\":\"%s\",", s, d \
}' \
| sed 's/,$$//'); \
jq <<- EOF > ${CONTROL_PLANE_SERVER_PATH}/appsettings.local.json
{
"urls": "http://unix:$${install_path}/control-plane/tyger.sock",
"logging": { "Console": {"FormatterName": "simple" } },
"auth": {
"enabled": "false"
},
"compute": {
"docker": {
"runSecretsPath": "$${run_secrets_path}",
"ephemeralBuffersPath": "$${ephemeral_buffers_path}",
"networkName": "tyger-local-network",
"hostPathTranslations": {$$host_path_translations}
}
},
"logArchive": {
"localStorage": {
"logsDirectory": "$${logs_path}"
}
},
"buffers": {
"primarySigningPrivateKeyPath": "$$(echo '${ENVIRONMENT_CONFIG_JSON}' | jq -r '.signingKeys.primary.private')",
"bufferSidecarImage": "$$(echo '${ENVIRONMENT_CONFIG_JSON}' | jq -r '.bufferSidecarImage')",
"localStorage": {
"dataPlaneEndpoint": "http+unix://$${install_path}/data-plane/tyger.data.sock",
"tcpDataPlaneEndpoint": "http://localhost:$$(echo '${ENVIRONMENT_CONFIG_JSON}' | jq -r '.dataPlanePort')"
}
},
"database": {
"host": "$${install_path}/database",
"username": "tyger-server",
"databaseName": "tyger-server",
"autoMigrate": "true",
"tygerServerRoleName": "tyger-server"
}
}
EOF
set-data-plane-localsettings:
install_path=$$(realpath "install/local")
jq <<- EOF > ${DATA_PLANE_SERVER_PATH}/appsettings.local.json
{
"urls": "http://unix:$${install_path}/data-plane/tyger.data.sock",
"logging": { "Console": {"FormatterName": "simple" } },
"dataDirectory": "/docker-volumes/buffers",
"PrimarySigningPublicKeyPath": "$$(echo '${ENVIRONMENT_CONFIG_JSON}' | jq -r '.signingKeys.primary.public')"
}
EOF
up: ensure-data-plane-cert install-cli docker-build-tyger-server docker-build-buffer-sidecar docker-build-test
tyger api install -f <(scripts/get-config.sh --docker)
down: install-cli
tyger api uninstall -f <(scripts/get-config.sh --docker)
ensure-data-plane-cert: install-cli
primaryKeys=$$(echo '${ENVIRONMENT_CONFIG_JSON}' | jq -r '.signingKeys.primary')
cert_path_public=$$(echo $${primaryKeys} | jq -r '.public')
cert_path_private=$$(echo $${primaryKeys} | jq -r '.private')
if [[ ! -f "$${cert_path_public}" ]]; then
tyger api generate-signing-key --public $${cert_path_public} --private $${cert_path_private}
fi
run-data-plane: set-data-plane-localsettings
cd server/DataPlane
dotnet run -v m --no-restore
login:
tyger login unix://install/local/api.sock
connect-db:
docker exec -it tyger-local-db psql -U tyger-server tyger-server
variant-test:
scripts/run-ssh-tests.sh
TYGER_CACHE_FILE=$(mktemp)
export TYGER_CACHE_FILE
tyger login docker://
tyger login status
$(MAKE) integration-test-no-up
get-last-server-exception:
docker logs tyger-local-control-plane 2>&1 | grep Exception || true | tac | head -n 1 | jq -r '.exception'