Skip to content

Commit

Permalink
fix: switch port to 8086
Browse files Browse the repository at this point in the history
fix(readme): update the port and setup
  • Loading branch information
stuartcarnie committed Sep 3, 2020
1 parent 50237d9 commit 7964f86
Show file tree
Hide file tree
Showing 43 changed files with 165 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:
node --version && npm --version
docker --version
google-chrome --version && which google-chrome && chromedriver --version && which chromedriver
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9999)" != "200" ]]; do sleep 5; done' || false
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8086)" != "200" ]]; do sleep 5; done' || false
- run:
name: Selenium tests
command: |
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Ideally, test cases would be in the form of `curl` commands.
For example:
```bash
# write data
curl -XPOST "http://localhost:9999/api/v2/write?org=YOUR_ORG&bucket=YOUR_BUCKET&precision=s" \
curl -XPOST "http://localhost:8086/api/v2/write?org=YOUR_ORG&bucket=YOUR_BUCKET&precision=s" \
--header "Authorization: Token YOURAUTHTOKEN" \
--data-raw "mem,host=host1 used_percent=23.43234543 1556896326"

# query data
# Bug: expected it to return no data, but data comes back.
curl http://localhost:9999/api/v2/query?org=my-org -XPOST -sS \
curl http://localhost:8086/api/v2/query?org=my-org -XPOST -sS \
-H 'Authorization: Token YOURAUTHTOKEN' \
-H 'Accept: application/csv' \
-H 'Content-type: application/vnd.flux' \
Expand Down
4 changes: 2 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cd ui
yarn && yarn start
```

If there are no errors, hit [localhost:8080](http://localhost:8080) and follow the prompts to setup your username and password. *Note the port difference: `8080` vs the production `9999`*
If there are no errors, hit [localhost:8080](http://localhost:8080) and follow the prompts to setup your username and password. *Note the port difference: `8080` vs the production `8086`*

You're set up to develop Influx locally. Any changes you make to front-end code under the `ui/` directory will be updated after the watcher process (that was initiated by running `yarn start`) sees them and rebuilds the bundle. Any changes to go code will need to be re-compiled by re-running the `go run` command above.

Expand All @@ -65,7 +65,7 @@ Tab 1:
go run ./cmd/influxd --assets-path=ui/build
```

This starts the influxdb application server. It handles API requests and can be reached via `localhost:9999`. Any changes to go code will need to be re-compiled by re-running the `go run` command above.
This starts the influxdb application server. It handles API requests and can be reached via `localhost:8086`. Any changes to go code will need to be re-compiled by re-running the `go run` command above.

Tab 2:

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ FROM debian:stretch-slim AS influx
COPY --from=dbuild-all /code/bin/linux/influxd /usr/bin/influxd
COPY --from=dbuild-all /code/bin/linux/influx /usr/bin/influx

EXPOSE 9999
EXPOSE 8086

ENTRYPOINT [ "/usr/bin/influxd" ]

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ dshell-image:
@docker image build --build-arg "USERID=$(shell id -u)" -t influxdb:dshell --target dshell .

dshell: dshell-image
@docker container run --rm -p 9999:9999 -p 8080:8080 -u $(shell id -u) -it -v $(shell pwd):/code -w /code influxdb:dshell
@docker container run --rm -p 8086:8086 -p 8080:8080 -u $(shell id -u) -it -v $(shell pwd):/code -w /code influxdb:dshell

# .PHONY targets represent actions that do not create an actual file.
.PHONY: all $(SUBDIRS) run fmt checkfmt tidy checktidy checkgenerate test test-go test-js test-go-race bench clean node_modules vet nightly chronogiraffe dist ping protoc e2e run-e2e influxd libflux flags dshell dclean docker-image-flux docker-image-influx goreleaser
79 changes: 32 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Planned activities include:

## Installing from Source

We have nightly and weekly versioned Docker images, Debian packages, RPM packages, and tarballs of InfluxDB available at the [InfluxData downloads page](https://portal.influxdata.com/downloads/).
We have nightly and weekly versioned Docker images, Debian packages, RPM packages, and tarballs of InfluxDB available at the [InfluxData downloads page](https://portal.influxdata.com/downloads/). We also provide the `influx` command line interface (CLI) client as a separate binary available at the same location.

## Building From Source

Expand Down Expand Up @@ -133,17 +133,12 @@ Everything in InfluxDB is organized under a concept of an organization. The API
Buckets represent where you store time series data.
They're synonymous with what was previously in InfluxDB 1.x a database and retention policy.

The simplest way to get set up is to point your browser to [http://localhost:9999](http://localhost:9999) and go through the prompts.
The simplest way to get set up is to point your browser to [http://localhost:8086](http://localhost:8086) and go through the prompts.

**Note**: Port 9999 will be used during the beta phases of development of InfluxDB v2.0.
This should allow a v2.0-beta instance to be run alongside a v1.x instance without interfering on port 8086.
InfluxDB will thereafter continue to use 8086.
You can also get set up from the CLI using the command `influx setup`:

You can also get set up from the CLI using the subcommands `influx user`, `influx auth`, `influx org` and `influx bucket`,
or do it all in one breath with `influx setup`:


```
```bash
$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx setup
Welcome to InfluxDB 2.0!
Please type your primary username: marty
Expand All @@ -169,68 +164,58 @@ Confirm? (y/n): y

UserID Username Organization Bucket
033a3f2c5ccaa000 marty InfluxData Telegraf
Your token has been stored in /Users/marty/.influxdbv2/credentials
Your token has been stored in /Users/marty/.influxdbv2/configs
```

You may get into a development loop where `influx setup` becomes tedious.
You can run this command non-interactively using the `-f, --force` flag if you are automating the setup.
Some added flags can help:
```
$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx setup --username marty --password F1uxKapacit0r85 --org InfluxData --bucket telegraf --retention 168 --token where-were-going-we-dont-need-roads --force
```

`~/.influxdbv2/credentials` contains your auth token.
Most `influx` commands read the token from this file path by default.

You may need the organization ID and bucket ID later:

```
$ influx org find
ID Name
033a3f2c708aa000 InfluxData
```bash
$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx setup \
--username marty \
--password F1uxKapacit0r85 \
--org InfluxData \
--bucket telegraf \
--retention 168 \
--token where-were-going-we-dont-need-roads \
--force
```

```
$ influx bucket find
ID Name Retention Organization OrganizationID
033a3f2c710aa000 telegraf 72h0m0s InfluxData 033a3f2c708aa000
Once setup is complete, a configuration profile is created to allow you to interact with your local InfluxDB without passing in credentials each time. You can list and manage those profiles using the `influx config` command.
```bash
$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx config
Active Name URL Org
* default http://localhost:8086 InfluxData
```

## Writing Data
Write to measurement `m`, with tag `v=2`, in bucket `telegraf`, which belongs to organization `InfluxData`:

```
$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx write --org InfluxData --bucket telegraf --precision s "m v=2 $(date +%s)"
```bash
$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx write --bucket telegraf --precision s "m v=2 $(date +%s)"
```

Since you have a default profile set up, you can omit the Organization and Token from the command.

Write the same point using `curl`:

```
curl --header "Authorization: Token $(cat ~/.influxdbv2/credentials)" --data-raw "m v=2 $(date +%s)" "http://localhost:9999/api/v2/write?org=InfluxData&bucket=telegraf&precision=s"
```bash
curl --header "Authorization: Token $(bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx auth list --json | jq -r '.[0].token')" \
--data-raw "m v=2 $(date +%s)" \
"http://localhost:8086/api/v2/write?org=InfluxData&bucket=telegraf&precision=s"
```

Read that back with a simple Flux query:

```
$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx query -o InfluxData 'from(bucket:"telegraf") |> range(start:-1h)'
```bash
$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx query 'from(bucket:"telegraf") |> range(start:-1h)'
Result: _result
Table: keys: [_start, _stop, _field, _measurement]
_start:time _stop:time _field:string _measurement:string _time:time _value:float
------------------------------ ------------------------------ ---------------------- ---------------------- ------------------------------ ----------------------------
2019-12-30T22:19:39.043918000Z 2019-12-30T23:19:39.043918000Z v m 2019-12-30T23:17:02.000000000Z 2
```

Use the fancy REPL:

```
$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx repl -o InfluxData
> from(bucket:"telegraf") |> range(start:-1h)
Result: _result
Table: keys: [_start, _stop, _field, _measurement]
_start:time _stop:time _field:string _measurement:string _time:time _value:float
------------------------------ ------------------------------ ---------------------- ---------------------- ------------------------------ ----------------------------
2019-12-30T22:22:44.776351000Z 2019-12-30T23:22:44.776351000Z v m 2019-12-30T23:17:02.000000000Z 2
>
```

Use the `-r, --raw` option to return the raw flux response from the query. This is useful for moving data from one instance to another as the `influx write` command can accept the Flux response using the `--format csv` option.

## Introducing Flux

Expand Down
2 changes: 1 addition & 1 deletion chronograf/bolt/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var DefaultSource = &chronograf.Source{
ID: math.MaxInt32, // Use large number to avoid possible collisions in older chronograf.
Name: "autogen",
Type: "influx",
URL: "http://localhost:9999",
URL: "http://localhost:8086",
Default: false,
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/influx/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Config struct {
// DefaultConfig is default config without token
var DefaultConfig = Config{
Name: "default",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
Active: true,
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/influx/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ func TestWriteConfigs(t *testing.T) {
"default": Config{
Token: "token1",
Org: "org1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
Active: true,
},
},
result: `[default]
url = "http://localhost:9999"
url = "http://localhost:8086"
token = "token1"
org = "org1"
active = true` + commentedStr,
Expand Down
36 changes: 18 additions & 18 deletions cmd/influx/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestCmdConfig(t *testing.T) {
flags: []string{
"--config-name", "default",
"--org", "org1",
"--host-url", "http://localhost:9999",
"--host-url", "http://localhost:8086",
"--token", "tok1",
"--active",
},
Expand All @@ -40,15 +40,15 @@ func TestCmdConfig(t *testing.T) {
Org: "org1",
Active: true,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
{
name: "short",
flags: []string{
"-n", "default",
"-o", "org1",
"-u", "http://localhost:9999",
"-u", "http://localhost:8086",
"-t", "tok1",
"-a",
},
Expand All @@ -58,15 +58,15 @@ func TestCmdConfig(t *testing.T) {
Org: "org1",
Active: true,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
{
name: "short new with existing",
flags: []string{
"-n", "default",
"-o", "org1",
"-u", "http://localhost:9999",
"-u", "http://localhost:8086",
"-t", "tok1",
"-a",
},
Expand All @@ -83,7 +83,7 @@ func TestCmdConfig(t *testing.T) {
Org: "org1",
Active: true,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
}
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestCmdConfig(t *testing.T) {
"--configs-path=" + file,
"-n", "default",
"-o", "org1",
"-u", "http://localhost:9999",
"-u", "http://localhost:8086",
"-t", "tok1",
"-a",
}
Expand All @@ -152,7 +152,7 @@ func TestCmdConfig(t *testing.T) {
require.True(t, ok)
assert.Equal(t, "default", cfg.Name)
assert.Equal(t, "org1", cfg.Org)
assert.Equal(t, "http://localhost:9999", cfg.Host)
assert.Equal(t, "http://localhost:8086", cfg.Host)
assert.Equal(t, "tok1", cfg.Token)
assert.True(t, cfg.Active)
})
Expand Down Expand Up @@ -199,15 +199,15 @@ func TestCmdConfig(t *testing.T) {
Org: "org1",
Active: false,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
expected: config.Config{
Name: "default",
Org: "org1",
Active: true,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
{
Expand All @@ -227,15 +227,15 @@ func TestCmdConfig(t *testing.T) {
Active: false,
PreviousActive: true,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
expected: config.Config{
Name: "default",
Org: "org1",
Active: true,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
}
Expand Down Expand Up @@ -299,7 +299,7 @@ func TestCmdConfig(t *testing.T) {
flags: []string{
"--config-name", "default",
"--org", "org1",
"--host-url", "http://localhost:9999",
"--host-url", "http://localhost:8086",
"--token", "tok1",
"--active",
},
Expand All @@ -308,7 +308,7 @@ func TestCmdConfig(t *testing.T) {
Org: "org1",
Active: true,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
{
Expand Down Expand Up @@ -362,7 +362,7 @@ func TestCmdConfig(t *testing.T) {
flags: []string{
"-n", "default",
"-o", "org1",
"-u", "http://localhost:9999",
"-u", "http://localhost:8086",
"-t", "tok1",
"-a",
},
Expand All @@ -371,7 +371,7 @@ func TestCmdConfig(t *testing.T) {
Org: "org1",
Active: true,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
}
Expand Down Expand Up @@ -546,7 +546,7 @@ func TestCmdConfig(t *testing.T) {
Org: "org1",
Active: false,
Token: "tok1",
Host: "http://localhost:9999",
Host: "http://localhost:8086",
},
},
},
Expand Down Expand Up @@ -594,7 +594,7 @@ func testConfigInvalidURLs(t *testing.T, cmdName string, cmdFn func(*globalFlags
flags: []string{
"--config-name", "default",
"--org", "org1",
"--host-url", "localhost:9999",
"--host-url", "localhost:8086",
"--token", "tok1",
},
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/influxd/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func launcherOpts(l *Launcher) []cli.Opt {
{
DestP: &l.httpBindAddress,
Flag: "http-bind-address",
Default: ":9999",
Default: ":8086",
Desc: "bind address for the REST HTTP API",
},
{
Expand Down
Loading

0 comments on commit 7964f86

Please sign in to comment.