-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtudu-stack.json
More file actions
247 lines (247 loc) · 7.78 KB
/
tudu-stack.json
File metadata and controls
247 lines (247 loc) · 7.78 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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
{
"name": "Tudu Stack",
"ref": "tudu-stack",
"summary": "Run an over-engineered front-end and back-end todo service",
"description": "React front (React) and back (go) service for a to-do list",
"version": "1.0.0",
"variations": {
"default": {
"name": "Tudu Stack",
"ref": "tudu-stack",
"tools": [
{ "name": "go_air" },
{ "name": "go" },
{ "name": "nodejs" },
{ "name": "pnpm" }
],
"apps": [
{
"name": "Tudu Ts React Frontend",
"ref": "tudu-ts-react-frontend",
"repository_url": "https://github.com/joy-dx/tudu-ts-react-frontend",
"config": {
"build": [
{
"name": "install dependencies",
"action_ref": "core.os_exec",
"configuration": {
"command": [
"pnpm",
"i"
],
"working_dir": "{{ .SVar `.apps.tudu-ts-react-frontend.root` }}"
}
}
],
"dev": [
{
"name": "run frontend development",
"action_ref": "core.os_exec",
"configuration": {
"background": true,
"command": [
"pnpm",
"dev"
],
"working_dir": "{{ .SVar `.apps.tudu-ts-react-frontend.root` }}"
}
}
],
"health": [
{
"name": "Heartbeat",
"action_ref": "core.http_request",
"description": "Check index endpoint for returning `ok`",
"configuration": {
"url": "http://localhost:{{ .SVar `.apps.nodejs-hello-world.api_port` }}",
"method": "get"
},
"expect": [
{
"string": "ok"
},
{
"net_header": "200"
}
]
}
]
}
},
{
"name": "Tudu Go Gin Backend",
"ref": "tudu-go-gin-backend",
"repository_url": "https://github.com/joy-dx/tudu-go-gin-backend",
"config": {
"vars": {
"dsn": "file:{{ .SVar `.apps.tudu-go-gin-backend.root` }}/database.db?cache=shared&mode=rwc",
"bin_name": "tudu-backend"
},
"environment": [
"TUDU_DB_DSN={{ .SVar `.apps.tudu-go-gin-backend.dsn` }}"
],
"build": [
{
"name": "standard go build",
"action_ref": "core.os_exec",
"configuration": {
"command": [
"go",
"build",
"-o",
"{{ .SVar `.env.bin` }}/{{ .SVar `.apps.tudu-go-gin-backend.bin_name` }}",
"main.go"
],
"working_dir": "{{ .SVar `.apps.tudu-go-gin-backend.root` }}"
}
}
],
"dev": [
{
"name": "run migrations",
"action_ref": "core.os_exec",
"configuration": {
"command": [
"go",
"run",
"main.go",
"db",
"migrate"
],
"working_dir": "{{ .SVar `.apps.tudu-go-gin-backend.root` }}"
}
},
{
"name": "Setup test data",
"action_ref": "core.os_exec",
"configuration": {
"command": [
"go",
"run",
"main.go",
"db",
"fixtures"
],
"working_dir": "{{ .SVar `.apps.tudu-go-gin-backend.root` }}"
}
},
{
"name": "Go Live Reload",
"action_ref": "core.os_exec",
"description": "Use air to launch app in dev mode",
"configuration": {
"background": true,
"command": [
"air"
],
"working_dir": "{{ .SVar `.apps.tudu-go-gin-backend.root` }}"
}
}
],
"staging": [
{
"name": "Run Compiled app",
"action_ref": "core.os_exec",
"description": "Run the built artefact",
"configuration": {
"background": true,
"command": [
"{{ .SVar `.apps.tudu-go-gin-backend.bin_name` }}"
]
}
}
],
"health": [
{
"name": "Heartbeat",
"action_ref": "core.http_request",
"description": "Check index endpoint for returning `ok`",
"configuration": {
"url": "http://localhost:{{ .SVar `.apps.tudu-go-gin-backend.api_port` }}",
"method": "get"
},
"expect": [
{
"string": "ok"
},
{
"net_header": "200"
}
]
}
]
}
}
]
},
"with_sql": {
"name": "Run with MySQL",
"ref": "run-with-mysql",
"summary": "Run an instance of mysql:latest from container",
"containers": [
{
"ref": "db",
"image": "mysql:latest",
"ports": [
"{{ .SVar `.mysql.port` }}:3306"
],
"environment": [
"MYSQL_DATABASE={{ .SVar `.mysql.schema` }}",
"MYSQL_ROOT_PASSWORD={{ .SVar `.mysql.user_pass` }}",
"MYSQL_USER={{ .SVar `.mysql.user_name` }}",
"MYSQL_PASSWORD={{ .SVar `.mysql.user_pass` }}"
]
}
],
"vars": {
".mysql.address": "localhost",
".mysql.port": "3306",
".mysql.schema": "development",
".mysql.user_name": "development",
".mysql.user_pass": "development"
},
"apps": [
{
"ref": "tudu-go-gin-backend",
"vars": {
"dsn": "{{ .SVar `.mysql.user_name` }}:{{ .SVar `.mysql.user_pass` }}@tcp({{ .SVar `.mysql.address` }}:{{ .SVar `.mysql.port` }})/{{ .SVar `.mysql.schema` }}?parseTime=true&loc=Local"
}
}
]
},
"with_postgres": {
"name": "Run with PostgreSQL",
"ref": "run-with-postgresql",
"summary": "Run an instance of PostgreSQL from container",
"containers": [
{
"ref": "db",
"image": "postgres:16-alpine",
"ports": [
"{{ .SVar `.postgres.port` }}:5432"
],
"environment": [
"POSTGRES_USER: {{ .SVar `.postgres.user_name` }}",
"POSTGRES_PASSWORD: {{ .SVar `.postgres.user_pass` }}",
"POSTGRES_DB: {{ .SVar `.postgres.schema` }}"
]
}
],
"vars": {
".postgres.address": "localhost",
".postgres.port": "5432",
".postgres.schema": "development",
".postgres.user_name": "development",
".postgres.user_pass": "development"
},
"apps": [
{
"ref": "tudu-go-gin-backend",
"vars": {
"dsn": "postgres://{{ .SVar `.postgres.user_name` }}:{{ .SVar `.postgres.user_pass` }}@{{ .SVar `.postgres.address` }}:{{ .SVar `.postgres.port` }}/{{ .SVar `.postgres.schema` }}?sslmode=disable"
}
}
]
}
}
}