diff --git a/.gitignore b/.gitignore index 5201596..c428055 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ dist/ # NPM package-lock.json package.json +node_modules/ # Database zdravko.db diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..23b328e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "plugins": ["prettier-plugin-go-template"] +} diff --git a/deploy/fly.toml b/deploy/fly.toml index ffc54b6..e365c7a 100644 --- a/deploy/fly.toml +++ b/deploy/fly.toml @@ -48,8 +48,14 @@ primary_region = 'waw' port = 7233 handlers = ['tls'] +[[vm]] + cpu_kind = 'shared' + cpus = 2 + memory_mb = 512 + processes = ['server'] + [[vm]] cpu_kind = 'shared' cpus = 1 memory_mb = 256 - processes = ['server', 'worker'] + processes = ['worker'] diff --git a/web/templates/components/base.tmpl b/web/templates/components/base.tmpl index 5c96c90..5de1b97 100644 --- a/web/templates/components/base.tmpl +++ b/web/templates/components/base.tmpl @@ -1,38 +1,46 @@ -{{define "base"}} -{{ $title := "" }} -{{ $path := "" }} -{{ if ne nil .NavbarActive }} - {{ $title = .NavbarActive.Title }} - {{ $path = .NavbarActive.Path }} -{{ end }} +{{ define "base" }} + {{ $title := "" }} + {{ $path := "" }} + {{ if ne nil .NavbarActive }} + {{ $title = .NavbarActive.Title }} + {{ $path = .NavbarActive.Path }} + {{ end }} - - - - - - - Zdravko - {{$title}} - - - - - {{template "main" .}} -
- - - - -{{end}} + + + + + + + + Zdravko - {{ $title }} + + + + + {{ template "main" . }} +
+ +
+ + + +{{ end }} diff --git a/web/templates/components/settings.tmpl b/web/templates/components/settings.tmpl index fe125c8..dcfedb9 100644 --- a/web/templates/components/settings.tmpl +++ b/web/templates/components/settings.tmpl @@ -1,39 +1,54 @@ -{{define "main"}} -{{ $title := "" }} -{{ $path := "" }} -{{ if ne nil .SettingsSidebarActive }} - {{ $title = .SettingsSidebarActive.Title }} - {{ $path = .SettingsSidebarActive.Path }} -{{ end }} +{{ define "main" }} + {{ $title := "" }} + {{ $path := "" }} + {{ if ne nil .SettingsSidebarActive }} + {{ $title = .SettingsSidebarActive.Title }} + {{ $path = .SettingsSidebarActive.Path }} + {{ end }} -
- -
- - {{template "settings" .}} + {{ end }} + +
+ + {{ template "settings" . }} +
-
-{{end}} +{{ end }} diff --git a/web/templates/pages/404.tmpl b/web/templates/pages/404.tmpl index 13d6dc9..87713b6 100644 --- a/web/templates/pages/404.tmpl +++ b/web/templates/pages/404.tmpl @@ -1,7 +1,15 @@ -{{define "main"}} -
-

Error 404: Page was not found!

-

We didn't find the page you were looking for. Please check the URL and try again.

-

Or you can go back to the homepage.

-
-{{end}} +{{ define "main" }} +
+

+ Error 404: Page was not found! +

+

+ We didn't find the page you were looking for. Please check the URL and try + again. +

+

+ Or you can go back to the + homepage. +

+
+{{ end }} diff --git a/web/templates/pages/incidents.tmpl b/web/templates/pages/incidents.tmpl index 343655a..b313ccb 100644 --- a/web/templates/pages/incidents.tmpl +++ b/web/templates/pages/incidents.tmpl @@ -1,14 +1,19 @@ -{{define "main"}} -
-
+{{ define "main" }} +
+
-

+

There are no Incidents, yet. -

-

- Incidents will allow you to inform your users or co-worker groups about outages and issues. -

+ +

+ Incidents will allow you to inform your users or co-worker groups + about outages and issues. +

-
-
-{{end}} +
+
+{{ end }} diff --git a/web/templates/pages/index.tmpl b/web/templates/pages/index.tmpl index 7100949..e3001ee 100644 --- a/web/templates/pages/index.tmpl +++ b/web/templates/pages/index.tmpl @@ -1,98 +1,141 @@ -{{define "daily"}} -
{{ .HistoryDaily.Uptime }}% uptime
-
- {{ range .HistoryDaily.History }} - {{ if eq . "SUCCESS" }} -
- {{ else if eq . "FAILURE" }} -
- {{ else }} -
- {{ end }} - {{ end }} -
-
90 days ago
-
Today
-{{end}} - -{{define "hourly"}} -
{{ .HistoryHourly.Uptime }}% uptime
-
- {{ range .HistoryHourly.History }} - {{ if eq . "SUCCESS" }} -
- {{ else if eq . "FAILURE" }} -
- {{ else }} -
- {{ end }} - {{ end }} -
-
48 hours ago
-
Now
-{{end}} - -{{define "main"}} -
- {{ if eq .MonitorsLength 0 }} -
-
-

- There are no monitors yet. -

-

- Create a monitor to monitor your services and get notified when they are down. -

- -
-
- {{ else }} - {{ if or (eq .Status "UNKNOWN") (eq .Status "SUCCESS") }} -
- -

All services are online

-

Last updated on Feb 10 at 10:55am UTC

-
- {{ else }} -
- -

Degraded performance

-

Last updated on Feb 10 at 10:55am UTC

-
- {{ end }} -
-
-

Monitors

- -
- {{ range .HealthChecks }} -
-
- {{ if eq .Status "SUCCESS" }} - - {{ else if eq .Status "FAILURE" }} - - {{ else }} - - {{ end }} -

{{ .Name }}

-
- {{ if eq $.TimeRange "90days" }} - {{ template "daily" . }} +{{ define "daily" }} +
{{ .HistoryDaily.Uptime }}% uptime
+
+ {{ range .HistoryDaily.History }} + {{ if eq . "SUCCESS" }} +
+ {{ else if eq . "FAILURE" }} +
{{ else }} - {{ template "hourly" . }} +
{{ end }} -
{{ end }}
- {{ end }} -
-{{end}} +
90 days ago
+
Today
+{{ end }} + +{{ define "hourly" }} +
+ {{ .HistoryHourly.Uptime }}% uptime +
+
+ {{ range .HistoryHourly.History }} + {{ if eq . "SUCCESS" }} +
+ {{ else if eq . "FAILURE" }} +
+ {{ else }} +
+ {{ end }} + {{ end }} +
+
48 hours ago
+
Now
+{{ end }} + +{{ define "main" }} +
+ {{ if eq .MonitorsLength 0 }} +
+
+

+ There are no monitors yet. +

+

+ Create a monitor to monitor your services and get notified when they + are down. +

+ +
+
+ {{ else }} + {{ if or (eq .Status "UNKNOWN") (eq .Status "SUCCESS") }} +
+ + + +

All services are online

+

+ Last updated on Feb 10 at 10:55am UTC +

+
+ {{ else }} +
+ + + +

Degraded performance

+

+ Last updated on Feb 10 at 10:55am UTC +

+
+ {{ end }} +
+
+

+ Monitors +

+ +
+ {{ range .HealthChecks }} +
+
+ {{ if eq .Status "SUCCESS" }} + + {{ else if eq .Status "FAILURE" }} + + {{ else }} + + {{ end }} +

{{ .Name }}

+
+ {{ if eq $.TimeRange "90days" }} + {{ template "daily" . }} + {{ else }} + {{ template "hourly" . }} + {{ end }} +
+ {{ end }} +
+ {{ end }} +
+{{ end }} diff --git a/web/templates/pages/settings_monitors.tmpl b/web/templates/pages/settings_monitors.tmpl index 104ec05..6397e78 100644 --- a/web/templates/pages/settings_monitors.tmpl +++ b/web/templates/pages/settings_monitors.tmpl @@ -1,94 +1,109 @@ -{{define "settings"}} +{{ define "settings" }} + {{ $description := "Monitors are constantly checking weather a service is online and working correctly." }} -{{ $description := "Monitors are constantly checking weather a service is online and working correctly." }} - -{{ if eq .MonitorsLength 0 }} -
-

- There are no monitors yet. -

-

- {{ $description }} -

- -{{ else }} -
- + {{ else }} +
+
- - - - - - - + + + + + + + - {{range .Monitors}} - + {{ range .Monitors }} + - - - + + - - + {{ end }} + + + - - {{end}} -
List of Monitors

{{ $description }}

- + Create New - + + +
- Name - - Worker Groups - - Status - - Schedule - - Action -
NameWorker GroupsStatusScheduleAction
- {{.Name}} - - {{range .WorkerGroups}} - - {{ . }} - - {{end}} - - {{ if eq .Status "ACTIVE" }} - + + {{ .Name }} + + {{ range .WorkerGroups }} + + {{ . }} + + {{ end }} + + {{ if eq .Status "ACTIVE" }} + ACTIVE - {{ else if eq .Status "PAUSED" }} - + {{ else if eq .Status "PAUSED" }} + PAUSED - {{ else }} - + {{ else }} + UNKNOWN - {{ end }} - - {{.Schedule}} - - Details - + {{ .Schedule }} + + Details +
-
-{{end}} -{{end}} + + {{ end }} + + + {{ end }} +{{ end }} diff --git a/web/templates/pages/settings_monitors_create.tmpl b/web/templates/pages/settings_monitors_create.tmpl index 7870a8f..3d7083c 100644 --- a/web/templates/pages/settings_monitors_create.tmpl +++ b/web/templates/pages/settings_monitors_create.tmpl @@ -1,40 +1,61 @@ -{{define "settings"}} -
-
- - -

Name of the monitor can be anything.

- - -

Worker groups are used to distribute the monitor to specific workers.

- - -

- Schedule is a cron expression that defines when the monitor should be executed. -
- You can also use @every [interval] where interval is a duration like 5m, 1h, 60s. - Or use @hourly, @daily, @weekly, @monthly, @yearly. -

- - -
-

- Script is what determines the status of a service. - You can read more about it on k6 documentation. -

- -
-
+{{ define "settings" }} +
+
+ + +

Name of the monitor can be anything.

+ + +

+ Worker groups are used to distribute the monitor to specific workers. +

+ + +

+ Schedule is a cron expression that defines when the monitor should be + executed. +
+ You can also use @every [interval] where interval is a + duration like 5m, 1h, 60s. Or use @hourly, + @daily, @weekly, @monthly, + @yearly. +

+ + +
+

+ Script is what determines the status of a service. You can read more + about it on + k6 documentation. +

+ +
+
+ + - -{{end}} + +{{ end }} diff --git a/web/templates/pages/settings_monitors_describe.tmpl b/web/templates/pages/settings_monitors_describe.tmpl index a1dea8e..e87eef1 100644 --- a/web/templates/pages/settings_monitors_describe.tmpl +++ b/web/templates/pages/settings_monitors_describe.tmpl @@ -1,106 +1,140 @@ -{{define "settings"}} -
-
-

- Configuration -

- - -

Worker groups are used to distribute the monitor to specific workers.

- - -

- Schedule is a cron expression that defines when the monitor should be executed. -
- You can also use @every [interval] where interval is a duration like 5m, 1h, 60s. - Or use @hourly, @daily, @weekly, @monthly, @yearly. -

- - -
-

- Script is what determines the status of a service. - You can read more about it on k6 documentation. -

- -
-
- -
-
-

- Status - {{ if eq .Monitor.Status "ACTIVE" }} - - ACTIVE - - {{ else if eq .Monitor.Status "PAUSED" }} - - PAUSED - - {{ end }} -

-

- Pausing the monitor will stop it from executing. - This can be useful in cases of expected downtime. - Or when the monitor is not needed anymore. -

- {{ if eq .Monitor.Status "ACTIVE" }} - Pause - {{ else if eq .Monitor.Status "PAUSED" }} - Resume - {{ end }} -
- -
-

- Danger Zone -

-

Permanently delete this monitor.

- Delete -
-
- -
- - - - - - - - - - - - {{range .History}} - - - - - - - {{end}} - -
- History +{{ define "settings" }} +
+
+

Configuration

+ +

- Last 10 executions of monitor script. + Worker groups are used to distribute the monitor to specific workers.

-
StatusCreated AtDurationNote
- - {{ .Status }} - - - {{ .CreatedAt.Format "2006-01-02 15:04:05" }} - - { .Duration } - - {{ .Note }} -
-
+ + +

+ Schedule is a cron expression that defines when the monitor should be + executed. +
+ You can also use @every [interval] where interval is a + duration like 5m, 1h, 60s. Or use @hourly, + @daily, @weekly, @monthly, + @yearly. +

+ + +
+

+ Script is what determines the status of a service. You can read more + about it on + k6 documentation. +

+ + + - +
+
+

+ Status + {{ if eq .Monitor.Status "ACTIVE" }} + + ACTIVE + + {{ else if eq .Monitor.Status "PAUSED" }} + + PAUSED + + {{ end }} +

+

+ Pausing the monitor will stop it from executing. This can be useful in + cases of expected downtime. Or when the monitor is not needed anymore. +

+ {{ if eq .Monitor.Status "ACTIVE" }} + Pause + {{ else if eq .Monitor.Status "PAUSED" }} + Resume + {{ end }} +
+ +
+

Danger Zone

+

Permanently delete this monitor.

+ Delete +
+
+ +
+ + + + + + + + + + + + {{ range .History }} + + + + + + + {{ end }} + +
+ History +

Last 10 executions of monitor script.

+
StatusCreated AtDurationNote
+ + {{ .Status }} + + + {{ .CreatedAt.Format "2006-01-02 15:04:05" }} + { .Duration } + {{ .Note }} +
+
+ + -{{end}} +{{ end }} diff --git a/web/templates/pages/settings_overview.tmpl b/web/templates/pages/settings_overview.tmpl index 333e635..9c2548e 100644 --- a/web/templates/pages/settings_overview.tmpl +++ b/web/templates/pages/settings_overview.tmpl @@ -1,25 +1,38 @@ -{{define "settings"}} -
-

- Hi there, {{.User.Email}}. +{{ define "settings" }} +
+

+ Hi there, {{ .User.Email }}.

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua.

-
+

-
-
-

Total Workers

-

42

+
+
+

Total Workers

+

42

+
+
+

+ Total Monitors +

+

42

+
+
+

+ Total Notifications +

+

42

+
-
-

Total Monitors

-

42

-
-
-

Total Notifications

-

42

-
-
-{{end}} +{{ end }} diff --git a/web/templates/pages/settings_worker_groups.tmpl b/web/templates/pages/settings_worker_groups.tmpl index 14109e7..7688d67 100644 --- a/web/templates/pages/settings_worker_groups.tmpl +++ b/web/templates/pages/settings_worker_groups.tmpl @@ -1,80 +1,93 @@ -{{define "settings"}} +{{ define "settings" }} + {{ $description := "Worker Groups are used to match multiple workers together. They can be used to difirentiate between regions, environments, networks etc." }} -{{ $description := "Worker Groups are used to match multiple workers together. They can be used to difirentiate between regions, environments, networks etc." }} - -{{ if eq .WorkerGroupsLength 0 }} -
-

- There are no worker groups yet. -

-

- {{ $description }} -

- -{{ else }} -
- - - + {{ else }} +
+
- List of Worker Groups -
-

- {{ $description }} -

- - Create New - - -
-
+ + - - - - + + + + - - {{range .WorkerGroups}} - - + + {{ range .WorkerGroups }} + + - - - {{end}} -
+ List of Worker Groups +
+

+ {{ $description }} +

+ + Create New + + + + +
+
- Name - - Workers - - Monitors - - Action - NameWorkersMonitorsAction
- {{.Name}} + {{ .Name }} {{ if eq ( len .ActiveWorkers) 0 }} - - NONE - + + NONE + {{ else }} - - {{ len .ActiveWorkers }} ONLINE - + + {{ len .ActiveWorkers }} ONLINE + {{ end }} - {{ len .Monitors }} + {{ len .Monitors }} - Details + Details
-
-{{end}} -{{end}} + + + {{ end }} + + + {{ end }} +{{ end }} diff --git a/web/templates/pages/settings_worker_groups_create.tmpl b/web/templates/pages/settings_worker_groups_create.tmpl index 118bcaf..371417b 100644 --- a/web/templates/pages/settings_worker_groups_create.tmpl +++ b/web/templates/pages/settings_worker_groups_create.tmpl @@ -1,10 +1,12 @@ -{{define "settings"}} -
-
- - -

Worker group name can be anything.

- -
-
-{{end}} +{{ define "settings" }} +
+
+ + +

Worker group name can be anything.

+ +
+
+{{ end }} diff --git a/web/templates/pages/settings_worker_groups_describe.tmpl b/web/templates/pages/settings_worker_groups_describe.tmpl index 2386940..3679a43 100644 --- a/web/templates/pages/settings_worker_groups_describe.tmpl +++ b/web/templates/pages/settings_worker_groups_describe.tmpl @@ -1,84 +1,108 @@ -{{define "settings"}} -
-

- Token - Use it as WORKER_GROUP_TOKEN configuration option. -

-
-
{{ .Worker.Token }}
- -
-
- -
-
- - - {{ if eq ( len .Worker.ActiveWorkers) 0 }} - - {{ else }} - - - - - - - {{range .Worker.ActiveWorkers }} - - - - {{end}} - - {{end}} -
- - Active Workers - {{ if eq ( len .Worker.ActiveWorkers) 0 }} - - NONE - - {{ else }} - - {{ len .Worker.ActiveWorkers }} ONLINE - - {{ end }} - -

- Current workers that were online in last minutes. -

-
No workers online for this worker group.
Identity
{{ . }}
-
- -
-

- Danger Zone +{{ define "settings" }} +
+

+ Token + Use it as WORKER_GROUP_TOKEN configuration option.

-

Permanently delete this worker group. Workers will not be able to connect anymore.

- Delete +
+
+{{ .Worker.Token }}
+ +
-

- -{{end}} +
+

Danger Zone

+

+ Permanently delete this worker group. Workers will not be able to + connect anymore. +

+ Delete +
+
+ + +{{ end }}