Did major database migration to Opensearch

This commit is contained in:
frikky
2021-05-20 20:57:52 +02:00
parent 79b2d83dd4
commit 1d559a403a
4 changed files with 853 additions and 121 deletions
+3
View File
@@ -20,6 +20,9 @@ require (
github.com/docker/docker v20.10.3-0.20210216175712-646072ed6524+incompatible github.com/docker/docker v20.10.3-0.20210216175712-646072ed6524+incompatible
github.com/docker/go-connections v0.4.0 github.com/docker/go-connections v0.4.0
github.com/docker/go-units v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect
github.com/elastic/go-elasticsearch v0.0.0 // indirect
github.com/elastic/go-elasticsearch/v7 v7.12.0 // indirect
github.com/elastic/go-elasticsearch/v8 v8.0.0-20210519083322-55daf7425ecb // indirect
github.com/frikky/kin-openapi v0.39.0 github.com/frikky/kin-openapi v0.39.0
github.com/frikky/shuffle-shared v0.0.40 github.com/frikky/shuffle-shared v0.0.40
github.com/fsouza/go-dockerclient v1.7.2 // indirect github.com/fsouza/go-dockerclient v1.7.2 // indirect
+6
View File
@@ -109,6 +109,12 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/elastic/go-elasticsearch v0.0.0 h1:Pd5fqOuBxKxv83b0+xOAJDAkziWYwFinWnBO0y+TZaA=
github.com/elastic/go-elasticsearch v0.0.0/go.mod h1:TkBSJBuTyFdBnrNqoPc54FN0vKf5c04IdM4zuStJ7xg=
github.com/elastic/go-elasticsearch/v7 v7.12.0 h1:j4tvcMrZJLp39L2NYvBb7f+lHKPqPHSL3nvB8+/DV+s=
github.com/elastic/go-elasticsearch/v7 v7.12.0/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4=
github.com/elastic/go-elasticsearch/v8 v8.0.0-20210519083322-55daf7425ecb h1:svC8T5+v+aWpWiTt3nsGfpdqVb4NIWK/WamGXXECBXA=
github.com/elastic/go-elasticsearch/v8 v8.0.0-20210519083322-55daf7425ecb/go.mod h1:xe9a/L2aeOgFKKgrO3ibQTnMdpAeL0GC+5/HpGScSa4=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+839 -116
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -660,7 +660,7 @@ func createSchedule(ctx context.Context, scheduleId, workflowId, name, startNode
// Doesn't need running/not running. If stopped, we just delete it. // Doesn't need running/not running. If stopped, we just delete it.
timeNow := int64(time.Now().Unix()) timeNow := int64(time.Now().Unix())
schedule := ScheduleOld{ schedule := shuffle.ScheduleOld{
Id: scheduleId, Id: scheduleId,
WorkflowId: workflowId, WorkflowId: workflowId,
StartNode: startNode, StartNode: startNode,
@@ -674,7 +674,7 @@ func createSchedule(ctx context.Context, scheduleId, workflowId, name, startNode
Environment: "onprem", Environment: "onprem",
} }
err = setSchedule(ctx, schedule) err = shuffle.SetSchedule(ctx, schedule)
if err != nil { if err != nil {
log.Printf("Failed to set schedule: %s", err) log.Printf("Failed to set schedule: %s", err)
return err return err
@@ -2828,7 +2828,7 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) {
} }
timeNow := int64(time.Now().Unix()) timeNow := int64(time.Now().Unix())
newSchedule := ScheduleOld{ newSchedule := shuffle.ScheduleOld{
Id: schedule.Id, Id: schedule.Id,
WorkflowId: workflow.ID, WorkflowId: workflow.ID,
StartNode: startNode, StartNode: startNode,
@@ -2842,7 +2842,7 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) {
Environment: "cloud", Environment: "cloud",
} }
err = setSchedule(ctx, newSchedule) err = shuffle.SetSchedule(ctx, newSchedule)
if err != nil { if err != nil {
log.Printf("Failed setting cloud schedule: %s", err) log.Printf("Failed setting cloud schedule: %s", err)
resp.WriteHeader(401) resp.WriteHeader(401)
@@ -3883,7 +3883,7 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string,
log.Printf("Added %s:%s to the database from OpenAPI repo", api.Name, api.AppVersion) log.Printf("Added %s:%s to the database from OpenAPI repo", api.Name, api.AppVersion)
// Set OpenAPI datastore // Set OpenAPI datastore
err = setOpenApiDatastore(ctx, parsedOpenApi.ID, parsedOpenApi) err = shuffle.SetOpenApiDatastore(ctx, parsedOpenApi.ID, parsedOpenApi)
if err != nil { if err != nil {
log.Printf("Failed uploading openapi to datastore in loop: %s", err) log.Printf("Failed uploading openapi to datastore in loop: %s", err)
continue continue