Commit Graph

1828 Commits

Author SHA1 Message Date
Hector Sanjuan
fcea4f41cf
Merge pull request #662 from roignpar/patch-2
update build status link in README
2019-02-07 16:36:58 +00:00
roignpar
743ff9dcd8
update build status link in README
License: MIT
Signed-off-by: Robert Ignat <robert.ignat91@gmail.com>
2019-02-07 13:42:10 +02:00
Hector Sanjuan
4324889c79
Merge pull request #659 from ipfs/fix/update-json-config
Fix/update json config
2019-02-06 22:43:51 +00:00
Hector Sanjuan
789ab57c2c Fix #658: Improve test
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-06 22:41:29 +00:00
Adrian Lanzafame
9b1e7439a5
simplify config test
License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2019-02-06 17:48:58 +10:00
Adrian Lanzafame
551f291689
add test for ToJSON
License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2019-02-06 11:33:49 +10:00
Adrian Lanzafame
237ede5fce
fix pointer ref of updateJSONConfigs
jsonConfigs.getSection() returned a value when it needed to
return a pointer to the jsonSection fields inside the struct.

Even though the jsonSection type is a map, therefore on the heap,
returning it as a value (non-pointer) resulted in it being
disassociated with the jsonConfigs overarching struct.

License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2019-02-06 09:48:27 +10:00
Adrian Lanzafame
5a7ee1d310
Merge pull request #486 from ipfs/feat/expvar
Tracing and Metrics: Opencensus integration for IPFS Cluster
2019-02-05 08:53:41 +10:00
Adrian Lanzafame
3b3f786d68
add opencensus tracing and metrics
This commit adds support for OpenCensus tracing
and metrics collection. This required support for
context.Context propogation throughout the cluster
codebase, and in particular, the ipfscluster component
interfaces.

The tracing propogates across RPC and HTTP boundaries.
The current default tracing backend is Jaeger.

The metrics currently exports the metrics exposed by
the opencensus http plugin as well as the pprof metrics
to a prometheus endpoint for scraping.
The current default metrics backend is Prometheus.

Metrics are currently exposed by default due to low
overhead, can be turned off if desired, whereas tracing
is off by default as it has a much higher performance
overhead, though the extent of the performance hit can be
adjusted with smaller sampling rates.

License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2019-02-04 18:53:21 +10:00
Hector Sanjuan
6e43d272f7 Fix #593: Remove snaps
Snap builds have broken again. It seems the credentials have expired without
warning, even though they were not so old anyways. As promised,
next time snaps would break, they would be removed.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-18 10:23:22 +01:00
Hector Sanjuan
a244af9a13 Fix changelog date
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-16 15:00:10 +01:00
Hector Sanjuan
44f4ff2b24
gx publish 0.8.0
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-16 13:27:26 +01:00
Hector Sanjuan
c37beea1ae
Release 0.8.0
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-16 13:27:03 +01:00
Hector Sanjuan
0d4af5d927
Merge pull request #644 from ipfs/0.8.0/changelog
Changelog for 0.8.0 release
2019-01-16 11:37:02 +01:00
Hector Sanjuan
afe5acfdc9 Changelog for 0.8.0 release
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-16 11:35:29 +01:00
Hector Sanjuan
f7bc468765
gx publish 0.8.0-rc1
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-14 14:54:13 +01:00
Hector Sanjuan
19191cf13f
Release 0.8.0-rc1
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-14 14:53:30 +01:00
Hector Sanjuan
04cd9a57a2
Merge pull request #643 from ipfs/fix/sharness-jq-typo
sharness: Fix test typo causing an empty grep
2019-01-14 14:50:46 +01:00
Hector Sanjuan
d33b27435c
Merge pull request #642 from ipfs/fix/config-errors
config: Fix confusing errors
2019-01-14 14:38:21 +01:00
Hector Sanjuan
9685c08ee0 sharness: test should check agains cluster peer ID
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-14 13:01:18 +01:00
Kishan Sagathiya
6b4b1bcebb Update sharness/t0032-ctl-health.sh
Fix the pid extraction in test.

Co-Authored-By: hsanjuan <hsanjuan@users.noreply.github.com>

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-14 13:01:11 +01:00
Hector Sanjuan
b93aad117b
Merge pull request #638 from ipfs/fix/cors-and-headers
Fix #382 (again): A better strategy for handling proxy headers
2019-01-14 12:08:21 +01:00
Hector Sanjuan
935d9840b4
Merge pull request #641 from ipfs/tests/update-sharness-configs
Sharness: update configuration files used in sharness
2019-01-14 12:08:08 +01:00
Hector Sanjuan
b606c4b3f5
Merge pull request #637 from ipfs/feat/632-stream-channels-client
Fix #632: Add --no-stream to ipfs-cluster-ctl
2019-01-14 12:06:59 +01:00
Hector Sanjuan
7f30a5e6e7 config: do not handle "" durations (and do not error)
They should not be interpreted as 0, since that may overwrite
defaults which are not 0. We simply need to do nothing.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-12 18:40:00 +01:00
Hector Sanjuan
e891c33e40 Config: Interpret empty duration strings as duration = 0.
In practice, we allowed this already, because parsing failed
but Validate() succeeded.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 19:29:56 +01:00
Hector Sanjuan
2783186d1f sharness: Fix test typo causing an empty grep
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 16:26:05 +01:00
Hector Sanjuan
5075504926 config: Fix confusing errors
The JSON parsing of the config could error, but we skipped error checking and
use Validate() at the end. This caused that maybe some JSON parsing errors
where logged but the final error when validating the configuration came from
somewhere different, creating very confusing error messages for the user.

This changes this, along with removing hardcoded section lists. This also
removes a Sharder component section because, AFAIK, it was a left over
from the sharding branch and in the end there is no separate sharding
component that needs a config.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 16:22:07 +01:00
Hector Sanjuan
afc45918b5 Sharness: update configuration files used in sharness
Maintenance

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 16:13:50 +01:00
Hector Sanjuan
c9151f0048 Fix #639: Enforce basic auth for all requests when enabled
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 15:49:12 +01:00
Hector Sanjuan
efafe9b7b5 Fix #639: Do not break start by complaining of unset CORSMaxAge
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 15:32:37 +01:00
Hector Sanjuan
a3720c29c2 restapi: minor codeclimate issue
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 13:40:07 +01:00
Hector Sanjuan
6bda1e340b ipfsproxy: fix typos in comments
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 13:36:56 +01:00
Hector Sanjuan
80bb66e029 ipfsproxy: fix tests for new configuration keys
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 13:34:03 +01:00
Hector Sanjuan
adb290ed2d Fix #639: restapi: Handle CORS preflight requests (OPTIONS)
This adds support for handling preflight requests in the REST API
and fixes currently mostly broken CORS.

Before we just let the user add custom response headers to the
configuration "headers" key but this is not the best way because
CORs headers and requests need special handling and doing it wrong
has security implications.

Therefore, I have added specific CORS-related configuration options
which control CORS behavour. We are forced to change the "headers"
defaults and will notify the users about this in the changelog.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 13:25:21 +01:00
Hector Sanjuan
7067745f1a Fix #639: Add CORS options to restapi
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 12:36:25 +01:00
Hector Sanjuan
99ffabb871 Fix #639: Import rs/cors with Gx
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 12:36:04 +01:00
Hector Sanjuan
bfbc652713 Fix typos in comments
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 11:50:28 +01:00
Hector Sanjuan
2a1eb3c2f9 Fix #382: Add TTL for cached headers
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 11:36:44 +01:00
Hector Sanjuan
66525fe0c8 ipfsproxy: add ExtractHeaderTTL option to config
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-11 11:01:48 +01:00
Hector Sanjuan
a0185fac2a Fix #382 (again): A better strategy for handling proxy headers
This changes the current strategy to extract headers from the IPFS daemon to
use them for hijacked endpoints in the proxy. The ipfs daemon is a bit of a
mess and what we were doing is not really reliable, specially when it comes to
setting CORS headers right (which we were not doing).

The new approach is:

* For every hijacked request, make an OPTIONS request to the same path, with
the given Origin, to the IPFS daemon and extract some CORS headers from
that. Use those in the hijacked response

* Avoid hijacking OPTIONS request, they should always go through so the IPFS
daemon controls all the CORS-preflight things as it wants.

* Similar to before, have a only-once-triggered request to extract other
interesting or custom headers from a fixed IPFS endpoint.  This allows us to
have the proxy forward other custom headers and to catch
`Access-Control-Expose-Methods`. The difference is that the endpoint use for
this and the additional headers are configurable by the user (but with hidden
configuration options because this is quite exotic from regular usage).

Now the implementation:

* Replaced the standard Muxer with gorilla/mux (I have also taken the change
to update the gxed version to the latest tag). This gives us much better
matching control over routes and allows us to not handle OPTIONS requests.

* This allows also to remove the extractArgument code and have proper handlers
for the endpoints passing command arguments as the last segment of the URL. A
very simple handler that wraps the default ones can be used to extract the
argument from the url and put it in the query.  Overall much cleaner this way.

* No longer capture interesting headers from any random proxied request.  This
made things complicated with a wrapping handler. We will just trigger the one
request to do it when we need it.

* When preparing the headers for the hijacked responses:
  * Trigger the OPTIONS request and figure out which CORS things we should set
  * Set the additional headers (perhaps triggering a POST request to fetch them)
  * Set our own headers.

* Moved all the headers stuff to a new headers.go file.

* Added configuration options (hidden by default) to:
  * Customize the extract headers endpoint
  * Customize what additional headers are extracted
  * Use HTTPs when talking to the IPFS API
    * I haven't tested this, but I did not want to have hardcoded 'http://' urls
      around, as before.

* Added extra testing for this, and tested manually a lot comparing the
daemon original output with our hijacked endpoint outputs while looking
at the API traffic with ngrep and making sure the requets happen as expected.
Also tested with IPFS companion in FF and Chrome.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-10 21:35:44 +01:00
Hector Sanjuan
7cd936f5ee Issue #632: Fix wrong name for flag. Address review comments
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-10 11:13:21 +01:00
Hector Sanjuan
f936e52f71 Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.

I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.

We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.

We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.

Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.

I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 18:53:22 +01:00
Hector Sanjuan
d80f3ee05d
Merge pull request #627 from ipfs/issue_445
Added filter option to `ipfs-cluster-ctl status`
2019-01-08 18:26:53 +01:00
Hector Sanjuan
964ced665d Feat #445: Fix string test with TrackerStatus == 0
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-08 16:18:33 +01:00
Hector Sanjuan
595db7a7c5
Merge pull request #633 from ipfs/feat/632-stream-channels
Feat/632: support stream-channels query parameter when adding
2019-01-08 13:31:39 +01:00
Hector Sanjuan
2e692e8dd1 Issue #445: Fix test
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-08 12:42:10 +01:00
Hector Sanjuan
fa5906cc19 Feat #445: Catch invalid filter strings in ipfs-cluster-ctl.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-08 12:28:29 +01:00
Hector Sanjuan
75702c21c9 Feat #445: Clarify about 0 filter value.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-07 19:47:44 +01:00
Hector Sanjuan
7de930b796 Feat #445: Use TrackerStatus as filter. Simplify and small misc.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-07 19:45:07 +01:00