summaryrefslogtreecommitdiff
path: root/Makefile
blob: c4fb774c3c3a7153f7d7b5ed39a5538b36dedffa (plain)
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
.PHONY: build

VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%s)

# create the go.mod and go.sum if this is a brand new repo
REDOMOD = $(shell if [ -e go.sum ]; then  echo go.sum exists; else GO111MODULE= go mod init; GO111MODULE= go mod tidy; fi)

all: install
	@echo build worked
	virtigo list droplets
	virtigo list droplets --on
	virtigo droplet show --name check.lab.wit.org
	virtigo droplet start --name check.lab.wit.org

build: goimports vet
	GO111MODULE=off go build \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

verbose: goimports vet
	GO111MODULE=off go build -v -x \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

install: goimports vet
	GO111MODULE=off go install -v -x \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

andlabs: verbose
	./virtigo --gui andlabs

# makes a .deb package
debian:
	rm -f ~/incoming/virtigo*deb
	go-deb --no-gui --repo go.wit.com/apps/virtigo

xml-add:
	./virtigo --libvirt ~/libvirt/*.xml --xml-ignore-disk=true

xml-add-save:
	./virtigo --libvirt ~/libvirt/*.xml --xml-ignore-disk=true --save

start-pihole.wit.com: build
	rm -f /tmp/blahcarr.xml /tmp/pihole.wit.com.xml
	./virtigo --start pihole.wit.com
	./virtigo --libvirt /tmp/pihole.wit.com.xml

start-pihole.wit.com-http:
	curl --silent http://localhost:8080/start?hostname=pihole.wit.com

old-start-all-droplets:
	curl --silent http://localhost:8080/start?start=git.wit.org
	curl --silent http://localhost:8080/start?start=go.wit.com
	curl --silent http://localhost:8080/start?start=rdate.wit.com
	curl --silent http://localhost:8080/start?start=uptime.wit.com
	curl --silent http://localhost:8080/start?start=www.wit.com
	curl --silent http://localhost:8080/start?start=ping.wit.com
	curl --silent http://localhost:8080/start?start=wekan.wit.com
	curl --silent http://localhost:8080/start?start=caddy.wit.org
	curl --silent http://localhost:8080/start?start=immich.wit.org
	curl --silent http://localhost:8080/start?start=bernacchi
	@#curl --silent http://localhost:8080/start?start=jcarr
	@# ./virtigo --start jcarr

curl-uptime:
	curl --silent http://localhost:8080/uptime

curl-droplets:
	curl --silent http://localhost:8080/droplets

curl-writeconfig:
	curl --silent http://localhost:8080/writeconfig

# this is for release builds using the go.mod files
release-build:
	@echo ${REDOMOD}
	go build -v -ldflags "-X main.Version=${VERSION} -X gui.GUIVERSION=${VERSION}"

# autofixes your import headers in your golang files
goimports:
	goimports -w *.go

vet:
	@GO111MODULE=off go vet
	@echo this go binary package builds okay

# remake the go.mod and go.sum files
redomod:
	rm -f go.*
	GO111MODULE= go mod init
	GO111MODULE= go mod tidy

clean:
	rm -f go.*
	rm -f virtigo*
	go-mod-clean purge

# git clone the sources and all the golang dependancies into ~/go/src
# if you don't have go-clone, you can get it from http://go.wit.com/
git-clone:
	go-clone --recursive --go-src --no-work go.wit.com/apps/go-clone
	go-clone --recursive --go-src --no-work go.wit.com/apps/virtigo
	go-clone --recursive --go-src --no-work go.wit.com/apps/gowebd
	go-clone --recursive --go-src --no-work go.wit.com/lib/daemons/virtigod

http-uptime:
	curl --silent http://localhost:8080/uptime

http-droplets:
	curl --silent http://localhost:8080/droplets

http-missing:
	curl --silent http://localhost:8080/missing

http-dumplibvirtxml:
	curl --silent http://localhost:8080//dumplibvirtxml

protogen:
	go-clone google.golang.org/protobuf
	cd ~/go/src/google.golang.org/protobuf/cmd/protoc-gen-go && go install

gocui: install
	virtigo --gui gocui --gui-verbose --gui-file ../../toolkits/gocui/gocui.so --admin
	# virtigo --gui gocui --gui-verbose --gui-file ../../toolkits/gocui/gocui.so --admin >/tmp/forge.log 2>&1

log:
	journalctl -f -xeu virtigod.service