influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
28.93k stars 3.55k forks source link

alpha5: stuck at intial user setup after upgrading #12477

Closed andig closed 5 years ago

andig commented 5 years ago

I'm running alpha versions on docker:

influxdb:
    container_name: influxdb
    image: quay.io/influxdb/influxdb:2.0.0-alpha
    ports: 
    - 9999:9999
    volumes:
    - /volume1/data/docker/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro
    - /volume1/data/docker/influxdb:/var/lib/influxdb
    command: --reporting-disabled
    restart: always

After upgrading alpha 4 to 5 I'm stuck at the 2nd step of the login screen:

quay.io/influxdb/influxdb      2.0.0-alpha         48f2875eb7d9        13 hours ago        143MB
Screenshot 2019-03-09 at 10 41 03

Logs show that influx is running, but clients cant connect:

admin@NAS:~$ sudo docker logs influxdb
ts=2019-03-09T09:34:18.720212Z lvl=info msg="Welcome to InfluxDB" log_id=0E4Sh0O0000 version=2.0.0-alpha.5 commit=86613fa9b build_date=2019-03-08T20:37:54Z
ts=2019-03-09T09:34:18.801981Z lvl=info msg="Resources opened" log_id=0E4Sh0O0000 service=bolt path=/root/.influxdbv2/influxd.bolt
ts=2019-03-09T09:34:18.816282Z lvl=info msg="Opening Series File (start)" log_id=0E4Sh0O0000 service=storage-engine service=series-file trace_id=0E4Sh0l0000op_name=series_file_open path=/root/.influxdbv2/engine/_series op_event=start
ts=2019-03-09T09:34:18.870384Z lvl=info msg="Opening Series File (end)" log_id=0E4Sh0O0000 service=storage-engine service=series-file trace_id=0E4Sh0l0000 op_name=series_file_open path=/root/.influxdbv2/engine/_series op_event=end op_elapsed=54.108ms
ts=2019-03-09T09:34:18.922032Z lvl=info msg="Index opened" log_id=0E4Sh0O0000 service=storage-engine index=tsi partitions=8
ts=2019-03-09T09:34:18.922844Z lvl=info msg="Reloaded WAL" log_id=0E4Sh0O0000 service=storage-engine path=/root/.influxdbv2/engine/wal duration=0.048ms
ts=2019-03-09T09:34:18.922978Z lvl=info msg=Starting log_id=0E4Sh0O0000 service=storage-engine component=retention_enforcer check_interval=1h
ts=2019-03-09T09:34:19.297784Z lvl=info msg=Listening log_id=0E4Sh0O0000 service=http transport=http addr=:9999 port=9999

❯ docker run quay.io/influxdb/influxdb:2.0.0-alpha influx repl --host 'http://nas:9999'
Error: The instance at "http://nas:9999" has not been setup. Please run `influx setup` before issuing any additional commands.
Usage:

❯ docker run quay.io/influxdb/influxdb:2.0.0-alpha influx setup --host 'http://nas:9999'
Please type your primary username:
Please type your primary username:
Please type your primary username:
Please type your primary username:
Please type your primary username:

The last line keeps repeating. This is happening although alpha4 had bee successfully setup and running.

andig commented 5 years ago

Update: the same happens when starting with brand-new container and data/config cleaned:

docker run -d -p 9999:9999 quay.io/influxdb/influxdb:2.0.0-alpha
docker run --network=host quay.io/influxdb/influxdb:2.0.0-alpha influx setup
Please type your primary username:
Please type your primary username:
...
goller commented 5 years ago

@andig I tried to reproduce just now with:

docker run --name influxd -p 9999:9999 quay.io/influxdb/influxdb:2.0.0-alpha

and

docker exec -it influxd influx setup

docker exec -it influxd influx setup
Welcome to InfluxDB 2.0!
Please type your primary username: goller

Please type your password:

Please type your password again:

Please type your primary organization name: goller

Please type your primary bucket name: goller

Please type your retention period in hours.
Or press ENTER for infinite.:

You have entered:
  Username:          goller
  Organization:      goller
  Bucket:            goller
  Retention Period:  infinite
Confirm? (y/n): y

Your token has been stored in /root/.influxdbv2/credentials.
User    Organization    Bucket
goller  goller          goller

Perhaps it has something to do with localhost binding or --network=host.

Would you try how I did it with an exec into the container?

goller commented 5 years ago

Regarding the loop of username, here is the code:

310     for {
311         line, err := ui.Ask(prompt, option)
312         switch err {
313         case input.ErrInterrupted:
314             os.Exit(1)
315         default:
316             if line = strings.TrimSpace(line); line == "" {
317                 continue
318             }
319             return line
320         }
321     }

Certainly, there needs to be a case for the error being nil. The error is hidden behind the default switch case. I suspect what you are running into is that your

❯ docker run quay.io/influxdb/influxdb:2.0.0-alpha influx setup --host 'http://nas:9999'

needs -it to make it an interactive terminal. Try out -it.

There needs to be a check when err == nil then return the line.

andig commented 5 years ago

needs -it to make it an interactive terminal. Try out -it.

Oh dear, of course. The root problems remains though: fresh alpha 5 web UI doesn't offer setup steps as alpha 4 did, see screenshot in issue.

Furthermore, once setup has been run from command line instead of web UI, repl is unable to login:

❯ docker run quay.io/influxdb/influxdb:2.0.0-alpha influx setup --host 'http://nas:9999'
...

You have entered:
Username:          root
Organization:      org
Bucket:            volkszaehler
Retention Period:  infinite
Confirm? (y/n): y

Your token has been stored in /root/.influxdbv2/credentials.
User    Organization    Bucket
root    org             volkszaehler

❯ docker run quay.io/influxdb/influxdb:2.0.0-alpha influx repl --host 'http://nas:9999' --org org

Error: Unable to find organization: FindOrganization: <unauthorized> unauthorized access.
Usage:
influx repl [flags]

It feels I'm doing something horribly wrong but I can't find what?

goller commented 5 years ago

@andig I'll try to reproduce the web UI setup problems.

As for the repl giving you unauthorized access, that is because your docker setup is placing the credentials file inside the container. When you the repl you will have a different docker container that does not have that file.

You could volume mount /root/.influxdbv2 in both your influx setup and your influx repl to something on the docker host in order preserve the file.

Palakp41 commented 5 years ago

@andig when you were setting up, did you remove ~/.influxdbv2 directory or ~/.influxdbv2/influxd.bolt?

andig commented 5 years ago

No. I‘m using docker and see this behavior with a brand-new container wirhout any volumes mounted.

Palakp41 commented 5 years ago

@andig I was able to replicate this issue on my machine. It seemed like it was a scrollbar issue that wouldn't display the admin fields.

I updated my Chrome browser and after hard reload I was able to see all the admin fields.

Do you have the latest version of Chrome or the browser you are using?

bthesorceror commented 5 years ago

@andig can you provide what browser and OS you are using access the ui?

andig commented 5 years ago

I can confirm it works fine on chrome (sorry I didn't suspect this cause earlier- a4 worked just fine). The problems are with Safari on OSX.

andig commented 5 years ago

Closing in favour of #12551