small changes and force run for release
parent
a8e50d3ce4
commit
c35c07f8c3
|
|
@ -0,0 +1,2 @@
|
||||||
|
vendor
|
||||||
|
**/*.sw*
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.30
|
||||||
|
RUN apk update \
|
||||||
|
&& apk add --no-cache \
|
||||||
|
ca-certificates \
|
||||||
|
bash \
|
||||||
|
jq \
|
||||||
|
python3 \
|
||||||
|
curl \
|
||||||
|
&& apk add --no-cache tzdata \
|
||||||
|
&& cp /usr/share/zoneinfo/America/Denver /etc/localtime \
|
||||||
|
&& echo "America/Denver" > /etc/timezone
|
||||||
|
|
||||||
|
RUN mkdir -p /var/log
|
||||||
|
WORKDIR /main
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV GOPATH=""
|
||||||
|
ENV MNT="/mnt/"
|
||||||
|
ENTRYPOINT ["/main/firestormy"]
|
||||||
|
CMD []
|
||||||
|
|
||||||
6
TODO.md
6
TODO.md
|
|
@ -11,12 +11,14 @@
|
||||||
x job title includes last pass/fail icon
|
x job title includes last pass/fail icon
|
||||||
x button to modify (copies to upsert form)
|
x button to modify (copies to upsert form)
|
||||||
x button to delete
|
x button to delete
|
||||||
|
1. last run with title
|
||||||
|
1. word wrap or truncate output
|
||||||
1. UI to mutate
|
1. UI to mutate
|
||||||
|
1. force run
|
||||||
x submit job
|
x submit job
|
||||||
x delete job
|
x delete job
|
||||||
x pause jobs
|
x pause jobs
|
||||||
1. interrupt job
|
1. interrupt job
|
||||||
1. force run
|
|
||||||
x JS
|
x JS
|
||||||
x ajax for json calls
|
x ajax for json calls
|
||||||
|
|
||||||
|
|
@ -25,6 +27,7 @@ x JS
|
||||||
x load from file
|
x load from file
|
||||||
1. interrupt running jobs
|
1. interrupt running jobs
|
||||||
1. json API
|
1. json API
|
||||||
|
1. force run
|
||||||
1. list
|
1. list
|
||||||
x last run output
|
x last run output
|
||||||
x last run pass/fail bool
|
x last run pass/fail bool
|
||||||
|
|
@ -35,7 +38,6 @@ x load from file
|
||||||
x disable job
|
x disable job
|
||||||
1. running job
|
1. running job
|
||||||
1. interrupt job
|
1. interrupt job
|
||||||
1. force run
|
|
||||||
1. change cron to load the full job from storage so not holding big queued jobs in ram
|
1. change cron to load the full job from storage so not holding big queued jobs in ram
|
||||||
x add optional second for test main
|
x add optional second for test main
|
||||||
1. test main
|
1. test main
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,7 @@ function format(job) {
|
||||||
var buttons = ""
|
var buttons = ""
|
||||||
var btns = [
|
var btns = [
|
||||||
{"name":"refresh", "icon":"8635"},
|
{"name":"refresh", "icon":"8635"},
|
||||||
{"name":"disable", "icon":"11035"},
|
{"name":"run", "icon":"9654"},
|
||||||
{"name":"enable", "icon":"9654"},
|
|
||||||
{"name":"modify", "icon":"9999"},
|
{"name":"modify", "icon":"9999"},
|
||||||
{"name":"delete", "icon":"10006"}
|
{"name":"delete", "icon":"10006"}
|
||||||
]
|
]
|
||||||
|
|
@ -118,6 +117,16 @@ function jobenable(input) {
|
||||||
getField("disabled").checked = false
|
getField("disabled").checked = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function jobrun(input) {
|
||||||
|
var job = jobFromInput(input)
|
||||||
|
function cb(body, status) {
|
||||||
|
if (status != 200) {
|
||||||
|
console.log("failed to run job: ", status, body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
http("GET", "/api/job/run/"+job.id, cb, null)
|
||||||
|
}
|
||||||
|
|
||||||
function jobmodify(input) {
|
function jobmodify(input) {
|
||||||
var form = getForm()
|
var form = getForm()
|
||||||
var job = jobFromInput(input)
|
var job = jobFromInput(input)
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,10 @@ func (s *Server) Routes() error {
|
||||||
path: fmt.Sprintf("/api/job/enable/%s", router.Wildcard),
|
path: fmt.Sprintf("/api/job/enable/%s", router.Wildcard),
|
||||||
handler: s.gzip(s.authenticate(s.enable)),
|
handler: s.gzip(s.authenticate(s.enable)),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: fmt.Sprintf("/api/job/run/%s", router.Wildcard),
|
||||||
|
handler: s.gzip(s.authenticate(s.run)),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: fmt.Sprintf("%s%s", wildcard, wildcard),
|
path: fmt.Sprintf("%s%s", wildcard, wildcard),
|
||||||
handler: s.gzip(s.authenticate(s.static)),
|
handler: s.gzip(s.authenticate(s.static)),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"local/firestormy/config"
|
||||||
|
"local/firestormy/config/ns"
|
||||||
|
"local/firestormy/scheduler"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (s *Server) run(w http.ResponseWriter, r *http.Request) {
|
||||||
|
keys := strings.Split(r.URL.Path, "/")
|
||||||
|
key := keys[len(keys)-1]
|
||||||
|
|
||||||
|
j := &scheduler.Job{}
|
||||||
|
b, err := config.Store.Get(key, ns.Jobs...)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := j.Decode(b); err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func() {
|
||||||
|
defer func() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
if er, ok := e.(error); ok {
|
||||||
|
err = er
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
j.Run()
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.Write([]byte("{}"))
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue