-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
127 lines (95 loc) · 4.55 KB
/
Makefile
File metadata and controls
127 lines (95 loc) · 4.55 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
COMPOSE_FILE_DEV = docker-compose-dev.yml
COMPOSE_FILE_PROD = docker-compose.yml
help: ## show this help
@echo 'usage: make [target] ...'
@echo ''
@echo 'targets:'
@egrep '^(.+)\:\ .*##\ (.+)' ${MAKEFILE_LIST} | sed 's/:.*##/#/' | column -t -c 2 -s '#'
############################################
## atalhos docker-compose desenvolvimento ##
############################################
dev_compose_build: ## Build app using $(COMPOSE_FILE_DEV)
@docker-compose -f $(COMPOSE_FILE_DEV) build
dev_compose_up: ## Start app using $(COMPOSE_FILE_DEV)
@docker-compose -f $(COMPOSE_FILE_DEV) up -d
dev_compose_logs: ## See all app logs using $(COMPOSE_FILE_DEV)
@docker-compose -f $(COMPOSE_FILE_DEV) logs -f
dev_compose_stop: ## Stop all app using $(COMPOSE_FILE_DEV)
@docker-compose -f $(COMPOSE_FILE_DEV) stop
dev_compose_ps: ## See all containers using $(COMPOSE_FILE_DEV)
@docker-compose -f $(COMPOSE_FILE_DEV) ps
dev_compose_rm: ## Remove all containers using $(COMPOSE_FILE_DEV)
@docker-compose -f $(COMPOSE_FILE_DEV) rm -f
dev_compose_bash: ## Open python terminal from opac-airflow $(COMPOSE_FILE_DEV)
@docker-compose -f $(COMPOSE_FILE_DEV) run --rm opac-airflow bash
dev_compose_add_opac_conn: ## Add default opac_conn
@docker-compose -f $(COMPOSE_FILE_DEV) run --rm opac-airflow airflow connections \
-a --conn_type=Mongo \
--conn_id=opac_conn \
--conn_host=localhost \
--conn_schema=opac \
--conn_port=27017 \
--conn_extra='{"authentication_source": "admin"}'
dev_compose_add_kernel_conn: ## Add default kernel_conn
@docker-compose -f $(COMPOSE_FILE_DEV) run --rm opac-airflow airflow connections \
-a --conn_type=HTTP \
--conn_id=kernel_conn \
--conn_host=http://0.0.0.0 \
--conn_port=6543
dev_compose_add_postgres_report_conn:
@docker-compose -f $(COMPOSE_FILE_DEV) run --rm opac-airflow airflow connections \
-a --conn_type=Postgres \
--conn_id=postgres_report_connection
dev_compose_rm_db: ## Remove database
@docker-compose -f $(COMPOSE_FILE_DEV) run --rm opac-airflow rm airflow.db
dev_compose_initdb: ## Initialize airflow database
@docker-compose -f $(COMPOSE_FILE_DEV) run --rm opac-airflow airflow initdb
############################################
## atalhos docker-compose produção ##
############################################
compose_build: ## Build app using $(COMPOSE_FILE_PROD)
@docker-compose -f $(COMPOSE_FILE_PROD) build
compose_up: ## Start app using $(COMPOSE_FILE_PROD)
@docker-compose -f $(COMPOSE_FILE_PROD) up -d
compose_logs: ## See all app logs using $(COMPOSE_FILE_PROD)
@docker-compose -f $(COMPOSE_FILE_PROD) logs -f
compose_stop: ## Stop all app using $(COMPOSE_FILE_PROD)
@docker-compose -f $(COMPOSE_FILE_PROD) stop
compose_ps: ## See all containers using $(COMPOSE_FILE_PROD)
@docker-compose -f $(COMPOSE_FILE_PROD) ps
compose_rm: ## Remove all containers using $(COMPOSE_FILE_PROD)
@docker-compose -f $(COMPOSE_FILE_PROD) rm -f
compose_bash: ## Open python terminal from portal $(COMPOSE_FILE_PROD)
@docker-compose -f $(COMPOSE_FILE_PROD) run --rm opac-airflow bash
compose_add_opac_conn: ## Add default opac_conn
@docker-compose -f $(COMPOSE_FILE_PROD) run --rm opac-airflow airflow connections \
-a --conn_type=Mongo \
--conn_id=opac_conn \
--conn_host=localhost \
--conn_schema=opac \
--conn_port=27017 \
--conn_extra='{"authentication_source": "admin"}'
compose_add_postgres_report_conn:
@docker-compose -f $(COMPOSE_FILE_PROD) run --rm opac-airflow airflow connections \
-a --conn_type=Postgres \
--conn_id=postgres_report_connection
compose_add_kernel_conn: ## Add default kernel_conn
@docker-compose -f $(COMPOSE_FILE_PROD) run --rm opac-airflow airflow connections \
-a --conn_type=HTTP \
--conn_id=kernel_conn \
--conn_host=http://0.0.0.0 \
--conn_port=6543
compose_rm_db: ## Remove database
@docker-compose -f $(COMPOSE_FILE_PROD) run --rm opac-airflow rm airflow.db
compose_initdb: ## Initialize airflow database
@docker-compose -f $(COMPOSE_FILE_PROD) run --rm opac-airflow airflow initdb
#####################################################
## atalhos docker-compose build e testes no travis ##
#####################################################
travis_compose_build:
@echo "[Travis Build] compose file: " $(COMPOSE_FILE_PROD)
@docker-compose -f $(COMPOSE_FILE_PROD) build
travis_compose_up:
@docker-compose -f $(COMPOSE_FILE_PROD) up -d
travis_compose_make_test:
@docker-compose -f $(COMPOSE_FILE_PROD) exec opac-airflow bash -c "export AIRFLOW__CORE__SQL_ALCHEMY_CONN=sqlite:////usr/local/airflow/airflow.db && airflow initdb && python -m unittest -v"