forked from Skatteetaten/terraform-nomad-trino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
83 lines (66 loc) · 2.79 KB
/
Makefile
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
include dev/.env
export
export PATH := $(shell pwd)/tmp:$(PATH)
# Presto cli version
PRESTO_VERSION = 340
presto := ./presto_${PRESTO_VERSION}
.ONESHELL .PHONY: up update-box destroy-box remove-tmp clean example
.DEFAULT_GOAL := up
#### Pre requisites ####
install:
mkdir -p tmp;(cd tmp; git clone --depth=1 https://github.com/fredrikhgrelland/vagrant-hashistack.git; cd vagrant-hashistack; make install); rm -rf tmp/vagrant-hashistack
linter:
docker run -e RUN_LOCAL=true -v "${PWD}:/tmp/lint/" github/super-linter
#### Development ####
# start commands
dev: update-box
SSL_CERT_FILE=${SSL_CERT_FILE} CURL_CA_BUNDLE=${CURL_CA_BUNDLE} ANSIBLE_ARGS='--skip-tags "test"' vagrant up --provision
custom_ca:
ifdef CUSTOM_CA
cp -f ${CUSTOM_CA} docker/conf/certificates/
endif
up: update-box custom_ca
ifdef CI # CI is set in Github Actions
SSL_CERT_FILE=${SSL_CERT_FILE} CURL_CA_BUNDLE=${CURL_CA_BUNDLE} vagrant up --provision
else
SSL_CERT_FILE=${SSL_CERT_FILE} CURL_CA_BUNDLE=${CURL_CA_BUNDLE} CUSTOM_CA=${CUSTOM_CA} ANSIBLE_ARGS='--extra-vars "local_test=true"' vagrant up --provision
endif
test: clean up
template-example: custom_ca
ifdef CI # CI is set in Github Actions
cd template_example; SSL_CERT_FILE=${SSL_CERT_FILE} CURL_CA_BUNDLE=${CURL_CA_BUNDLE} vagrant up --provision
else
if [ -f "docker/conf/certificates/*.crt" ]; then cp -f docker/conf/certificates/*.crt template_example/docker/conf/certificates; fi
cd template_example; SSL_CERT_FILE=${SSL_CERT_FILE} CURL_CA_BUNDLE=${CURL_CA_BUNDLE} CUSTOM_CA=${CUSTOM_CA} ANSIBLE_ARGS='--extra-vars "local_test=true"' vagrant up --provision
endif
# clean commands
destroy-box:
vagrant destroy -f
remove-tmp:
rm -rf ./tmp
clean: destroy-box remove-tmp
status:
vagrant global-status
# helper commands
update-box:
@SSL_CERT_FILE=${SSL_CERT_FILE} CURL_CA_BUNDLE=${CURL_CA_BUNDLE} vagrant box update || (echo '\n\nIf you get an SSL error you might be behind a transparent proxy. \nMore info https://github.com/fredrikhgrelland/vagrant-hashistack/blob/master/README.md#proxy\n\n' && exit 2)
# to-hivemetastore
proxy-h:
consul connect proxy -service hivemetastore-local -upstream hive-metastore:9083 -log-level debug
# to-minio
proxy-m:
consul connect proxy -service minio-local -upstream minio:9000 -log-level debug
# to-postgres
proxy-pg:
consul connect proxy -service postgres-local -upstream postgres:5432 -log-level debug
# to-presto
proxy-presto:
consul connect proxy -service presto-local -upstream presto:8080 -log-level debug
download-presto-cli:
curl https://repo1.maven.org/maven2/io/prestosql/presto-cli/${PRESTO_VERSION}/presto-cli-${PRESTO_VERSION}-executable.jar -o ./${presto}
chmod +x ./${presto}
presto-cli:
ifeq (,$(wildcard ./${presto}))
$(MAKE) download-presto-cli
endif
${presto} --server localhost:8080 --catalog hive --schema default --user presto