Skip to content

Commit 68ae0cf

Browse files
committed
Migrating frontend to VueJS
1 parent 9f1ddeb commit 68ae0cf

File tree

2,025 files changed

+4739
-283523
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,025 files changed

+4739
-283523
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
/wigo.*
88
/debs
99
/release
10+
/public
1011

1112
# dev
1213
/probes/60
14+
/dev
1315
/ssl
1416
/var
1517
/wigo.conf.*

Makefile

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif
1717

1818
build = go build
1919

20-
.PHONY: release race
20+
.PHONY: release race build-dev run-dev
2121
race:
2222
@echo "Building with race detector (current OS)"
2323
@mkdir -p release
@@ -27,9 +27,19 @@ race:
2727
GORACE="halt_on_error=1" go build -race -o current/wigocli $(BASE_DIR)/src/wigocli.go; \
2828
go build -o current/generate_cert $(BASE_DIR)/src/generate_cert.go
2929

30-
all: clean release
30+
all: clean lint release releases
3131

32-
releases:
32+
deps:
33+
@echo "Installing dependencies"
34+
go mod download -x
35+
@echo "Installing frontend dependencies"
36+
cd src/public && npm install
37+
38+
build-frontend: deps
39+
@echo "Building frontend"
40+
cd src/public && npm run build
41+
42+
releases: build-frontend
3343
@echo "Building Wigo releases"
3444
@mkdir -p release
3545
@cd release && for target in $(RELEASE_TARGETS) ; do \
@@ -51,7 +61,7 @@ releases:
5161
$(build) -o $$RELEASE_DIR/generate_cert $(BASE_DIR)/src/cmd/generate_cert/main.go; \
5262
done
5363

54-
release:
64+
release: build-frontend
5565
@echo "Building Wigo release for current OS"
5666
@mkdir -p release
5767
@cd release; \
@@ -60,7 +70,7 @@ release:
6070
$(build) -tags "netgo osusergo" -ldflags "-s -w -X github.com/root-gg/wigo/src/wigo.Version=$(RELEASE_VERSION)" -o current/wigocli $(BASE_DIR)/src/cmd/wigocli/main.go; \
6171
$(build) -o current/generate_cert $(BASE_DIR)/src/cmd/generate_cert/main.go
6272

63-
debs:
73+
debs: releases
6474
@echo "Building Wigo Debian packages"
6575
@mkdir -p $(DEBSRC)
6676
@mkdir -p $(DEBSRC)/etc/wigo/conf.d
@@ -106,7 +116,7 @@ publish-debs:
106116
done \
107117
done
108118

109-
lint:
119+
lint: fmt
110120
@FAIL=0 ;echo -n " - go fmt :" ; OUT=`gofmt -l . | grep -v ^vendor` ; \
111121
if [[ -z "$$OUT" ]]; then echo " OK" ; else echo " FAIL"; echo "$$OUT"; FAIL=1 ; fi ;\
112122
echo -n " - go vet :" ; OUT=`go vet ./...` ; \
@@ -120,7 +130,44 @@ clean:
120130
@echo "Cleaning all files"
121131
@rm -rf release
122132
@rm -rf $(DEBROOT)
133+
@rm -rf dev
123134

124-
deps:
125-
@echo "Installing dependencies"
126-
go mod download -x
135+
build-dev: deps
136+
@echo "Building Wigo for development"
137+
@mkdir -p release/current
138+
@go build -o release/current/wigo $(BASE_DIR)/src/cmd/wigo/main.go
139+
@go build -o release/current/wigocli $(BASE_DIR)/src/cmd/wigocli/main.go
140+
@go build -o release/current/generate_cert $(BASE_DIR)/src/cmd/generate_cert/main.go
141+
142+
143+
run-dev: build-dev
144+
@echo "Starting Wigo development server"
145+
@trap 'kill $$WIGO_PID $$TAIL_PID 2>/dev/null; wait $$WIGO_PID $$TAIL_PID 2>/dev/null; exit' INT TERM; \
146+
mkdir -p $(BASE_DIR)/dev; \
147+
mkdir -p $(BASE_DIR)/dev/probes/; \
148+
if [ ! -d $(BASE_DIR)/dev/probes/60 ]; then mkdir -p $(BASE_DIR)/dev/probes/60; fi; \
149+
for probe in hardware_load_average hardware_disks hardware_memory ifstat supervisord needrestart check_mdadm check_process haproxy lm-sensors iostat check_uptime smart check_ntp packages-apt; do \
150+
if [ ! -e $(BASE_DIR)/dev/probes/60/$$probe ]; then \
151+
ln -s $(BASE_DIR)/probes/examples/$$probe $(BASE_DIR)/dev/probes/60/$$probe; \
152+
fi; \
153+
done; \
154+
if [ ! -d $(BASE_DIR)/dev/probes/300 ]; then mkdir -p $(BASE_DIR)/dev/probes/300; fi; \
155+
for probe in smart check_ntp packages-apt; do \
156+
if [ ! -e $(BASE_DIR)/dev/probes/300/$$probe ]; then \
157+
ln -s $(BASE_DIR)/probes/examples/$$probe $(BASE_DIR)/dev/probes/300/$$probe; \
158+
fi; \
159+
done; \
160+
ln -s $(BASE_DIR)/lib $(BASE_DIR)/dev/lib; \
161+
if [ ! -e $(BASE_DIR)/dev/wigo.crt ]; then \
162+
(cd $(BASE_DIR)/dev && $(BASE_DIR)/release/current/generate_cert -ca=true -duration=87600h0m0s -host "127.0.0.1" --rsa-bits=4096;) \
163+
fi; \
164+
sudo $(BASE_DIR)/release/current/wigo --config $(BASE_DIR)/etc/wigo-dev.conf & \
165+
WIGO_PID=$$!; \
166+
sleep 1; \
167+
tail -f $(BASE_DIR)/dev/wigo.log 2>/dev/null & \
168+
TAIL_PID=$$!; \
169+
cd $(BASE_DIR)/src/public && npm run watch; \
170+
EXIT_CODE=$$?; \
171+
kill $$WIGO_PID $$TAIL_PID 2>/dev/null; \
172+
wait $$WIGO_PID $$TAIL_PID 2>/dev/null; \
173+
exit $$EXIT_CODE

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,20 @@ The directory name is the interval of check in seconds
8888
### Building from sources
8989

9090
##### Environment
91-
To build from sources, you need `golang` and `gcc` installed.
92-
The `$GOPATH` environment variable should also be set on your system.
91+
To build from sources, you need:
92+
- `golang` and `gcc` installed
93+
- `node.js` and `npm` for the frontend
94+
- The `$GOPATH` environment variable should also be set on your system
9395

9496
##### Dependencies
97+
98+
Install all dependencies:
9599
```sh
96100
make deps
97101
```
98102

99-
##### Building for your system
103+
##### Building
104+
100105
```sh
101106
make clean release
102107
```
@@ -113,6 +118,20 @@ You will need `dpkg-deb`
113118
make debs
114119
```
115120

121+
##### Development mode
122+
123+
To run Wigo in development mode with hot-reload for both backend and frontend:
124+
125+
```sh
126+
make run-dev
127+
```
128+
129+
The web interface will be available at `http://localhost:4400/` (or the port configured in `etc/wigo-dev.conf`).
130+
131+
To stop the development server, press `Ctrl+C` - this will gracefully stop both the Go server and the frontend watcher.
132+
133+
**Note:** The development mode requires `sudo` privileges to run the Wigo server. The development files are stored in the `dev/` directory.
134+
116135
### Usage
117136

118137
##### Wigo web interface

etc/wigo-dev.conf

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#
2+
## What Is Going On
3+
#
4+
5+
# General parameters
6+
#
7+
# ListenAddress -> Address on which wigo will listen
8+
# ListenPort -> Port on which wigo will listen
9+
# Group -> Group of current machine (webserver, loadbalancer,...).
10+
# AliveTimeout -> Number of seconds before setting remote wigo in error
11+
# If provided, a tag group will be added on OpenTSDB puts
12+
#
13+
[Global]
14+
Hostname = ""
15+
Group = ""
16+
LogFile = "dev/wigo.log"
17+
ProbesDirectory = "dev/probes"
18+
ProbesConfigDirectory = "etc/conf.d"
19+
UuidFile = "dev/uuid"
20+
Database = "dev/wigo.db"
21+
AliveTimeout = 60
22+
Debug = true
23+
24+
[Http]
25+
Enabled = true
26+
Address = "0.0.0.0"
27+
Port = 4400
28+
SslEnabled = false
29+
SslCert = "dev/http.crt"
30+
SslKey = "dev/http.key"
31+
Login = ""
32+
Password = ""
33+
34+
[PushServer]
35+
Enabled = true
36+
Address = "0.0.0.0"
37+
Port = 4401
38+
SslEnabled = true
39+
SslCert = "dev/wigo.crt"
40+
SslKey = "dev/wigo.key"
41+
AllowedClientsFile = "dev/allowed_clients"
42+
AutoAcceptClients = false
43+
44+
[PushClient]
45+
Enabled = false
46+
Address = ""
47+
Port = 4401
48+
SslEnabled = true
49+
SslCert = "dev/master.crt"
50+
UuidSig = "dev/uuid.sig"
51+
PushInterval = 10
52+
53+
# OpenTSDB
54+
#
55+
# You can specify an OpenTSDB instance to graph all probes metrics
56+
#
57+
# Params :
58+
# OpenTSDBEnabled -> Wether or not OpenTSDB graphing is enabled (true/false)
59+
# OpenTSDBAddress -> Ip of OpenTSDB instance
60+
# OpenTSDBPort -> Port of OpenTSDB instance
61+
# OpenTSDBMetricPrefix -> Prefix added before metric name (a dot will be added between prefix and probe name)
62+
#
63+
[OpenTSDB]
64+
Enabled = false
65+
Address = ["localhost"]
66+
SslEnabled = false
67+
MetricPrefix = "wigo"
68+
Deduplication = 600
69+
BufferSize = 10000
70+
71+
# RemoteWigos
72+
#
73+
# You can configure remoteWigos to monitore them from that instance of Wigo
74+
#
75+
# CheckInterval -> Number of seconds between remote wigo checks (do not set a value lower than AliveTimeout/2)
76+
#
77+
78+
[RemoteWigos]
79+
CheckInterval = 10
80+
SslEnabled = false
81+
Login = ""
82+
Password = ""
83+
84+
# Simple mode (you just define hostname and port, which is optional)
85+
# List = [
86+
# "ip", -> IP (mandatory) : Hostname of remoteWigo to check
87+
# "ip:port", -> port (optional) : Port to connect to on remote host (default is local ListenPort)
88+
# ]
89+
#
90+
List = []
91+
92+
# Full mode (every configuration parameter is customizable by remote wigo)
93+
# [[AdvancedList]]
94+
# Hostname = "ip" -> mandatory: Hostname of remoteWigo to check
95+
# Port = 4000 -> optional : Port of remoteWigo to check (default is local ListenPort)
96+
# CheckInterval = 10 -> optional : Number of seconds between remote wigo checks (default is RemoteWigosCheckInterval)
97+
# CheckRemotesDepth = 0 -> optional : Depth level for remoteWigos of remoteWigo checking (default is 0 -> all levels)
98+
#
99+
#[[AdvancedList]]
100+
# Hostname = "ip2"
101+
# CheckRemotes = 1
102+
#
103+
104+
105+
# Notifications
106+
#
107+
# You can configure notifications (http,email) when a probe/host status changes
108+
#
109+
[Notifications]
110+
111+
# General
112+
MinLevelToSend = 250
113+
RescueOnly = false
114+
OnWigoChange = false
115+
OnProbeChange = false
116+
117+
# HTTP
118+
HttpEnabled = 0 # -> 0: disabled, 1: enabled
119+
HttpUrl = ""
120+
121+
# Apprise https://github.com/caronc/apprise
122+
AppriseEnabled = 0 # -> 0: disabled, 1: enabled
123+
ApprisePath = "/usr/local/bin/apprise" # Path to the Apprise binary, you need to install it first
124+
# List of Apprise URLs to send notifications to, see https://github.com/caronc/apprise/wiki/Notify_urls
125+
AppriseUrls = []
126+
127+
# EMAIL
128+
EmailEnabled = 0 # -> 0: disabled, 1: enabled, 2: only if http failed
129+
EmailSmtpServer = "smtp.domain.tld:25"
130+
EmailRecipients = ["user@domain.tld","user2@domain.tld"]
131+
EmailFromName = "Wigo"
132+
EmailFromAddress = "wigo@domain.tld"

public/bower.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

public/bower_components/angular-bootstrap/.bower.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

public/bower_components/angular-bootstrap/bower.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)