-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
139 lines (119 loc) · 4.28 KB
/
Makefile
File metadata and controls
139 lines (119 loc) · 4.28 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
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#
# Copyright 2021 Joyent, Inc.
# Copyright 2024 MNX Cloud, Inc.
#
#
# Makefile: Electric Moray, a system for sharded Moray buckets
#
NAME = electric-moray
#
# Files
#
DOC_FILES = index.md
JS_FILES := $(wildcard *.js) $(shell find lib test -name '*.js')
JSL_CONF_NODE = tools/jsl.node.conf
JSL_FILES_NODE = $(JS_FILES)
JSSTYLE_FILES = $(JS_FILES)
JSSTYLE_FLAGS = -f tools/jsstyle.conf
SMF_MANIFESTS_IN = smf/manifests/haproxy.xml.in
BOOTSTRAP_MANIFESTS = sapi_manifests/registrar/template
NODEUNIT_TESTS = $(notdir $(wildcard test/*.test.js))
NODE_PREBUILT_VERSION=v6.17.1
# minimal-64-lts 19.4.0
NODE_PREBUILT_IMAGE=5417ab20-3156-11ea-8b19-2b66f5e7a439
NODE_PREBUILT_TAG=zone64
ENGBLD_USE_BUILDIMAGE = true
ENGBLD_REQUIRE := $(shell git submodule update --init deps/eng)
include ./deps/eng/tools/mk/Makefile.defs
TOP ?= $(error Unable to access eng.git submodule Makefiles.)
ifeq ($(shell uname -s),SunOS)
include ./deps/eng/tools/mk/Makefile.node_prebuilt.defs
include ./deps/eng/tools/mk/Makefile.agent_prebuilt.defs
else
NPM=npm
NODE=node
NPM_EXEC=$(shell which npm)
NODE_EXEC=$(shell which node)
endif
include ./deps/eng/tools/mk/Makefile.node_modules.defs
include ./deps/eng/tools/mk/Makefile.smf.defs
#
# MG Variables
#
RELEASE_TARBALL := $(NAME)-pkg-$(STAMP).tar.gz
ROOT := $(shell pwd)
RELSTAGEDIR := /tmp/$(NAME)-$(STAMP)
# triton-origin-x86_64-19.4.0
BASE_IMAGE_UUID = 59ba2e5e-976f-4e09-8aac-a4a7ef0395f5
BUILDIMAGE_NAME = mantav2-electric-moray
BUILDIMAGE_DESC = Manta moray proxy
BUILDIMAGE_PKGSRC = haproxy-2.0.25
AGENTS = amon config registrar
#
# Repo-specific targets
#
.PHONY: all
all: $(SMF_MANIFESTS) $(BOOTSTRAP_MANIFESTS) $(STAMP_NODE_MODULES) manta-scripts
CLEAN_FILES += $(BOOTSTRAP_MANIFESTS)
.PHONY: manta-scripts
manta-scripts: deps/manta-scripts/.git
mkdir -p $(BUILD)/scripts
cp deps/manta-scripts/*.sh $(BUILD)/scripts
.PHONY: test
test: $(STAMP_NODE_MODULES) $(addprefix run-nodeunit.,$(NODEUNIT_TESTS))
run-nodeunit.%: test/%
$(NODE) ./node_modules/.bin/nodeunit --reporter=tap $^
.PHONY: release
release: all
@echo "Building $(RELEASE_TARBALL)"
@mkdir -p $(RELSTAGEDIR)/root/opt/smartdc/electric-moray
@mkdir -p $(RELSTAGEDIR)/root/opt/smartdc/boot
@mkdir -p $(RELSTAGEDIR)/root/opt/smartdc/electric-moray/etc
cp -r $(ROOT)/build \
$(ROOT)/bin \
$(ROOT)/boot \
$(ROOT)/lib \
$(ROOT)/main.js \
$(ROOT)/node_modules \
$(ROOT)/package.json \
$(ROOT)/sapi_manifests \
$(ROOT)/smf \
$(RELSTAGEDIR)/root/opt/smartdc/electric-moray/
mv $(RELSTAGEDIR)/root/opt/smartdc/electric-moray/build/scripts \
$(RELSTAGEDIR)/root/opt/smartdc/electric-moray/boot
ln -s /opt/smartdc/electric-moray/boot/configure.sh \
$(RELSTAGEDIR)/root/opt/smartdc/boot/configure.sh
chmod 755 \
$(RELSTAGEDIR)/root/opt/smartdc/electric-moray/boot/configure.sh
ln -s /opt/smartdc/electric-moray/boot/setup.sh \
$(RELSTAGEDIR)/root/opt/smartdc/boot/setup.sh
chmod 755 $(RELSTAGEDIR)/root/opt/smartdc/electric-moray/boot/setup.sh
cp $(ROOT)/etc/haproxy.cfg.in \
$(RELSTAGEDIR)/root/opt/smartdc/electric-moray/etc
(cd $(RELSTAGEDIR) && $(TAR) -I pigz -cf $(ROOT)/$(RELEASE_TARBALL) root)
@rm -rf $(RELSTAGEDIR)
# We include a pre-substituted copy of the template in our built image so that
# registrar doesn't go into maintenance on first boot. Then we ship both the
# .in file and this "bootstrap" substituted version. The boot/setup.sh script
# will perform this replacement again during the first boot, replacing @@PORTS@@
# with the real ports list.
sapi_manifests/registrar/template: sapi_manifests/registrar/template.in
sed -e 's/@@PORTS@@/2020/g' $< > $@
.PHONY: publish
publish: release
mkdir -p $(ENGBLD_BITS_DIR)/electric-moray
cp $(ROOT)/$(RELEASE_TARBALL) \
$(ENGBLD_BITS_DIR)/$(NAME)/$(RELEASE_TARBALL)
include ./deps/eng/tools/mk/Makefile.deps
ifeq ($(shell uname -s),SunOS)
include ./deps/eng/tools/mk/Makefile.node_prebuilt.targ
include ./deps/eng/tools/mk/Makefile.agent_prebuilt.targ
endif
include ./deps/eng/tools/mk/Makefile.node_modules.targ
include ./deps/eng/tools/mk/Makefile.smf.targ
include ./deps/eng/tools/mk/Makefile.targ