forked from grafana/carbon-relay-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
151 lines (133 loc) · 5.46 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
VERSION=$(shell git describe --tags --always | sed 's/^v//')
build:
cd ui/web && go-bindata -pkg web admin_http_assets
find . -name '*.go' | grep -v '^\.\/vendor' | xargs gofmt -w -s
CGO_ENABLED=0 go build -ldflags "-X main.Version=$(VERSION)" ./cmd/carbon-relay-ng
build-win:
cd ui/web && go-bindata -pkg web admin_http_assets
find . -name '*.go' | grep -v '^\.\/vendor' | xargs gofmt -w -s
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.Version=$(VERSION)" -o carbon-relay-ng.exe ./cmd/carbon-relay-ng
build-linux:
cd ui/web && go-bindata -pkg web admin_http_assets
find . -name '*.go' | grep -v '^\.\/vendor' | xargs gofmt -w -s
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.Version=$(VERSION)" ./cmd/carbon-relay-ng
test:
go test ./...
docker: build-linux
docker build --tag=raintank/carbon-relay-ng:latest .
docker tag raintank/carbon-relay-ng raintank/carbon-relay-ng:$(VERSION)
all:
deb: build
mkdir -p build/deb-systemd
install -d debian/usr/bin debian/usr/share/man/man1 debian/etc/carbon-relay-ng debian/lib/systemd/system debian/var/run/carbon-relay-ng debian/usr/lib/tmpfiles.d
install carbon-relay-ng debian/usr/bin
install examples/carbon-relay-ng.ini debian/etc/carbon-relay-ng/carbon-relay-ng.conf
install examples/carbon-relay-ng-tmpfiles.conf debian/usr/lib/tmpfiles.d/carbon-relay-ng.conf
install examples/carbon-relay-ng.service debian/lib/systemd/system
install man/man1/carbon-relay-ng.1 debian/usr/share/man/man1
gzip debian/usr/share/man/man1/carbon-relay-ng.1
fpm \
-s dir \
-t deb \
-n carbon-relay-ng \
-v $(VERSION)-1 \
-a native \
--config-files etc/carbon-relay-ng/carbon-relay-ng.conf \
-p build/deb-systemd/carbon-relay-ng-VERSION_ARCH.deb \
-m "Dieter Plaetinck <[email protected]>" \
--description "Fast carbon relay+aggregator with admin interfaces for making changes online" \
--license BSD \
--url https://github.com/graphite-ng/carbon-relay-ng \
--after-install examples/after_install.sh \
-C debian .
rm -rf debian
deb-upstart: build
mkdir build/deb-upstart
install -d debian/usr/bin debian/usr/share/man/man1 debian/etc/carbon-relay-ng
install carbon-relay-ng debian/usr/bin
install examples/carbon-relay-ng.ini debian/etc/carbon-relay-ng/carbon-relay-ng.conf
install man/man1/carbon-relay-ng.1 debian/usr/share/man/man1
gzip debian/usr/share/man/man1/carbon-relay-ng.1
fpm \
-s dir \
-t deb \
-n carbon-relay-ng \
-v $(VERSION)-1 \
-a native \
--config-files etc/carbon-relay-ng/carbon-relay-ng.conf \
-p build/deb-upstart/carbon-relay-ng-VERSION_ARCH.deb \
--deb-upstart examples/carbon-relay-ng.upstart \
-m "Dieter Plaetinck <[email protected]>" \
--description "Fast carbon relay+aggregator with admin interfaces for making changes online" \
--license BSD \
--url https://github.com/graphite-ng/carbon-relay-ng \
-C debian .
rm -rf debian
rpm: build
mkdir -p build/centos-7
install -d redhat/usr/bin redhat/usr/share/man/man1 redhat/etc/carbon-relay-ng redhat/lib/systemd/system redhat/var/run/carbon-relay-ng redhat/etc/tmpfiles.d
install carbon-relay-ng redhat/usr/bin
install man/man1/carbon-relay-ng.1 redhat/usr/share/man/man1
install examples/carbon-relay-ng.ini redhat/etc/carbon-relay-ng/carbon-relay-ng.conf
install examples/carbon-relay-ng-tmpfiles.conf redhat/etc/tmpfiles.d/carbon-relay-ng.conf
install examples/carbon-relay-ng.service redhat/lib/systemd/system
gzip redhat/usr/share/man/man1/carbon-relay-ng.1
fpm \
-s dir \
-t rpm \
-n carbon-relay-ng \
-v $(VERSION) \
--epoch 1 \
-a native \
--config-files etc/carbon-relay-ng/carbon-relay-ng.conf \
-p build/centos-7/carbon-relay-ng-VERSION.el7.ARCH.rpm \
-m "Dieter Plaetinck <[email protected]>" \
--description "Fast carbon relay+aggregator with admin interfaces for making changes online" \
--license BSD \
--url https://github.com/graphite-ng/carbon-relay-ng \
--after-install examples/after_install.sh \
-C redhat .
rm -rf redhat
rpm-centos6: build
mkdir build/centos-6
install -d redhat/usr/bin redhat/usr/share/man/man1 redhat/etc/carbon-relay-ng redhat/etc/init
install carbon-relay-ng redhat/usr/bin
install man/man1/carbon-relay-ng.1 redhat/usr/share/man/man1
install examples/carbon-relay-ng.ini redhat/etc/carbon-relay-ng/carbon-relay-ng.conf
install examples/carbon-relay-ng.upstart-0.6.5 redhat/etc/init/carbon-relay-ng.conf
gzip redhat/usr/share/man/man1/carbon-relay-ng.1
fpm \
-s dir \
-t rpm \
-n carbon-relay-ng \
-v $(VERSION) \
--epoch 1 \
-a native \
--config-files etc/carbon-relay-ng/carbon-relay-ng.conf \
-p build/centos-6/carbon-relay-ng-VERSION.el6.ARCH.rpm \
-m "Dieter Plaetinck <[email protected]>" \
--description "Fast carbon relay+aggregator with admin interfaces for making changes online" \
--license BSD \
--url https://github.com/graphite-ng/carbon-relay-ng \
-C redhat .
rm -rf redhat
packages: deb deb-upstart rpm rpm-centos6
gh-pages: man
mkdir -p gh-pages
find man -name \*.html | xargs -I__ mv __ gh-pages/
git checkout -q gh-pages
cp -R gh-pages/* ./
rm -rf gh-pages
git add .
git commit -m "Rebuilt manual."
git push origin gh-pages
git checkout -q master
install: build
go install
man:
find man -name \*.ronn | xargs -n1 ronn --manual=carbon-relay-ng --style=toc
run: build
./carbon-relay-ng carbon-relay-ng.ini
run-docker:
docker run --rm -p 2003:2003 -p 2004:2004 -p 8081:8081 -v $(pwd)/examples:/conf -v $(pwd)/spool:/spool raintank/carbon-relay-ng
.PHONY: all deb gh-pages install man test build