Commit Graph

1237 Commits

Author SHA1 Message Date
Hector Sanjuan
34c815b0ee
Merge pull request #263 from ipfs/feat/260-api-client
Fix #260: Add REST API client and use it in ipfs-cluster-ctl
2017-12-07 17:08:50 +01:00
Hector Sanjuan
0c469b85e1 cluster-ctl: exit with error on errors.
As before, exit status 1 means a client application error and
exit status 2 means a server-returned error.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-07 12:00:28 +01:00
Hector Sanjuan
7b9ef115a2 rest/api/client: re-use the http client
This allows taking advantage of connection keep alive by having the
api client re-use the same connection. Additionally, an option
to close connections after every request is provided.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-07 11:27:37 +01:00
Hector Sanjuan
660b2375fd cluster-ctl: Fix json output for slice responses.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-07 11:27:01 +01:00
Hector Sanjuan
6d7c65aaa6 Review #260: Address comments
* Set default logging facility
* Remove old keep-alive comment in tests
* Use a port for TestPeersWithErrors which is not default

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-07 00:04:51 +01:00
Hector Sanjuan
e0e32025de cluster-service: Do not export Locker. Fix golint.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 20:12:55 +01:00
Hector Sanjuan
de41394180 Makefile: Update to latest gx and gx-go
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 20:12:55 +01:00
Hector Sanjuan
0a8edc17c9 Fix #260: Add REST API client and use it in ipfs-cluster-ctl
This adds the pakage api/rest/client which implements a go-client
for the REST API component. It also update the ipfs-cluster-ctl
tool to rely on it.

Originally, I wanted this to live it in it's own separate repository,
but the api client uses /api/types.go, which is part of cluster.

Therefore it would need to import all of cluster as a dependency.
ipfs-cluster-ctl would also need to import go-ipfs-cluster-api-client
as a dependency, creating circular gx deps which would be a mess to
maintain.

Only the splitting of cluster in multiple repositories (at least for
api, rest, ipfs-cluster-ctl, rest/client and test) would allow better
dependency management by allowing rest/client and the ctl tool
to only import what is needed, but this is something which brings
maintenance costs and can probably wait a bit until cluster is more stable.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 20:12:01 +01:00
Hector Sanjuan
bde7b4e3d9
Merge pull request #264 from ipfs/feat/code_quality
Feat/code quality
2017-12-06 18:46:53 +01:00
Hector Sanjuan
9f8849fb18
Merge pull request #262 from ipfs/fix/lock-service
ipfs-cluster-service lock
2017-12-06 17:58:41 +01:00
Wyatt
ad492d20ae fix #254, execution locking:
ipfs-cluster-service now locks before running the daemon and state
upgrade commands.  Locking mechanism heavily inspired by ipfs, see
go-ipfs fsrepo.  Unlock called on exit to free up repo.  one lockfile
per repo. A very simple sharness test checks that two service
invocations cannot occur.

A longstanding sharness/ci logging issue is addressed by exporting
verbose=t into the travis environment.  Now output of commands from
within sharness test strings are displayed during travis runs.

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2017-12-06 11:14:53 -05:00
Hector Sanjuan
f289394985 fix gofmt: format some files with gofmt -s
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 15:15:54 +01:00
Hector Sanjuan
0693ff429e fix spelling: Fix spelling errors
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 15:15:54 +01:00
Hector Sanjuan
7cd2d3d0e1 fix inef assignments: fix some unused assignments
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 15:15:52 +01:00
Hector Sanjuan
6d3edbb4a5 feat contribution guidelines: add guidelines
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 15:15:50 +01:00
Hector Sanjuan
b0d61ab9cb feat make check: add make check to run go vet and golint
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 15:15:43 +01:00
Hector Sanjuan
9a246a237d fix go vet: address go vet warnings
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 15:15:41 +01:00
Hector Sanjuan
c0628e43ff fix golint: Address a few golint warnings
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-06 15:15:38 +01:00
Hector Sanjuan
1e87fccf0e
Merge pull request #257 from te0d/feat/add-peer-identifier
Added Hostname Property to Configuration
2017-12-04 14:25:49 +01:00
Hector Sanjuan
84816729ff
Merge pull request #252 from te0d/feat/add-pin-name
Feat/add pin name
2017-12-04 14:25:39 +01:00
Hector Sanjuan
36f692069e
Merge pull request #259 from ipfs/pin-bot
Fix #155: Changes to run ipfs-cluster in the gateways
2017-12-04 14:25:00 +01:00
Hector Sanjuan
d6a7caf7a4 Issue #259: Address CR comments
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-04 13:59:48 +01:00
Tom O'Donnell (te0d)
7d43be33a4 Added Peername Configuration Test and Renamed to Peername
I've modified the peer identifier to be 'peername'. I've also
modified the TestLoadJSON to check that it is correctly read from
config and set to a default if empty.

Also added 'peername' fields to configurations for various tests.
2017-12-01 13:50:13 -05:00
Hector Sanjuan
4922c95589 Support --local parameter for Status[Local] and Sync[Local] operations
This allows to call the Rest API's status and sync endpoints with a
"?local=true" parameter. This will trigger operations but only on the
local peer. Cluster *Local and RPC-*Local methods have been accordingly,
although they are aliases for the PinTracker methods (but otherwise they
would not be exposed in external APIs). ipfs-cluster-ctl has been updated to
support the new flag.

The rationaly behind this feature is that sometimes, a single cluster peer
(or the ipfs daemon in it) is misbehaving. The user then wants to Sync,
Recover, or see Status for that single peer. This is specially relevant
when working with big pinsets in larger clusters, as a Status() call will
be considerably more expensive when broadcasted everywhere.

Note that the Rest API keeps returning GlobalPinInfo objects even on local=true
calls. This ensures that the user always gets the same datatype from an endpoint.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-01 12:56:26 +01:00
Tom O'Donnell (te0d)
8746f58b93 Fixed Pin ls Formatter for grep
Removed single quotes from pin name for ease of grepping.
2017-11-30 15:25:43 -05:00
Tom O'Donnell (te0d)
d1ef3d0493 Fixes for Adding Peer Identifier from Code Review
I renamed Hostname to simply Name as to not imply relation to DNS.
Removed quotes from formatter, used helper function setting config,
and added defensive error check.
2017-11-30 15:21:53 -05:00
Tom O'Donnell (te0d)
8f8f74acc5 Fixed URL Encoding for Add Pin Name Parameter and Reduced Version
URL encoding was added for `ipfs-cluster-ctl pin add --name`. The
Map State version was return to version 2. I did not notice errors,
but if there are, Version 2 still is not in a stable release.
2017-11-30 14:58:35 -05:00
Tom O'Donnell (te0d)
7add1b3b52 Added Name Option to ipfs-cluster-ctl pin add
I added an option called --name or -n which specifies the name for
the added pin to be stored in consensus. Also added quotes around
name for allocations formatter.
2017-11-30 10:14:24 -05:00
Tom O'Donnell (te0d)
3f28da4415 Fixed Pin's Name Attribute when not Specified
When not specified, the name was being assigned to whichever name
was assigned to the previous pin. Not sure exactly what was
happening, but it works after removing omitempty. The idea was to
make Name optional, but here it will always be assigned.
2017-11-30 10:14:24 -05:00
Tom O'Donnell (te0d)
bd829c3f31 Added Name to Pinned Items
Added Name field to be a part of the stored state of a Pin. This
allows the name to be stored as a part of the consensus if needed.

This is the bare minimum to use. Some other calls like status need
to be checked out.
2017-11-30 10:14:24 -05:00
Hector Sanjuan
e824aea55e RecoverAll: Implement RecoverAllLocal() which recovers all pins in a peer
This adds API, RPC calls to support RecoverAllLocal() (and expose RecoverLocal()
on the Rest API too). cluster-ctl is updated accordingly.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-30 01:53:31 +01:00
Tom O'Donnell (te0d)
c6c8512a27 Added Hostname Property to Configuration
I added a "hostname" property to a node's configuration file. Its
value defaults to the hostname provided by the OS, but can be
modified to anything beside an empty string in the config file.

The "hostname" was added to the output of the "id" call. Thus, peer
hostnames are available when listing peers.
2017-11-29 15:44:31 -05:00
Hector Sanjuan
11a8926236 MapPinTracker: support configuration section
This also generates a default configuration section when it
doesn't exist, so it's backwards compatible.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-29 14:42:50 +01:00
Hector Sanjuan
39fb193eaf Peerstore: support dns multiaddresses
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-29 10:34:03 +01:00
Hector Sanjuan
d6800045b5 Dockerfile: Remove ipfs from container
The main container will now run only ipfs-cluster-service.

A new ipfs-cluster-bundle container is built by Dockerfile-bundle
which will provide ipfs-cluster+ipfs.

Fixes #197

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-29 10:34:03 +01:00
Hector Sanjuan
025fc95279 Dockerfile-test: use go-ipfs:master
Allows us to test against latest ipfs (either it's broken and this
helps finding out, or it's not broken anymore and we don't lose time
trying to figure out why).

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-29 10:34:03 +01:00
Hector Sanjuan
cb5012c53b
Merge pull request #220 from ipfs/feat/backups-upgrade-path
Feat/backups upgrade path
2017-11-29 09:55:50 +01:00
Wyatt
47b744f1c0 ipfs-cluster-service state upgrade cli command
ipfs-cluster-service now has a migration subcommand that upgrades
    persistant state snapshots with an out-of-date format version to the
    newest version of raft state. If all cluster members shutdown with
    consistent state, upgrade ipfs-cluster, and run the state upgrade command,
    the new version of cluster will be compatible with persistent storage.
    ipfs-cluster now validates its persistent state upon loading it and exits
    with a clear error in the case the state format version is not up to date.

    Raft snapshotting is enforced on all shutdowns and the json backup is no
    longer run.  This commit makes use of recent changes to libp2p-raft
    allowing raft states to implement their own marshaling strategies. Now
    mapstate handles the logic for its (de)serialization.  In the interest of
    supporting various potential upgrade formats the state serialization
    begins with a varint (right now one byte) describing the version.

    Some go tests are modified and a go test is added to cover new ipfs-cluster
    raft snapshot reading functions.  Sharness tests are added to cover the
    state upgrade command.
2017-11-28 22:35:48 -05:00
Hector Sanjuan
2bc7aec079
Merge pull request #242 from elopio/test-snap-in-travis
Move the snap deploy script to a separate file
2017-11-16 17:30:18 +01:00
Leo Arias
22c1d2401f Move back the docker call to travis 2017-11-16 14:36:42 +00:00
Leo Arias
980c812d20 Pass the multiarch environment variables 2017-11-16 07:05:19 +00:00
Leo Arias
58a884373b Move the snap deploy script to a separate file 2017-11-16 01:52:06 +00:00
Hector Sanjuan
c8dd79b235
Merge pull request #241 from elopio/snap-push-escape
Escape the variable in the snapcraft loop
2017-11-16 00:30:55 +01:00
Leo Arias
ce574a6849 Escape the variable in the snapcraft loop 2017-11-15 23:25:22 +00:00
Hector Sanjuan
ff698141f2
sign release commits too
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-15 23:54:31 +01:00
Hector Sanjuan
0c40d50497 gx publish 0.3.0
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-15 23:40:03 +01:00
Hector Sanjuan
16acaa67c0 Release 0.3.0
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-15 23:39:50 +01:00
Hector Sanjuan
3726ef8c9d Include a tag annotation, sign tags
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-15 23:39:22 +01:00
Leo Arias
81e1f3855e Enable the snap builds for i386, armhf and arm64 (#237)
Enable the snap builds for i386, armhf and arm64
2017-11-15 23:23:01 +01:00
Hector Sanjuan
1afde29fa3 Merge branch '0.3.0/changelog' 2017-11-15 23:21:18 +01:00