-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
708 lines (634 loc) · 23.3 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
.EXPORT_ALL_VARIABLES:
## Build all containers and run tests with dev settings
dev:
echo "DOCKER_HOST: " $(DOCKER_HOST) "TARGET: " $(TARGET)
sysctl vm.max_map_count | grep 262144 # sudo sysctl -w vm.max_map_count=262144
make chmod-x
make run
make upload-docs
make upload-static
make wait-for-postgres
make wait-for-elk
make test
make sbe-smoke
make success-local
## Build all containers and run tests with production settings
all-prod:
echo "DOCKER_HOST: " $(DOCKER_HOST) "TARGET: " $(TARGET)
sysctl vm.max_map_count | grep 262144 # sudo sysctl -w vm.max_map_count=262144
make chmod-x
make run-prod
make upload-docs
make upload-static
make wait-for-postgres
make wait-for-elk
make test
make sbe-smoke
make success-local
## Build and run containters on the remote docker machine
remote:
cp ./remote.docker.env ./cicd/cicd.docker.env
cat ./remote.docker.env >> ./{{ project_name }}-web/env
make cicd-local-remote
## Set local docker-machine, creates Buildbot containers
dev-docker-machine:
make cicd-set-local-docker-machine
make cicd-local
cicd-local:
echo "DOCKER_HOST: " $(DOCKER_HOST) "TARGET: " $(TARGET)
make chmod-x
make run-cicd
make cicd-wait-for-master
make cicd-initial-commit
make success-cicd
cicd-local-remote:
echo "DOCKER_HOST: " $(DOCKER_HOST) "TARGET: " $(TARGET)
make chmod-x
make run-cicd-remote
make cicd-wait-for-master
make cicd-initial-commit
make success-cicd
# Set scripts as executable
chmod-x:
chmod +x ./logs/wait_for_elk.sh
chmod +x ./cicd/master/wait_for_master.sh
chmod +x ./cicd/hooks/post-commit
## Initialize git repo and do initial commit to fire full rebuild in Buildbot via git hook
cicd-initial-commit:
git init
git config --local user.email "[email protected]"
git config --local user.name "Awesome Django"
ln -s -f ../../cicd/hooks/post-commit .git/hooks/post-commit
git add .
git commit -q -m "Initial commit."
@echo ""
@echo "Full rebuild has just started. You my verify progress at \033[1;33mhttp://localhost:8010/#/builders\033[0m."
## Set up local docker-machine if one does not exists
cicd-set-local-docker-machine:
bash cicd/set_local_docker_machine.sh
bash cicd/pull_base_docker_images.sh
bash cicd/copy_docker_images_to_machine.sh
## Wait until Buildbot master container is up and running
cicd-wait-for-master:
docker exec -t {{ project_name }}-cicd-master bash -c "./wait_for_master.sh"
#building docker images for each service
## Build DB containers
build-db:
docker-compose build db
build-data:
docker-compose build data
## Build WEB application containers
build-web:
docker-compose build web
## Build containers for docs generation
build-docs:
docker-compose build docs
## Build Nginx container
build-https:
docker-compose build https
## Build container for SBE tests
build-testing:
docker-compose build testing
## Build containers for ELK
build-logs:
docker-compose build logs
## Build containers for docker console
build-docker-console:
docker-compose build docker-console
## Build containers for monitoring agent
build-monitoring-agent:
docker-compose build monitoring-agent
## Build containers for monitoring server
build-monitoring-server:
docker-compose build monitoring-server
## Build containers for performance testing
build-perf:
docker-compose build perf
## Build all applications' containers (without Buildbot)
build: build-data build-db build-https build-web build-docs build-testing build-docker-console build-monitoring build-perf
#run docker images
## Run DB containers
run-db:
docker-compose up -d data db
## Run WEB applicaton's containers
run-web:
docker-compose up -d web
## Run Nginx container
run-https:
docker-compose up -d https
## Run container for SBE testing
run-testing:
docker-compose up -d testing
## Run container for ELK
run-logs:
docker-compose up -d logs
## Run container for docker-console
run-docker-console:
docker-compose up -d docker-console
## Run container for monitoring agent
run-monitoring-agent:
docker-compose up -d monitoring-agent
## Run container for monitoring server
run-monitoring-server:
docker-compose up -d monitoring-server
## Run container for performance testing
run-perf:
docker-compose up -d perf
## Run all applications' containers (without Buildbot)
run:
echo "DOCKER_HOST: " $(DOCKER_HOST) "TARGET: " $(TARGET)
docker-compose up -d
## Run docker-machine and Buildbot containers
run-cicd:
echo "DOCKER_HOST: " $(DOCKER_HOST) "TARGET: " $(TARGET)
-docker-machine start {{ project_name }}-cicd
docker-compose -f docker-compose.cicd.yml up -d
run-cicd-remote:
echo "DOCKER_HOST: " $(DOCKER_HOST) "TARGET: " $(TARGET)
docker-compose -f docker-compose.cicd.yml up -d
## Run all applications' containers with production dockr-compose file
run-prod:
echo "DOCKER_HOST: " $(DOCKER_HOST) "TARGET: " $(TARGET)
@echo "Start of make run-prod"
@date +%T.%N
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
@date +%T.%N
@echo "End of make run-prod"
## Rebuild and run web
rerun-web:
make build-web run-perf
## Rebuild and run performance testing
rerun-perf:
make build-perf run-perf
#containers and images ids
CONTS-DB=$(shell docker ps -a -q -f "name={{ project_name }}-db")
IMGS-DB=$(shell docker images -q -f "label=application={{ project_name }}-db")
CONTS-DATA=$(shell docker ps -a -q -f "name={{ project_name }}-data")
IMGS-DATA=$(shell docker images -q -f "label=application={{ project_name }}-data")
CONTS-WEB=$(shell docker ps -a -q -f "name={{ project_name }}-web")
IMGS-WEB=$(shell docker images -q -f "label=application={{ project_name }}-web")
CONTS-HTTPS=$(shell docker ps -a -q -f "name={{ project_name }}-https")
IMGS-HTTPS=$(shell docker images -q -f "label=application={{ project_name }}-https")
CONTS-TESTING=$(shell docker ps -a -q -f "name={{ project_name }}-testing")
IMGS-TESTING=$(shell docker images -q -f "label=application={{ project_name }}-testing")
CONTS-LOGS=$(shell docker ps -a -q -f "name={{ project_name }}-logs")
IMGS-LOGS=$(shell docker images -q -f "label=application={{ project_name }}-logs")
CONTS-LOGSPOUT=$(shell docker ps -a -q -f "name={{ project_name }}-logspout")
IMGS-LOGSPOUT=$(shell docker images -q -f "label=application={{ project_name }}-logspout")
CONTS-DOCS=$(shell docker ps -a -q -f "name={{ project_name }}-docs")
IMGS-DOCS=$(shell docker images -q -f "label=application={{ project_name }}-docs")
CONTS-DOCKER-CONSOLE=$(shell docker ps -a -q -f "name={{ project_name }}-docker-console")
IMGS-DOCKER-CONSOLE=$(shell docker images -q -f "label=application={{ project_name }}-docker-console")
CONTS-MONITORING-AGENT=$(shell docker ps -a -q -f "name={{ project_name }}-monitoring-agent")
IMGS-MONITORING-AGENT=$(shell docker images -q -f "label=application={{ project_name }}-monitoring-agent")
CONTS-MONITORING-SERVER=$(shell docker ps -a -q -f "name={{ project_name }}-monitoring-server")
IMGS-MONITORING-SERVER=$(shell docker images -q -f "label=application={{ project_name }}-monitoring-server")
CONTS-PERF=$(shell docker ps -a -q -f "name={{ project_name }}-perf")
IMGS-PERF=$(shell docker images -q -f "label=application={{ project_name }}-perf")
CONTS-CICD=$(shell docker ps -a -q -f "name={{ project_name }}-cicd")
IMGS-CICD-MASTER=$(shell docker images -q -f "label=application={{ project_name }}-cicd-master")
IMGS-CICD-WORKER=$(shell docker images -q -f "label=application={{ project_name }}-cicd-worker")
IMGS-CICD-DB=$(shell docker images -q -f "label=application={{ project_name }}-cicd-db")
#stop docker containers
## Stop DB containers
stop-db:
@echo $(CONTS-DB) | xargs -r docker stop
stop-data:
@echo $(CONTS-DATA) | xargs -r docker stop
## Stop WEB application's containers
stop-web:
@echo $(CONTS-WEB) | xargs -r docker stop --time=1
## Stop Nginx container
stop-https:
@echo $(CONTS-HTTPS) | xargs -r docker stop
## Stop container for SBE testing
stop-testing:
@echo $(CONTS-TESTING) | xargs -r docker stop
## Stop ELK conteiners
stop-logs:
@echo $(CONTS-LOGS) | xargs -r docker stop
stop-logspout:
@echo $(CONTS-LOGSPOUT) | xargs -r docker stop
## Stop docker console
stop-docker-console:
@echo $(CONTS-DOCKER-CONSOLE) | xargs -r docker stop
## Stop monitoring server
stop-monitoring-server:
@echo $(CONTS-MONITORING-SERVER) | xargs -r docker stop
## Stop monitoring agent
stop-monitoring-agent:
@echo $(CONTS-MONITORING-AGENT) | xargs -r docker stop
## Stop performance testing
stop-perf:
@echo $(CONTS-PERF) | xargs -r docker stop
## Stop Buildbot containers
stop-cicd:
@echo $(CONTS-CICD) | xargs -r docker stop
#kill docker containers
## kill DB containers
kill-db:
@echo $(CONTS-DB) | xargs -r docker stop --time=1
kill-data:
@echo $(CONTS-DATA) | xargs -r docker stop --time=1
## kill WEB application's containers
kill-web:
@echo $(CONTS-WEB) | xargs -r docker stop --time=1
## kill Nginx container
kill-https:
@echo $(CONTS-HTTPS) | xargs -r docker stop --time=1
## kill container for SBE testing
kill-testing:
@echo $(CONTS-TESTING) | xargs -r docker stop --time=1
## kill ELK conteiners
kill-logs:
@echo $(CONTS-LOGS) | xargs -r docker stop --time=1
kill-logspout:
@echo $(CONTS-LOGSPOUT) | xargs -r docker stop --time=1
## kill docker console
kill-docker-console:
@echo $(CONTS-DOCKER-CONSOLE) | xargs -r docker stop --time=1
## kill monitoring server
kill-monitoring-server:
@echo $(CONTS-MONITORING-SERVER) | xargs -r docker stop --time=1
## kill monitoring agent
kill-monitoring-agent:
@echo $(CONTS-MONITORING-AGENT) | xargs -r docker stop --time=1
## kill performance testing
kill-perf:
@echo $(CONTS-PERF) | xargs -r docker stop --time=1
## kill Buildbot containers
kill-cicd:
@echo $(CONTS-CICD) | xargs -r docker stop --time=1
## Stop all applications' containers (without Buildbot)
stop:
echo "DOCKER_HOST: " $(DOCKER_HOST) "TARGET: " $(TARGET)
docker-compose stop
#start docker containers
## Start DB containers
start-db:
docker start {{ project_name }}-data
docker start {{ project_name }}-db
## Start WEB application's container
start-web:
docker start {{ project_name }}-web
## Start Nginx container
start-https:
docker start {{ project_name }}-https
## Start container for SBE testing
start-testing:
docker start {{ project_name }}-testing
## Start ELK containers
start-logs:
docker start {{ project_name }}-logs
## Start docker console container
start-docker-console:
docker start {{ project_name }}-docker-console
## Start monitoring containers
start-monitoring:
docker start {{ project_name }}-monitoring-agent
docker start {{ project_name }}-monitoring-server
## Start performance testing containe
start-perf:
docker start {{ project_name }}-perf
## Start all applications' containers (without Buildbot)
start:
docker-compose start
## Start all applications' containers with docker-compose production file
start-prod:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml start
#remove docker containers
## Remove containers with data for DB
rm-data:
@echo $(CONTS-DATA) | xargs -r docker rm
## Remove container with DB
rm-db:
@echo $(CONTS-DB) | xargs -r docker rm
## Remove containers for WEB applications
rm-web:
@echo $(CONTS-WEB) | xargs -r docker rm
## Remove containers for docs generation
rm-docs:
@echo $(CONTS-DOCS) | xargs -r docker rm
## Remove container for Nginx
rm-https:
@echo $(CONTS-HTTPS) | xargs -r docker rm
## Remove container for SBE testing
rm-testing:
@echo $(CONTS-TESTING) | xargs -r docker rm
## Remove containers for ELK
rm-logs:
@echo $(CONTS-LOGS) | xargs -r docker rm
rm-logspout:
@echo $(CONTS-LOGSPOUT) | xargs -r docker rm
## Remove containers for docker-console
rm-docker-console:
@echo $(CONTS-DOCKER-CONSOLE) | xargs -r docker rm
## Remove containers for monitoring-agent
rm-monitoring-agent:
@echo $(CONTS-MONITORING-AGENT) | xargs -r docker rm
## Remove containers for monitoring-server
rm-monitoring-server:
@echo $(CONTS-MONITORING-SERVER) | xargs -r docker rm
## Remove containers for performance testing
rm-perf:
@echo $(CONTS-PERF) | xargs -r docker rm
## Remove containers for Buildbot
rm-cicd:
@echo $(CONTS-CICD) | xargs -r docker rm
## Remove Buildbot database container
rm-cicd-db:
@echo $(CONTS-CICD-DB) | xargs -r docker rm
## Remove all containers (with Buildbot)
rm: rm-db rm-web rm-docs rm-https rm-logspout rm-logs rm-docker-console rm-monitoring-agent rm-monitoring-server rm-perf rm-cicd
#remove docker images
## Remove docker images with data for DB
rmi-data:
@echo $(IMGS-DATA) | xargs -r docker rmi -f
## Remove DB containers
rmi-db:
@echo $(IMGS-DB) | xargs -r docker rmi -f
## Remove WEB app docker images
rmi-web:
@echo $(IMGS-WEB) | xargs -r docker rmi -f
## Remove docker images for docs generation
rmi-docs:
@echo $(IMGS-DOCS) | xargs -r docker rmi -f
## Remove docker images for Nginx
rmi-https:
@echo $(IMGS-HTTPS) | xargs -r docker rmi -f
## Remove docker images for SBE testing
rmi-testing:
@echo $(IMGS-TESTING) | xargs -r docker rmi -f
## Remove docker images for ELK
rmi-logs:
@echo $(IMGS-LOGS) | xargs -r docker rmi -f
rmi-logspout:
@echo $(IMGS-LOGSPOUT) | xargs -r docker rmi -f
## Remove docker images for docker console
rmi-docker-console:
@echo $(IMGS-DOCKER-CONSOLE) | xargs -r docker rmi -f
## Remove docker images for monitoring-agent
rmi-monitoring-agent:
@echo $(IMGS-MONITORING-AGENT) | xargs -r docker rmi -f
## Remove docker images for monitoring-server
rmi-monitoring-server:
@echo $(IMGS-MONITORING-SERVER) | xargs -r docker rmi -f
## Remove docker images for performance testing
rmi-perf:
@echo $(IMGS-PERF) | xargs -r docker rmi -f
## Remove docker images for Buildbot apps and DB
rmi-cicd:
@echo $(IMGS-CICD-MASTER) | xargs -r docker rmi -f
@echo $(IMGS-CICD-WORKER) | xargs -r docker rmi -f
@echo $(IMGS-CICD-DB) | xargs -r docker rmi -f
## Remove docker images for Buildbot DB
rmi-cicd-db:
@echo $(IMGS-CICD-DB) | xargs -r docker rmi -f
## Remove all docker images, icluding Buildbot
rmi: rmi-db rmi-web rmi-https rmi-logspout rmi-logs rmi-docker-console rmi-monitoring-agent rmi-monitoring-server rmi-perf rmi-cicd
## Remove compiled *.pyc files from the {{ project_name }}-web
clean-pyc:
docker exec -t {{ project_name }}-web rm -rf {{ project_name }}/__pycache__
# kill containters, rmove containers, remove images
## Remove containers and docker images for DB
clean-db: kill-db rm-db rmi-db
## Remove containers and docker images for WEB application
clean-web: kill-web rm-web rmi-web
## Remove containers and docker images for Nginx
clean-https: kill-https rm-https rmi-https
## Remove containers and docker images for SBE testing
clean-testing: kill-testing rm-testing rmi-testing
## Remove containers and docker images for docs generation
clean-docs: rm-docs rmi-docs
clean-data: kill-data rm-data rmi-data
## Remove containers and docker images for ELK
clean-logs: kill-logs rm-logs rmi-logs
clean-logspout: kill-logspout rm-logspout rmi-logspout
## Remove containers and docker images for docker console
clean-docker-console: kill-docker-console rm-docker-console rmi-docker-console
## Remove containers and docker images for monitoring agent
clean-monitoring-agent: kill-monitoring-agent rm-monitoring-agent rmi-monitoring-agent
## Remove containers and docker images for monitoring-server
clean-monitoring-server: kill-monitoring-server rm-monitoring-server rmi-monitoring-server
## Remove containers and docker images for performance testing
clean-perf: kill-perf rm-perf rmi-perf
## Remove containers and docker images for Buildbot
clean-cicd: kill-cicd rm-cicd rmi-cicd
clean-compose:
docker-compose rm -f
## Remove ophaned docker volumes
clean-orphaned-volumes:
@docker volume ls -qf dangling=true | xargs -r docker volume rm
## Remove images with <None> repository
clean-none-images:
@docker images --filter "dangling=true" -q --no-trunc | xargs -r docker rmi
@docker images | awk '$$1~/<none>/ {print $$3}' | xargs -r docker rmi
## Remove containers and docker images for WEB application and SBE testing
clean-apps: clean-web clean-testing clean-docs clean-data #clean-compose - not work well in dmt-testing without virtenv context
## Remove containers and docker images for ELK, DB and Nginx
clean-non-apps: clean-logspout clean-logs clean-logspout clean-db clean-https clean-docker-console clean-monitoring-agent clean-monitoring-server clean-perf
## Remove all containers and docker images not including Buildbot
clean-all: clean-apps clean-non-apps clean-data clean-docs clean-orphaned-volumes clean-none-images
## Remove and recreate containers and docker images for Buildbot DB
reload-cicd-db:
make stop-cicd
make rm-cicd-db
make rmi-cicd-db
docker-compose -f docker-compose.cicd.yml up -d
make cicd-wait-for-master
## Remove and recreate containers and docker iages for Nginx
reload-https:
make clean-https
make build-https
make run-https
# open shell in container
## Open shell in container with WEB application
shell-web:
docker exec -it {{ project_name }}-web bash
## Open shell in container with DB
shell-db:
docker exec -it {{ project_name }}-db bash
## Open shell in container with SBE testing
shell-testing:
docker exec -it {{ project_name }}-testing bash
## Open shell in container with ELK
shell-logs:
docker exec -it {{ project_name }}-logs bash
## Open shell in container with Nginx
shell-https:
docker exec -it {{ project_name }}-https bash
## Open shell in container with performance testing
shell-perf:
docker exec -it {{ project_name }}-perf bash
## Open shell in container with Buildbot master
shell-cicd-master:
docker exec -it {{ project_name }}-cicd-master bash
## Open shell in container with Buildbot worker
shell-cicd-worker:
docker exec -it {{ project_name }}-cicd-worker bash
## View logs for WEB application
logs-web:
docker logs -f {{ project_name }}-web
## View logs for DB
logs-db:
docker logs -f {{ project_name }}-db
## View logs for Nginx
logs-https:
docker logs -f {{ project_name }}-https
## View logs for SBE testing
logs-testing:
docker logs -f {{ project_name }}-testing
## View logs for ELK
logs-logs:
docker logs -f {{ project_name }}-logs
## View logs for docs generation
logs-docs:
docker logs -f {{ project_name }}-docs
## View logs for Buildbot master
logs-cicd-master:
docker logs -f {{ project_name }}-cicd-master
## View logs for Buildbot worker
logs-cicd-worker:
docker logs -f {{ project_name }}-cicd-worker
## View logs for Buildbot DB
logs-cicd-db:
docker logs -f {{ project_name }}-cicd-db
## View logs for docker console
logs-docker-console:
docker logs -f {{ project_name }}-docker-console
## View logs for monitoring-agent
logs-monitoring-agent:
docker logs -f {{ project_name }}-monitoring-agent
## View logs for monitoring-server
logs-monitoring-server:
docker logs -f {{ project_name }}-monitoring-server
## View logs for performance testing
logs-perf:
docker logs -f {{ project_name }}-perf
## Wait untill postgresql is ready
wait-for-postgres:
docker exec -t {{ project_name }}-web python wait_for_postgres.py
## Wait untill ELK is ready (max 30s)
wait-for-elk:
docker exec -t {{ project_name }}-logs bash -c "./wait_for_elk.sh"
# Wait utill Buildbot master is ready
wait-for-cicd-master:
docker exec -t {{ project_name }}-cicd-master bash -c "./wait_for_master.sh"
## Run SBE tests
sbe:
docker exec -t {{ project_name }}-testing behave --tags=smoketest,standard --no-skipped
## Run SBE moke tests
sbe-smoke:
docker exec -t {{ project_name }}-testing behave --tags=smoketest --no-skipped
## Run SBE performance tests
sbe-perf:
docker-compose restart perf
docker exec -t {{ project_name }}-testing behave --tags=perftest --no-skipped
## Run SBE preformance smoke tests
sbe-perf-smoke:
docker exec -t {{ project_name }}-testing behave --tags=perfsmoke --no-skipped --no-logcapture
## Regenerate docs
rebuild-docs:
docker start {{ project_name }}-docs
## Run WEB application tests (not SBE tests)
test:
@echo "Start of make test"
@date +%T.%N
docker exec -t {{ project_name }}-web python manage.py test --failfast
@date +%T.%N
@echo "End of make test"
## Test if docs are compailed and propagated (only in local machine mode)
test-docs:
sed -i "$$ a UploadTestSucced" ./docs/source/index.rst
make upload-docs
curl -Ls localhost/docs | grep UploadTestSucced
sed -i "s|UploadTestSucced||g" ./docs/source/index.rst
## Test if docs are compailed and propagated (only in local docker-machine mode)
test-docs-cicd:
sed -i "$$ a UploadTestSucced" ./docs/source/index.rst
make upload-docs
curl -Ls http://$(DOCKER_MACHINE_IP)/docs | grep UploadTestSucced && { exit 0; } || echo "Docs not updated!"; exit 1;
sed -i "s|UploadTestSucced||g" ./docs/source/index.rst
## Collect static files in WEB container
reload-static:
docker exec {{ project_name }}-web python manage.py collectstatic --no-input
## Reload static files automatically after every change.
dev-static:
@when-changed -1 -v -r `find ./{{ project_name }}-web/* -name 'static'` -c make reload_static
## Docker compose down
down:
docker-compose down
## Upload Buildbot config files and reload configuration
cicd-upload:
docker cp ./cicd/master/config {{ project_name }}-cicd-master:/var/lib/buildbot
-make cicd-reconfig
make cicd-validate
## Reload Buildbot config files
cicd-reconfig:
docker exec -t {{ project_name }}-cicd-master buildbot --verbose reconfig
## Validate Buildbot config file
cicd-validate:
docker exec -t {{ project_name }}-cicd-master buildbot checkconfig master.cfg
## Regenerate docs and copy them to Nginx to be served as statics
upload-docs:
docker cp ./docs {{ project_name }}-docs:/opt/{{ project_name }}/
docker start -a {{ project_name }}-docs
@mkdir -p ./docs/build
docker cp {{ project_name }}-docs:/opt/{{ project_name }}/docs/build/html ./docs/build/
docker exec -t {{ project_name }}-https mkdir -p /opt/{{ project_name }}/docs/build
docker cp ./docs/build/html {{ project_name }}-https:/opt/{{ project_name }}/docs/build/
## Collect static in WEB container and copy them to Nginx to be served as statics
upload-static:
mkdir -p static
make reload-static
#docker exec -t {{ project_name }}-web python manage.py collectstatic --no-input
docker cp {{ project_name }}-web:/opt/{{ project_name }}/static/ .
docker cp ./static {{ project_name }}-https:/opt/{{ project_name }}/
## Unset env variables for docker engine cicd machine to use with eval $(make unset-docker)
unset-docker:
unset DOCKER_TLS_VERIFY
unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_MACHINE_NAME
unset DOCKER_MACHINE_IP
## Clean all built images on remote docker
clean-remote-docker-images:
set -a; \
. ./remote.docker.env; \
set +a; \
make clean-all
## Clean all built images on docker-machine
clean-docker-machine-images:
set -a; \
. ./docker-machine.docker.env; \
set +a; \
make clean-all
## Print message on success for local install
success-local:
@echo "\033[1;32mGreat! All works! You can go to the docs - http://127.0.0.1/docs/ ).\033[0m"
## Print message on success for local with CI/CD machinery
success-cicd:
@echo "\033[1;32mGreat! All works! You can go to the CI/CD console in your browser http://localhost:8010 .\033[0m"
# Printing nice help when make help is called
# COLORS
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
TARGET_MAX_CHAR_NUM=20
## Show help
help:
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)