generated from dopos/dcape-app-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
87 lines (63 loc) · 2.37 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
## dcape-app-zabbix Makefile
## This file extends Makefile.app from dcape
#:
SHELL = /bin/bash
CFG ?= .env
CFG_BAK ?= $(CFG).bak
#- App name
APP_NAME ?= zabbix
#- Docker frontend image name
IMAGE ?= zabbix/zabbix-web-nginx-pgsql
#- Docker image tag (all images)
#IMAGE_VER ?= alpine-6.4.8
IMAGE_VER ?= alpine-6.4-latest
# If you need database, uncomment this var
USE_DB = yes
# If you need user name and password, uncomment this var
#ADD_USER = yes
# Other docker images
SERVER_IMAGE ?= zabbix/zabbix-server-pgsql
AGENT_IMAGE ?= zabbix/zabbix-agent2
DATESTAMP ?= $(shell date +%F_%H%M)
# ------------------------------------------------------------------------------
# if exists - load old values
-include $(CFG_BAK)
export
-include $(CFG)
export
# This content will be added to .env
define CONFIG_CUSTOM
# ------------------------------------------------------------------------------
# Zabbix config addon
SERVER_IMAGE=$(SERVER_IMAGE)
AGENT_IMAGE=$(AGENT_IMAGE)
PHP_TZ=$(TZ)
DB_CONTAINER=$(DB_CONTAINER)
endef
# ------------------------------------------------------------------------------
# Find and include DCAPE_ROOT/Makefile
DCAPE_COMPOSE ?= dcape-compose
DCAPE_ROOT ?= $(shell docker inspect -f "{{.Config.Labels.dcape_root}}" $(DCAPE_COMPOSE))
ifeq ($(shell test -e $(DCAPE_ROOT)/Makefile.app && echo -n yes),yes)
include $(DCAPE_ROOT)/Makefile.app
else
include /opt/dcape/Makefile.app
endif
include Makefile.parts
# Inclide local targets (if exists)
-include Makefile.local
# ------------------------------------------------------------------------------
## App support operations
#:
## top via pgcenter
top:
@docker run -it --rm --network ${DCAPE_NET} -e PGPASSWORD=$$PGPASSWORD \
lesovsky/pgcenter:latest pgcenter top -h db -U $$PGUSER -d $$PGDATABASE
## Бэкап схемы БД
dump-schema:
@echo "BackUp schema..." ; \
docker exec -i $$DB_CONTAINER pg_dump -d $$PGDATABASE -U $$PGUSER -n $${PGSCHEMA} --schema-only -Ft \
| gzip > $${DEST_PATH}backupdb-zabbix-$${PGSCHEMA}-$(DATESTAMP)-schema.tgz
## Отключить алертинг (при запуске копии на продовых данных)
alerts-off:
@cat alerts-off.sql | docker exec -i $${DB_CONTAINER:?Must be set} psql -d $$PGDATABASE -U $$PGUSER -n $${PGSCHEMA}