-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
103 lines (77 loc) · 2.93 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
# dcape-app-nextcloud Makefile
SHELL = /bin/sh
CFG ?= .env
CFG_BAK ?= $(CFG).bak
#- App name
APP_NAME ?= service-nextcloud
# Redefine dcape params without config duplicate
USE_DB ?= yes
ADD_USER ?= yes
USE_TLS = yes
USER_NAME ?= nc
USER_PASS ?= $(shell < /dev/urandom tr -dc A-Za-z0-9 2>/dev/null | head -c8; echo)
USER_EMAIL ?= ${USER_NAME}@${DCAPE_DOMAIN}
#- Docker image name
IMAGE ?= nextcloud
#- docker image version from dcape
IMAGE_VER ?= 29-fpm-alpine
#- Redis container image version
REDIS_IMAGE_VER ?= 7.2-alpine
#- Nginx container image version
NGINX_IMAGE_VER ?= 1.25.2-alpine
#APP_SITE ?= cloud.dev.lan
USE_TLS ?= false
#- Redis container image
REDIS_IMAGE ?= redis
#- Nginx container image
NGINX_IMAGE ?= nginx
#- Project name for DC
PROJECT_NAME ?= $(shell basename $$PWD)
#- Application root dir (only for local deploy)
APP_ROOT ?= $(PWD)
#- Redis SU password
REDIS_PASS ?= $(shell < /dev/urandom tr -dc A-Za-z0-9 2>/dev/null | head -c8; echo)
#- OnlyOffice image
OO_IMAGE ?= onlyoffice/documentserver
#- OnlyOffice image version
OO_IMAGE_VER ?= 8.1
#- OnlyOffice database
OO_PGDATABASE ?= onlyoffice
#- OnlyOffice database user
OO_PGUSER ?= onlyoffice
#- OnlyOffice database password
OO_PGPASSWORD ?= $(shell < /dev/urandom tr -dc A-Za-z0-9 2>/dev/null | head -c18; echo)
#- OnlyOffice web endpoint
OO_APP_SITE ?= oo-$(APP_SITE)
#- OnlyOffice JWT secret
OO_JWT_SECRET ?= $(shell < /dev/urandom tr -dc A-Za-z0-9 2>/dev/null | head -c18; echo)
# ------------------------------------------------------------------------------
# if exists - load old values
-include $(CFG_BAK)
export
-include $(CFG)
export
# ------------------------------------------------------------------------------
# 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
# ------------------------------------------------------------------------------
## Prepare before 'make up'
setup:
@mkdir -p ${APP_ROOT}/html ${APP_ROOT}/config ${APP_ROOT}/data ; \
chown -R 82:82 ${APP_ROOT}/html ${APP_ROOT}/config ${APP_ROOT}/data ; \
$(MAKE) -s db-create db-create-oo
## Execute OCC command inside app container (php occ $OCC_CMD)
exec-occ:
$(MAKE) -s dc CMD='exec -ti -u www-data app php /var/www/html/occ ${OCC_CMD}'
## Create OnlyOffice database
db-create-oo:
@$(MAKE) -s db-create PGUSER='${OO_PGUSER}' PGDATABASE='${OO_PGDATABASE}' PGPASSWORD='${OO_PGPASSWORD}'
## Drop OnlyOffice database
db-drop-oo:
@$(MAKE) -s db-drop PGUSER='${OO_PGUSER}' PGDATABASE='${OO_PGDATABASE}'