Enable readonly mode Elastic workplace search on docker desktop

Hi,
I am trying to setup a POC of elastic enterprise workplace search on my docker desktop. I am able to successfully setup the Elasticsearch. The workplace search container is able to connect. However, it says there is a number of migrations that need to happen and needs to be set to read-only mode. Then the enterprise search container exits with code 1 before I can run any commands or access the container.

I tried setting readonly mode in the docker compose file, but that doesnt work. I tried downgrading to 7.9.3 from 7.10.2 based on a post i found, but that doesnt help as well. This is a fresh installation and i dont care about any indexes, so not sure what needs migration here.

workplacesearch | [2021-01-26T21:02:04.421+00:00][1][2002][app-server][INFO]: Enterprise Search version=7.10.2, JRuby version=9.2.9.0, Ruby version=2.5.7, Rails version=4.2.11.3

workplacesearch | [2021-01-26T21:02:04.457+00:00][1][2002][app-server][INFO]: Performing pre-flight checks for Elasticsearch running on http://elasticsearch:9200...

workplacesearch | [2021-01-26T21:02:05.780+00:00][1][2002][app-server][INFO]: [pre-flight] Successfully connected to Elasticsearch

workplacesearch | [2021-01-26T21:02:05.951+00:00][1][2002][app-server][INFO]: [pre-flight] Successfully loaded Elasticsearch plugin information for all nodes

workplacesearch | [2021-01-26T21:02:06.085+00:00][1][2002][app-server][INFO]: [pre-flight] Elasticsearch running with an active basic license

workplacesearch | [2021-01-26T21:02:06.157+00:00][1][2002][app-server][INFO]: [pre-flight] Elasticsearch API key service is enabled

workplacesearch | [2021-01-26T21:02:06.159+00:00][1][2002][app-server][INFO]: [pre-flight] ILM is enabled in Elasticsearch

workplacesearch | [2021-01-26T21:02:06.173+00:00][1][2002][app-server][INFO]: Elasticsearch looks healthy and configured correctly to run Enterprise Search

elasticsearch | {"type": "server", "timestamp": "2021-01-26T21:02:08,430Z", "level": "INFO", "component": "o.e.c.r.a.AllocationService", "cluster.name": "app-search-docker-cluster", "node.name": "es-node", "message": "Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[ilm-history-3-000001][0], [.ent-search-actastic-clusters][0], [.ent-search-actastic-togo_migrations_v1][0]]]).", "cluster.uuid": "jM4lZUq3QqizvRBZkxoATw", "node.id": "KNbyaMI4QneGNHlSPgsDqA" }

workplacesearch | [2021-01-26T21:02:27.868+00:00][1][2002][app-server][INFO]: [db_lock] [installation] Status: [Starting] Ensuring migrations tracking index exists

workplacesearch | [2021-01-26T21:02:28.061+00:00][1][2002][app-server][INFO]: [db_lock] [installation] Status: [Finished] Ensuring migrations tracking index exists

workplacesearch | [2021-01-26T21:02:29.589+00:00][1][2002][app-server][ERROR]:

workplacesearch | --------------------------------------------------------------------------------

workplacesearch |

workplacesearch | We need to perform 41/42 migrations before the service can be started.

workplacesearch | Migrations pending: 20191128005459, 20191229125356, 20200106175000, 20200110195000, 20200111194400, 20200117203813, 20200123204201, 20200315184305, 20200320112905, 20200321012851, 20200323103800, 20200324050123, 20200331143437, 20200401124700, 20200407185805, 20200413173514, 20200422141505, 20200424000000, 20200512150416, 20200515000015, 20200604175830, 20200610113647, 20200611093100, 20200612155336, 20200617164710, 20200617210501, 20200623134305, 20200624153999, 20200709120000, 20200717204953, 20200723200724, 20200804130700, 20200812161600, 20200819161200, 20200820160000, 20200908160000, 20200909083401, 20200922121556, 20200923160000, 20200928151001, 20201001000000

workplacesearch |

workplacesearch | Proceeding with migrations while indices are allowing writes can have unintended consequences.

workplacesearch | Please enable read-only mode before proceeding:

workplacesearch | Read-only mode | Elastic Enterprise Search documentation [8.4] | Elastic

workplacesearch |

workplacesearch |

workplacesearch | --------------------------------------------------------------------------------

workplacesearch |

workplacesearch |

workplacesearch exited with code 1

Hey @Prasanna_K!

Sorry for your problem and the confusion. Elastic Enterprise Search is built on Ruby On Rails, and uses an Elasticsearch-backed variant of Active Record. The "migrations" its running don't necessarily have any data in them, but might just be updating indexes, schemas, and mappings. Like an SQL migration to add a column (even if the table is empty).

You can read about our migrations and upgrading here: Upgrading self-managed deployments | Enterprise Search documentation [8.11] | Elastic

You have a couple of options here.

If that's the case, you should be able to delete all Enterprise Search indexes with:

curl -X DELETE elastic:changeme@localhost:9200/.ent-search-*

(modified for your elasticsearch credentials, host, and port, of course). Starting Enterprise Search from a "fresh" elasticsearch shouldn't require Read Only Mode.

I haven't personally tried that approach, myself. When I need to enable or disable Read Only Mode on my docker setup, I use the --enable-read-only-mode and --disable-read-only-mode CLI args in my docker invocation. For example:

docker pull docker.elastic.co/enterprise-search/enterprise-search:7.10.2
docker stop workplace
docker rm workplace
docker run -p 3002:3002 --name=workplace \
-e elasticsearch.host='http://host.docker.internal:9200' \
-e elasticsearch.username=elastic \
-e elasticsearch.password=changeme \
-e allow_es_settings_modification=true \
-e secret_management.encryption_keys='[4a2cd3f81d39bf28738c10db0ca782095ffac07279561809eecc722e0c20eb09]' \
-e ENT_SEARCH_DEFAULT_PASSWORD=changeme \
-e ent_search.listen_port=3002 \
-e ent_search.external_url='http://localhost:3002' \
docker.elastic.co/enterprise-search/enterprise-search:7.10.2 --enable-read-only-mode

If that doesn't help, let us know exactly what commands you're running, and we'll see if we can't get you sorted. :slight_smile:

HI Sean, Thank you very much for your response. I had a similar setup, but moved it into a docker compose as enterprise search wouldnt connect to elasticsearch. I just found out that it has a problem when i use "http://localhost:9200" and worked when i used the ip address instead.

Good news is that I was able to make progress with the command you provided. However, the container still exits with code 0 once the readonly mode is enabled. I am not sure why.

Found java executable in PATH

Java version detected: 1.8.0_252 (major version: 8)

Enterprise Search is starting...

[2021-01-28T21:02:13.758+00:00][1][2002][script][INFO]: Enterprise Search version=7.10.2, JRuby version=9.2.9.0, Ruby version=2.5.7, Rails version=4.2.11.3

[2021-01-28T21:02:13.774+00:00][1][2002][script][INFO]: Performing pre-flight checks for Elasticsearch running on http://192.168.1.194:9200...

[2021-01-28T21:02:14.388+00:00][1][2002][script][INFO]: [pre-flight] Successfully connected to Elasticsearch

[2021-01-28T21:02:14.449+00:00][1][2002][script][INFO]: [pre-flight] Successfully loaded Elasticsearch plugin information for all nodes

[2021-01-28T21:02:14.509+00:00][1][2002][script][INFO]: [pre-flight] Elasticsearch running with an active basic license

[2021-01-28T21:02:14.564+00:00][1][2002][script][INFO]: [pre-flight] Elasticsearch API key service is enabled

[2021-01-28T21:02:14.569+00:00][1][2002][script][INFO]: [pre-flight] ILM is enabled in Elasticsearch

[2021-01-28T21:02:14.576+00:00][1][2002][script][INFO]: Elasticsearch looks healthy and configured correctly to run Enterprise Search

[2021-01-28T21:02:37.049+00:00][1][2002][script][INFO]: Enabling read-only mode for the product!

[2021-01-28T21:02:37.115+00:00][1][2002][script][INFO]: Loaded a new read-only flag value from Elasticsearch: true

[2021-01-28T21:02:37.118+00:00][1][2002][script][INFO]: *** Read-only mode has been enabled! ***

Yep, that's expected! Then you can run without the --enable-read-only-mode and your server will start and not immediately exit. Barring unexpected issues :sweat_smile: .

This feels extra verbose in docker. With a tarball installation, this would be like:

$ bin/enterprise-search --enable-read-only-mode
$ nohup bin/enterprise-search > server.log & # starts the server
$ # wait for the migrations to complete
$ bin/enterprise-search --disable-read-only-mode

I am unfortunately stuck trying to run this on my windows machine with a docker desktop. I will run it on a linux VM if this exercise doesn't pan out.

I ran without the --enable-read-only-mode and I get this error below:

Java version detected: 1.8.0_252 (major version: 8)
Enterprise Search is starting...
[2021-01-28T23:10:00.307+00:00][1][2002][app-server][INFO]: Enterprise Search version=7.10.2, JRuby version=9.2.9.0, Ruby version=2.5.7, Rails version=4.2.11.3
[2021-01-28T23:10:00.320+00:00][1][2002][app-server][INFO]: Performing pre-flight checks for Elasticsearch running on http://192.168.1.194:9200...
[2021-01-28T23:10:00.918+00:00][1][2002][app-server][INFO]: [pre-flight] Successfully connected to Elasticsearch
[2021-01-28T23:10:00.965+00:00][1][2002][app-server][INFO]: [pre-flight] Successfully loaded Elasticsearch plugin information for all nodes
[2021-01-28T23:10:01.017+00:00][1][2002][app-server][INFO]: [pre-flight] Elasticsearch running with an active basic license
[2021-01-28T23:10:01.056+00:00][1][2002][app-server][INFO]: [pre-flight] Elasticsearch API key service is enabled
[2021-01-28T23:10:01.059+00:00][1][2002][app-server][INFO]: [pre-flight] ILM is enabled in Elasticsearch
[2021-01-28T23:10:01.066+00:00][1][2002][app-server][INFO]: Elasticsearch looks healthy and configured correctly to run Enterprise Search
[2021-01-28T23:10:29.256+00:00][1][2002][app-server][INFO]: Loaded a new read-only flag value from Elasticsearch: true
[2021-01-28T23:10:29.262+00:00][1][2002][app-server][INFO]: Disabling read-only mode for indices: .ent-search-actastic-togo_migrations_v1
[2021-01-28T23:10:29.383+00:00][1][2002][app-server][INFO]: [db_lock] [installation] Status: [Starting] Ensuring migrations tracking index exists
[2021-01-28T23:10:29.490+00:00][1][2002][app-server][INFO]: [db_lock] [installation] Status: [Finished] Ensuring migrations tracking index exists
[2021-01-28T23:10:32.290+00:00][1][2002][app-server][INFO]: Creating/updating Enterprise Search indices
[2021-01-28T23:10:32.293+00:00][1][2002][app-server][INFO]: [db_lock] [installation] Status: [Starting] Applying Actastic Migration:
[2021-01-28T23:10:33.105+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:33.224+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:33.486+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:33.559+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:33.608+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:33.666+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:33.771+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:33.824+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:33.882+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:33.922+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:33.962+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:34.003+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:34.067+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:34.115+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:34.201+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:34.298+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:34.406+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:34.513+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:34.653+00:00][1][2002][app-server][WARN]: Index .ent-search-actastic-engines_v3-key-unique-constraint already exists!
[2021-01-28T23:10:34.906+00:00][1][2002][app-server][WARN]: Going to re-create the existing empty index .ent-search-actastic-engines_v3-key-unique-constraint
[2021-01-28T23:10:34.973+00:00][1][2002][app-server][ERROR]: Retried index creation for index .ent-search-actastic-engines_v3-key-unique-constraint too many times (11). Giving up...
[2021-01-28T23:10:34.976+00:00][1][2002][app-server][INFO]: [db_lock] [installation] Status: [Failed] Applying Actastic Migration: : Error = Actastic::Schema::IndexCreationRetryError: Failed to create index .ent-search-actastic-engines_v3-key-unique-constraint after 11 attempts!
Unexpected exception while running Enterprise Search:
Error: Failed to create index .ent-search-actastic-engines_v3-key-unique-constraint after 11 attempts! at /usr/share/enterprise-search/lib/war/lib/actastic/schema.class:282:in ensure_es_index_with_retries' /usr/share/enterprise-search/lib/war/lib/actastic/schema.class:189:in block in create_unique_constraint_indices!'
org/jruby/RubyHash.java:1469:in each_value' /usr/share/enterprise-search/lib/war/lib/actastic/schema.class:188:in create_unique_constraint_indices!'
/usr/share/enterprise-search/lib/war/lib/actastic/schema.class:204:in create_index_and_mapping!' /usr/share/enterprise-search/lib/war/shared_togo/app/models/shared_togo/migration.class:54:in migrate'
/usr/share/enterprise-search/lib/war/shared_togo/db/migrate/20191128005459_add_meta_engines.class:4:in up' /usr/share/enterprise-search/lib/war/shared_togo/app/models/shared_togo/migration.class:13:in run'
/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo.class:880:in block in apply_actastic_migrations' /usr/share/enterprise-search/lib/war/lib/db_lock.class:182:in with_status'
/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo.class:879:in block in apply_actastic_migrations' org/jruby/RubyArray.java:1814:in each'
/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo.class:878:in apply_actastic_migrations' /usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo.class:379:in block in install!'
/usr/share/enterprise-search/lib/war/lib/db_lock.class:171:in with_lock' /usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo.class:369:in install!'
/usr/share/enterprise-search/lib/war/config/application.class:80:in block in Application' /usr/share/enterprise-search/lib/war/gems/gems/activesupport-4.2.11.3/lib/active_support/lazy_load_hooks.rb:36:in execute_hook'
/usr/share/enterprise-search/lib/war/gems/gems/activesupport-4.2.11.3/lib/active_support/lazy_load_hooks.rb:45:in block in run_load_hooks' org/jruby/RubyArray.java:1814:in each'
/usr/share/enterprise-search/lib/war/gems/gems/activesupport-4.2.11.3/lib/active_support/lazy_load_hooks.rb:44:in run_load_hooks' /usr/share/enterprise-search/lib/war/gems/gems/railties-4.2.11.3/lib/rails/application/finisher.rb:62:in block in Finisher'
org/jruby/RubyBasicObject.java:2680:in instance_exec' /usr/share/enterprise-search/lib/war/gems/gems/railties-4.2.11.3/lib/rails/initializable.rb:30:in run'
/usr/share/enterprise-search/lib/war/gems/gems/railties-4.2.11.3/lib/rails/initializable.rb:55:in block in run_initializers' uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/tsort.rb:228:in block in tsort_each'
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/tsort.rb:350:in block in each_strongly_connected_component' uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/tsort.rb:431:in each_strongly_connected_component_from'
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/tsort.rb:349:in block in each_strongly_connected_component' org/jruby/RubyArray.java:1814:in each'
org/jruby/RubyMethod.java:132:in call' uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/tsort.rb:347:in each_strongly_connected_component'
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/tsort.rb:226:in tsort_each' uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/tsort.rb:205:in tsort_each'
/usr/share/enterprise-search/lib/war/gems/gems/railties-4.2.11.3/lib/rails/initializable.rb:54:in run_initializers' /usr/share/enterprise-search/lib/war/gems/gems/railties-4.2.11.3/lib/rails/application.rb:352:in initialize!'
org/jruby/RubyKernel.java:1974:in public_send' /usr/share/enterprise-search/lib/war/gems/gems/railties-4.2.11.3/lib/rails/railtie.rb:194:in method_missing'
/usr/share/enterprise-search/lib/war/config/environment.class:7:in <main>' org/jruby/RubyKernel.java:1020:in load'
/usr/share/enterprise-search/lib/war/gems/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:268:in block in load' /usr/share/enterprise-search/lib/war/gems/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:240:in load_dependency'
/usr/share/enterprise-search/lib/war/gems/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:268:in load' /usr/share/enterprise-search/lib/war/config/environment.rb:1:in '
org/jruby/RubyKernel.java:978:in require' /usr/share/enterprise-search/lib/war/gems/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in block in require'
/usr/share/enterprise-search/lib/war/gems/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:240:in load_dependency' /usr/share/enterprise-search/lib/war/gems/gems/activesupport-4.2.11.3/lib/active_support/dependencies.rb:274:in require'
/usr/share/enterprise-search/lib/war/gems/gems/railties-4.2.11.3/lib/rails/application.rb:328:in require_environment!' /usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli/command.class:37:in initialize'
/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli/app_server_command.class:42:in initialize' /usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli/command.class:10:in run_and_exit'
/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli.class:143:in run_supported_command' /usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli.class:125:in run_command'
/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli.class:112:in run!' bin/enterprise-search-internal:15:in '

This seems like the relevant issue. Are you starting up multiple Enterprise Search servers at once, or just one?

It's possible that in your first few attempts you accidentally got your Elasticsearch indexes into a bad state. If you're only starting one server (to start, to run the migrations by itself) and hitting this error, I'd recommend wiping your enterprise search indexes in your Elasticsearch cluster, and starting fresh. You can delete them with:

curl -X DELETE elastic:changeme@localhost:9200/.ent-search-*

I didn't catch this earlier, but it's not supported to downgrade if you aren't restoring your elasticsearch indexes from a snapshot, or deleting all your indexes to start fresh. This may be what caused this issue. If you're still trying to run 7.9.3, switching back to 7.10.2 may resolve the problem.

@Sean_Story , Thank you for your help... You are awesome ! :partying_face: I got it working !!

I have an issue logging into enterprise search though. I have used the setup and commands as discussed, but the login doesnt work. Says username or password is incorrect. I have tried with both localhost and IP address.

username: enterprise_search
password: mypassword

this is my enterprise_search.yml

allow_es_settings_modification: true
elasticsearch.host: http://MyIpaddress:9200
elasticsearch.password: xxxx
elasticsearch.username: elastic
ent_search.auth.source: standard
ent_search.external_url: http://MyIpaddress:3002
ent_search.listen_host: 0.0.0.0
ent_search.listen_port: 3002
filebeat_log_directory: /var/log/enterprise-search
log_directory: /var/log/enterprise-search
secret_management.encryption_keys: [4a2cd3f81d39bf28738c10db0ca782095ffac07279561809eecc722e0c20eb09]

This is what I see in the app_server.log :
[2021-01-29T15:21:20.037+00:00][1][2562][action_controller][INFO]: [f0fa42c8-2348-4c4c-a2b0-092ccd748939] Parameters: {"auth_strategy"=>"password", "user"=>{"email"=>"enterprise_search", "password"=>"[FILTERED]"}, "host"=>"MyIpaddress:3002", "protocol"=>"http"}
[2021-01-29T15:21:20.088+00:00][1][2562][action_view][INFO]: [f0fa42c8-2348-4c4c-a2b0-092ccd748939] Rendered text template (0.1ms)
[2021-01-29T15:21:20.089+00:00][1][2562][action_controller][INFO]: [f0fa42c8-2348-4c4c-a2b0-092ccd748939] Completed 403 Forbidden in 51ms (Views: 1.9ms)

1 Like

Yay!!

This is a common problem. The very first time you launch Enterprise Search, it looks for an environment variable, ENT_SEARCH_DEFAULT_PASSWORD. I saw in one of your earlier posts that you were launching with it, but if you ever tried previously without it, Enterprise Search will have generated you a random password, and printed it in the logs, an future runs, it will have kept this random password, and not the one provided in ENT_SEARCH_DEFAULT_PASSWORD.

It's easy to reset the password. for docker, the command I use is:

docker run -p 3002:3002 --name=workplace \
-e elasticsearch.host='http://host.docker.internal:9200' \
-e elasticsearch.username=elastic \
-e elasticsearch.password=changeme \
-e allow_es_settings_modification=true \
-e secret_management.encryption_keys='[4a2cd3f81d39bf28738c10db0ca782095ffac07279561809eecc722e0c20eb09]' \
-e ENT_SEARCH_DEFAULT_PASSWORD=changeme \
-e ent_search.listen_port=3002 \
-e ent_search.external_url='http://localhost:3002' \
docker.elastic.co/enterprise-search/enterprise-search:7.10.2 --reset-auth

Running that will set the password for the enterprise_search user to be the value of ENT_SEARCH_DEFAULT_PASSWORD.

[quote="Sean_Story, post:8, topic:262545"]

docker run -p 3002:3002 --name=workplace \
-e elasticsearch.host='http://host.docker.internal:9200' \
-e elasticsearch.username=elastic \
-e elasticsearch.password=changeme \
-e allow_es_settings_modification=true \
-e secret_management.encryption_keys='[4a2cd3f81d39bf28738c10db0ca782095ffac07279561809eecc722e0c20eb09]' \
-e ENT_SEARCH_DEFAULT_PASSWORD=changeme \
-e ent_search.listen_port=3002 \
-e ent_search.external_url='http://localhost:3002' \
docker.elastic.co/enterprise-search/enterprise-search:7.10.2 --reset-auth

[/quote

I just tried the --reset-auth option @Sean_Story , it looks to reset and throws out the following exception. I have deleted all the previous containers just to be sure.

[2021-01-29T21:28:04.040+00:00][1][2002][script][INFO]: Elasticsearch looks healthy and configured correctly to run Enterprise Search
This operation will reset the password of the default user: enterprise_search.
Please confirm that you would like to continue [y/N]:Unexpected exception while running Enterprise Search:
Error: Inappropriate ioctl for device - tcgetattr at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/io/console/native_console.rb:16:in ttymode' uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/io/console/native_console.rb:31:in ttymode_yield'
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/io/console/native_console.rb:61:in cooked' /usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo.class:1061:in ask_for_confirmation'
/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli/reset_auth_command.class:38:in maybe_reset_password_for_default_user' /usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli/reset_auth_command.class:14:in run'
/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli/command.class:10:in run_and_exit' /usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli.class:143:in run_supported_command'
/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli.class:125:in run_command' /usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli.class:112:in run!'
bin/enterprise-search-internal:15:in `'

ah shoot, that's my bad. This command issues a prompt, and expects you to confirm or cancel ([y/N]). But docker, by default, doesn't launch containers such that they can handle interactive prompts. To make that work, you have to add a -it (interactive, TTY) to your docker command.

So the full command:

docker run -it -p 3002:3002 --name=workplace \
-e elasticsearch.host='http://host.docker.internal:9200' \
-e elasticsearch.username=elastic \
-e elasticsearch.password=changeme \
-e allow_es_settings_modification=true \
-e secret_management.encryption_keys='[4a2cd3f81d39bf28738c10db0ca782095ffac07279561809eecc722e0c20eb09]' \
-e ENT_SEARCH_DEFAULT_PASSWORD=changeme \
-e ent_search.listen_port=3002 \
-e ent_search.external_url='http://localhost:3002' \
docker.elastic.co/enterprise-search/enterprise-search:7.10.2 --reset-auth

Give that a go?

@Sean_Story , I managed to get it working !!

I started the container without the --reset-auth option.

I then ssh'd into the container and ran the command from the console and it worked to reset the password to the ENT_SEARCH_DEFAULT_PASSWORD value that was already set in the environment during initialization !!

sh-4.4$ ./enterprise-search --reset-auth
Found java executable in PATH
Java version detected: 1.8.0_252 (major version: 8)
Enterprise Search is starting...
[2021-01-29T21:51:54.372+00:00][166][2002][script][INFO]: Enterprise Search version=7.10.2, JRuby version=9.2.9.0, Ruby version=2.5.7, Rails version=4.2.11.3
[2021-01-29T21:51:54.383+00:00][166][2002][script][INFO]: Performing pre-flight checks for Elasticsearch running on http://192.168.1.194:9200...
[2021-01-29T21:51:54.854+00:00][166][2002][script][INFO]: [pre-flight] Successfully connected to Elasticsearch
[2021-01-29T21:51:54.892+00:00][166][2002][script][INFO]: [pre-flight] Successfully loaded Elasticsearch plugin information for all nodes
[2021-01-29T21:51:54.930+00:00][166][2002][script][INFO]: [pre-flight] Elasticsearch running with an active basic license
[2021-01-29T21:51:54.995+00:00][166][2002][script][INFO]: [pre-flight] Elasticsearch API key service is enabled
[2021-01-29T21:51:54.997+00:00][166][2002][script][INFO]: [pre-flight] ILM is enabled in Elasticsearch
[2021-01-29T21:51:55.001+00:00][166][2002][script][INFO]: Elasticsearch looks healthy and configured correctly to run Enterprise Search
This operation will reset the password of the default user: enterprise_search.
Please confirm that you would like to continue [y/N]:y
*** User credentials have been reset! username: enterprise_search, password: MyPassword ***

Thanks again for your help . Now my actual adventure of trying out workplace search starts !

1 Like

That's much neater :). I will give that a go now

@Sean_Story - that worked ! Thanks for all your help.

1 Like

Yay! Glad it's all working! Good luck with Workplace Search, and don't hesitate to file another discuss post if you run into anything else! :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.