-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
225 lines (155 loc) · 5.4 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#who
.DEFAULT_GOAL:=help
SHELL:=/bin/bash
GO111MODULE=off
# https://github.com/xo/usql
USQL_LIB_NAME=usql
USQL_LIB=github.com/xo/$(USQL_LIB_NAME)
USQL_LIB_FSPATH=$(GOPATH)/src/$(USQL_LIB)
# https://github.com/wal-g/wal-g
WAL_LIB_NAME=wal-g
WAL_LIB_BRANCH=master
WAL_LIB_TAG=v1.0.0
WAL_LIB=github.com/wal-g/$(WAL_LIB_NAME)
WAL_LIB_UPSTREAM=github.com/wal-g/$(WAL_LIB_NAME)
WAL_LIB_FSPATH=$(GOPATH)/src/$(WAL_LIB)
# https://github.com/moiot/gravity
GRA_LIB_NAME=gravity
GRA_LIB_BRANCH=master
GRA_LIB_TAG=v1.0.0
GRA_LIB=github.com/moiot/$(GRA_LIB_NAME)
GRA_LIB_UPSTREAM=github.com/moiot/$(GRA_LIB_NAME)
GRA_LIB_FSPATH=$(GOPATH)/src/$(GRA_LIB)
help: ## Display this help
# from: https://suva.sh/posts/well-documented-makefiles/
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
print: ### print
@echo
@echo USQL_LIB_NAME : $(USQL_LIB_NAME)
@echo USQL_LIB_BRANCH : $(USQL_LIB_BRANCH)
@echo USQL_LIB_TAG : $(USQL_LIB_TAG)
@echo USQL_LIB : $(USQL_LIB)
@echo USQL_LIB_FSPATH : $(USQL_LIB_FSPATH)
@echo
@echo
@echo WAL_LIB_NAME : $(WAL_LIB_NAME)
@echo WAL_LIB_BRANCH : $(WAL_LIB_BRANCH)
@echo WAL_LIB_TAG : $(WAL_LIB_TAG)
@echo WAL_LIB : $(WAL_LIB)
@echo WAL_LIB_FSPATH : $(WAL_LIB_FSPATH)
@echo
@echo
@echo GRA_LIB_NAME : $(GRA_LIB_NAME)
@echo GRA_LIB_BRANCH : $(GRA_LIB_BRANCH)
@echo GRA_LIB_TAG : $(GRA_LIB_TAG)
@echo GRA_LIB : $(GRA_LIB)
@echo GRA_LIB_FSPATH : $(GRA_LIB_FSPATH)
@echo
@echo
git-clone: ### git-clone
# usql
mkdir -p $(USQL_LIB_FSPATH)
cd $(USQL_LIB_FSPATH) && cd .. && rm -rf $(USQL_LIB_NAME) && git clone ssh://git@$(USQL_LIB).git
cd $(USQL_LIB_FSPATH) && git fetch --all --tags --prune
#cd $(USQL_LIB_FSPATH) && git checkout tags/$(USQL_LIB_TAG)
# walg
mkdir -p $(WAL_LIB_FSPATH)
cd $(WAL_LIB_FSPATH) && cd .. && rm -rf $(WAL_LIB_NAME) && git clone ssh://git@$(WAL_LIB).git
cd $(WAL_LIB_FSPATH) && git fetch --all --tags --prune
#cd $(WAL_LIB_FSPATH) && git checkout tags/$(WAL_LIB_TAG)
# gravity
mkdir -p $(GRA_LIB_FSPATH)
cd $(GRA_LIB_FSPATH) && cd .. && rm -rf $(GRA_LIB_NAME) && git clone ssh://git@$(GRA_LIB).git
cd $(GRA_LIB_FSPATH) && git fetch --all --tags --prune
#cd $(GRA_LIB_FSPATH) && git checkout tags/$(GRA_LIB_TAG)
git-clean: ### git-clean
rm -rf $(WAL_LIB_FSPATH)
rm -rf $(GRA_LIB_FSPATH)
dep-os: ### dep-os
# THis installed the databases we need quickyly. Dont want to sue Docker because want to support Desktops too.
# Mac for now because life is too short. Will get multi OS later.
# All of these have equivalents in Scoop, so easy to do later.
# E.G: https://github.com/xo/usql#installing-via-scoop-windows
# postgresql
brew install postgresql
brew services start postgresql
brew services stop postgresql
# mysql
brew install mysql
brew install mysql-client
brew services start mysql
brew services stop mysql
# oracle
# Must be manually downloaded first. Freaking Oracle !!
# https://vanwollingen.nl/install-oracle-instant-client-and-sqlplus-using-homebrew-a233ce224bf
# This includes the Data Pump tools needed for CDC :)
brew tap InstantClientTap/instantclient
brew install instantclient-basic
brew install instantclient-sqlplus
dep-os-list: ### deo-os-list
# whats running ? works great
brew services list
dep-modules:
# https://github.com/elves
# Looks like its made to do Pipelines from the Terminal in a Cross platform way.
# Miht be a nice match for Benthos.
#go get github.com/elves/elvish
code-open: ### code-open
code code.code-workspace
### Gateway
gate-dep: ### gate-dep
# see https://ngrok.com/download
mkdir -p $(PWD)/temp
curl -o $(PWD)/temp/ngrok.zip https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.zip
unzip $(PWD)/temp/ngrok.zip -d $(PWD)/bin
gate-open: ### gate-open
# login using gedw99 google accont
open https://dashboard.ngrok.com/status
gate-run: ### gate-run
# get laptops ip.
ifconfig | grep "inet " | grep -v 127.0.0.1
$(PWD)/bin/ngrok authtoken ???
#$(PWD)/bin/ngrok http 8000
$(PWD)/bin/ngrok http -subdomain=gedw99 $(GATE_PORT)
### USQL
usql-build: ### usql-build:
cd $(USQL_LIB_FSPATH) && GO111MODULE=on go build .
cp $(GOPATH)/src/github.com/xo/usql/usql $(GOPATH)/bin
usql-run: ### usql-run
# connect to mysql
usql mysql://user:pass@host:port/dbname
### GRA
GRA_BIN=gra
gra-build: ### gra-build
# uses gomodules for dep
cd $(GRA_LIB_FSPATH) && GO111MODULE=on make build
mkdir -p $(PWD)/bin
cp $(GRA_LIB_FSPATH)/bin/$(GRA_LIB_NAME) $(PWD)/bin/$(GRA_BIN)
# copy config
cp $(PWD)/mysql2mysql.toml $(PWD)/bin/mysql2mysql.toml
gra-run: ### gra-run
# start mysql server
brew services start mysql
$(PWD)/bin/$(GRA_BIN) -config mysql2mysql.toml
### WAL
WAL_BIN=wal
WAL_BIN_POST=$(WAL_BIN)-post
WAL_BIN_MYSQ=$(WAL_BIN)-mysq
wal-dep:
# grabs dep
cd $(WAL_LIB_FSPATH) && make install
# gets all deps.
cd $(WAL_LIB_FSPATH) && make deps
wal-build: wal-dep ### wal-build
# uses dep for deps.
# pg
cd $(WAL_LIB_FSPATH) && GOBIN=$(GOPATH)/bin make pg_install
mkdir -p $(PWD)/bin
cp $(GOPATH)/bin/wal-g $(PWD)/bin/$(WAL_BIN_POST)
# mysql
cd $(WAL_LIB_FSPATH) && GOBIN=$(GOPATH)/bin make mysql_install
mkdir -p $(PWD)/bin
cp $(GOPATH)/bin/wal-g $(PWD)/bin/$(WAL_BIN_MYSQ)
wal-run: ### wal-run
# postresql is easy...
$(PWD)/bin/$(WAL_BIN_POST)-pg -h