Fixed bug in new version of opensearch

This commit is contained in:
frikky
2021-06-08 12:19:18 +02:00
parent 60eeebb210
commit 2e2769dabc
5 changed files with 20 additions and 20 deletions
+3 -3
View File
@@ -51,9 +51,9 @@ SHUFFLE_ELASTIC=true
# DATABASE CONFIGURATIONS # DATABASE CONFIGURATIONS
DATASTORE_EMULATOR_HOST=shuffle-database:8000 DATASTORE_EMULATOR_HOST=shuffle-database:8000
SHUFFLE_OPENSEARCH_URL=http://shuffle-opensearch:9200 SHUFFLE_OPENSEARCH_URL=https://shuffle-opensearch:9200
SHUFFLE_OPENSEARCH_USERNAME= SHUFFLE_OPENSEARCH_USERNAME=admin
SHUFFLE_OPENSEARCH_PASSWORD= SHUFFLE_OPENSEARCH_PASSWORD=admin
SHUFFLE_OPENSEARCH_CERTIFICATE_FILE= SHUFFLE_OPENSEARCH_CERTIFICATE_FILE=
SHUFFLE_OPENSEARCH_APIKEY= SHUFFLE_OPENSEARCH_APIKEY=
SHUFFLE_OPENSEARCH_CLOUDID= SHUFFLE_OPENSEARCH_CLOUDID=
+2 -2
View File
@@ -2,7 +2,7 @@ module shuffle
go 1.13 go 1.13
replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared //replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
@@ -24,7 +24,7 @@ require (
github.com/elastic/go-elasticsearch/v7 v7.12.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/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.57 github.com/frikky/shuffle-shared v0.0.60
github.com/fsouza/go-dockerclient v1.7.2 // indirect github.com/fsouza/go-dockerclient v1.7.2 // indirect
github.com/ghodss/yaml v1.0.0 github.com/ghodss/yaml v1.0.0
github.com/go-git/go-billy/v5 v5.0.0 github.com/go-git/go-billy/v5 v5.0.0
+9 -9
View File
@@ -3082,7 +3082,7 @@ func verifySwagger(resp http.ResponseWriter, request *http.Request) {
return return
} }
log.Printf("[INFO] TRY TO SET APP TO LIVE!!!") //log.Printf("[INFO] TRY TO SET APP TO LIVE!!!")
user, err := shuffle.HandleApiAuthentication(resp, request) user, err := shuffle.HandleApiAuthentication(resp, request)
if err != nil { if err != nil {
log.Printf("Api authentication failed in verify swagger: %s", err) log.Printf("Api authentication failed in verify swagger: %s", err)
@@ -3136,7 +3136,7 @@ func verifySwagger(resp http.ResponseWriter, request *http.Request) {
return return
} }
log.Printf("[INFO] EDITING APP WITH ID %s and md5 %s", app.ID, newmd5) log.Printf("[INFO] %s is EDITING APP WITH ID %s and md5 %s", user.Id, app.ID, newmd5)
newmd5 = app.ID newmd5 = app.ID
} }
@@ -3944,9 +3944,9 @@ func runInitEs(ctx context.Context) {
schedules, err := shuffle.GetAllSchedules(ctx, "ALL") schedules, err := shuffle.GetAllSchedules(ctx, "ALL")
if err != nil { if err != nil {
log.Printf("Failed getting schedules during service init: %s", err) log.Printf("[WARNING] Failed getting schedules during service init: %s", err)
} else { } else {
log.Printf("Setting up %d schedule(s)", len(schedules)) log.Printf("[INFO] Setting up %d schedule(s)", len(schedules))
url := &url.URL{} url := &url.URL{}
for _, schedule := range schedules { for _, schedule := range schedules {
if schedule.Environment == "cloud" { if schedule.Environment == "cloud" {
@@ -3983,7 +3983,7 @@ func runInitEs(ctx context.Context) {
users, err := shuffle.GetAllUsers(ctx) users, err := shuffle.GetAllUsers(ctx)
if len(users) == 0 { if len(users) == 0 {
log.Printf("Trying to set up user based on environments SHUFFLE_DEFAULT_USERNAME & SHUFFLE_DEFAULT_PASSWORD") log.Printf("[INFO] Trying to set up user based on environments SHUFFLE_DEFAULT_USERNAME & SHUFFLE_DEFAULT_PASSWORD")
username := os.Getenv("SHUFFLE_DEFAULT_USERNAME") username := os.Getenv("SHUFFLE_DEFAULT_USERNAME")
password := os.Getenv("SHUFFLE_DEFAULT_PASSWORD") password := os.Getenv("SHUFFLE_DEFAULT_PASSWORD")
if len(username) == 0 || len(password) == 0 { if len(username) == 0 || len(password) == 0 {
@@ -4005,7 +4005,7 @@ func runInitEs(ctx context.Context) {
} }
_ = setUsers _ = setUsers
log.Printf("Starting cloud schedules for orgs!") log.Printf("[INFO] Starting cloud schedules for orgs if enabled!")
type requestStruct struct { type requestStruct struct {
ApiKey string `json:"api_key"` ApiKey string `json:"api_key"`
} }
@@ -4023,7 +4023,7 @@ func runInitEs(ctx context.Context) {
continue continue
} }
log.Printf("Should start schedule for org %s", org.Name) log.Printf("[DEBUG] Should start schedule for org %s", org.Name)
job := func() { job := func() {
err := remoteOrgJobHandler(org, interval) err := remoteOrgJobHandler(org, interval)
if err != nil { if err != nil {
@@ -4614,7 +4614,7 @@ func runInit(ctx context.Context) {
continue continue
} }
log.Printf("Should start schedule for org %s", org.Name) log.Printf("[DEBUG] Should start schedule for org %s", org.Name)
job := func() { job := func() {
err := remoteOrgJobHandler(org, interval) err := remoteOrgJobHandler(org, interval)
if err != nil { if err != nil {
@@ -5568,7 +5568,7 @@ func initHandlers() {
for { for {
_, err = shuffle.RunInit(*dbclient, *es, storage.Client{}, gceProject, "onprem", true, elasticConfig) _, err = shuffle.RunInit(*dbclient, *es, storage.Client{}, gceProject, "onprem", true, elasticConfig)
if err != nil { if err != nil {
log.Printf("[DEBUG] Error in initial database connection. Retrying in 5 seconds. %s", err) log.Printf("[ERROR] Error in initial database connection. Retrying in 5 seconds. %s", err)
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
continue continue
} }
+4 -4
View File
@@ -1,7 +1,7 @@
version: '3' version: '3'
services: services:
frontend: frontend:
build: ./frontend #build: ./frontend
image: ghcr.io/frikky/shuffle-frontend:nightly image: ghcr.io/frikky/shuffle-frontend:nightly
container_name: shuffle-frontend container_name: shuffle-frontend
hostname: shuffle-frontend hostname: shuffle-frontend
@@ -16,7 +16,7 @@ services:
depends_on: depends_on:
- backend - backend
backend: backend:
build: ./backend #build: ./backend
image: ghcr.io/frikky/shuffle-backend:nightly image: ghcr.io/frikky/shuffle-backend:nightly
container_name: shuffle-backend container_name: shuffle-backend
hostname: ${BACKEND_HOSTNAME} hostname: ${BACKEND_HOSTNAME}
@@ -66,14 +66,14 @@ services:
- CLEANUP=${SHUFFLE_CONTAINER_AUTO_CLEANUP} - CLEANUP=${SHUFFLE_CONTAINER_AUTO_CLEANUP}
restart: unless-stopped restart: unless-stopped
opensearch: opensearch:
image: opensearchproject/opensearch:latest image: opensearchproject/opensearch:1.0.0-rc1
hostname: shuffle-opensearch hostname: shuffle-opensearch
container_name: shuffle-opensearch container_name: shuffle-opensearch
environment: environment:
- bootstrap.memory_lock=true - bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms1024m -Xmx1024m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM - "OPENSEARCH_JAVA_OPTS=-Xms1024m -Xmx1024m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
- opendistro_security.disabled=true
- discovery.seed_hosts=shuffle-opensearch - discovery.seed_hosts=shuffle-opensearch
- cluster.routing.allocation.disk.threshold_enabled=false
ulimits: ulimits:
memlock: memlock:
soft: -1 soft: -1
@@ -1,11 +1,11 @@
curl -XPUT http://localhost:9200/_cluster/settings -H "Content-Type:application/json" -d \ curl -XPUT -u admin:admin https://localhost:9200/_cluster/settings -H "Content-Type:application/json" -k -d \
'{ '{
"transient": { "transient": {
"cluster.routing.allocation.disk.threshold_enabled": false "cluster.routing.allocation.disk.threshold_enabled": false
} }
}' }'
curl -XPUT http://localhost:9200/_all/_settings -H "Content-Type: application/json" -d \ curl -XPUT -u admin:admin https://localhost:9200/_all/_settings -H "Content-Type: application/json" -k -d \
'{ '{
"index.blocks.read_only_allow_delete": null "index.blocks.read_only_allow_delete": null
}' }'