Commit Graph

56 Commits

Author SHA1 Message Date
Hector Sanjuan
96af118144 Fix #577: Try downloading gx and gx-go from local ipfs gateway first
This modifies the Makefile so that gx and gx-go downloads are first
attempted from the local ipfs gateway (127.0.0.1:8080) and then
from the offical gateway (ipfs.io).

Make and wget doesn't work well dealing with stuff in subfolders,
so I have moved deptools-related rules to the deptools folder in its own
Makefile.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-10-18 14:09:19 +02:00
Hector Sanjuan
61aa83fcc2
Merge pull request #555 from ipfs/fix/make-test
fix make test: the make test rule should not pass the -loglevel flag
2018-09-28 19:51:45 +02:00
Kishan Sagathiya
79481f83dc Move ipfs-cluster-service and ipfs-cluster-ctl to cmd/
This commit moves `ipfs-cluster-service` and `ipfs-cluster-ctl` to
`cmd/` directory to follow "standard" project structure.

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-09-27 20:56:09 +02:00
Hector Sanjuan
b78f9881c1 fix make test: the make test rule should not pass the -loglevel flag
It's not supported in all subpackages. Make test is not really used
in our CI that's why we didn't see this before.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-09-27 20:27:51 +02:00
Hector Sanjuan
e751fbe25e
Merge pull request #529 from ipfs/feat/docker-gx-make
speed up building docker image
2018-09-24 13:51:26 +02:00
Kishan Sagathiya
cd7c803772 Issue #536 New make target for PR check
A test target should not modify the running system. Safest to run
without test_sharness. Thus avoiding to install.

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-09-21 23:38:02 +05:30
Kishan Sagathiya
a6111908e9 Issue #539 Make make all update dependencies
`make all` assumes that your dependencies are re-written. This can lead
to unexpected failures/errors.
This commit changes `make all` to update dependencies as well.

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-09-21 23:37:42 +05:30
Kishan Sagathiya
69a11a8703 Issue #536 New make target for PR check
Fixes typo

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-09-20 07:31:27 +05:30
Kishan Sagathiya
20bd25399c Issue #536 New make target for PR check
This commit adds a single make target that can run and check if I am
ready to push my PR, i.e, `make prcheck`

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-09-19 10:05:43 +05:30
Adrian Lanzafame
88f08e86b0
speed up building docker image
By using gx install --local, deps are copied into
the build context and therefore only stale deps
will get pulled from the network on image build.

License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
2018-09-07 12:35:32 +10:00
Hector Sanjuan
cc1af87243 Gx-go 1.8.0 it's WAY faster.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-08-22 12:03:40 +02:00
Wyatt Daviau
1adc409aa7 refactor import_test
License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-08-07 20:11:24 +02:00
Wyatt Daviau
6b8bcdfbc3 Finishing feedback and adding new test
Also updating Makefile to fetch sharness more robustly

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-08-07 20:11:23 +02:00
Hector Sanjuan
cc698e2ecf Update to latest gx version. Be more verbose when installing.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-14 14:54:46 +02:00
Hector Sanjuan
33d9cdd3c4 Feat: emancipate Consensus from the Cluster component
This commit promotes the Consensus component (and Raft) to become a fully
independent thing like other components, passed to NewCluster during
initialization. Cluster (main component) no longer creates the consensus
layer internally. This has triggered a number of breaking changes
that I will explain below.

Motivation: Future work will require the possibility of running Cluster
with a consensus layer that is not Raft. The "consensus" layer is in charge
of maintaining two things:
  * The current cluster peerset, as required by the implementation
  * The current cluster pinset (shared state)

While the pinset maintenance has always been in the consensus layer, the
peerset maintenance was handled by the main component (starting by the "peers"
key in the configuration) AND the Raft component (internally)
and this generated lots of confusion: if the user edited the peers in the
configuration they would be greeted with an error.

The bootstrap process (adding a peer to an existing cluster) and configuration
key also complicated many things, since the main component did it, but only
when the consensus was initialized and in single peer mode.

In all this we also mixed the peerstore (list of peer addresses in the libp2p
host) with the peerset, when they need not to be linked.

By initializing the consensus layer before calling NewCluster, all the
difficulties in maintaining the current implementation in the same way
have come to light. Thus, the following changes have been introduced:

* Remove "peers" and "bootstrap" keys from the configuration: we no longer
edit or save the configuration files. This was a very bad practice, requiring
write permissions by the process to the file containing the private key and
additionally made things like Puppet deployments of cluster difficult as
configuration would mutate from its initial version. Needless to say all the
maintenance associated to making sure peers and bootstrap had correct values
when peers are bootstrapped or removed. A loud and detailed error message has
been added when staring cluster with an old config, along with instructions on
how to move forward.

* Introduce a PeerstoreFile ("peerstore") which stores peer addresses: in
ipfs, the peerstore is not persisted because it can be re-built from the
network bootstrappers and the DHT. Cluster should probably also allow
discoverability of peers addresses (when not bootstrapping, as in that case
we have it), but in the meantime, we will read and persist the peerstore
addresses for cluster peers in this file, different from the configuration.
Note that dns multiaddresses are now fully supported and no IPs are saved
when we have DNS multiaddresses for a peer.

* The former "peer_manager" code is now a pstoremgr module, providing utilities
to parse, add, list and generally maintain the libp2p host peerstore, including
operations on the PeerstoreFile. This "pstoremgr" can now also be extended to
perform address autodiscovery and other things indepedently from Cluster.

* Create and initialize Raft outside of the main Cluster component: since we
can now launch Raft independently from Cluster, we have more degrees of
freedom. A new "staging" option when creating the object allows a raft peer to
be launched in Staging mode, waiting to be added to a running consensus, and
thus, not electing itself as leader or doing anything like we were doing
before. This additionally allows us to track when the peer has become a
Voter, which only happens when it's caught up with the state, something that
was wonky previously.

* The raft configuration now includes an InitPeerset key, which allows to
provide a peerset for new peers and which is ignored when staging==true. The
whole Raft initialization code is way cleaner and stronger now.

* Cluster peer bootsrapping is now an ipfs-cluster-service feature. The
--bootstrap flag works as before (additionally allowing comma-separated-list
of entries). What bootstrap does, is to initialize Raft with staging == true,
and then call Join in the main cluster component. Only when the Raft peer
transitions to Voter, consensus becomes ready, and cluster becomes Ready.
This is cleaner, works better and is less complex than before (supporting
both flags and config values). We also backup and clean the state whenever
we are boostrapping, automatically

* ipfs-cluster-service no longer runs the daemon. Starting cluster needs
now "ipfs-cluster-service daemon". The daemon specific flags (bootstrap,
alloc) are now flags for the daemon subcommand. Here we mimic ipfs ("ipfs"
does not start the daemon but print help) and pave the path for merging both
service and ctl in the future.

While this brings some breaking changes, it significantly reduces the
complexity of the configuration, the code and most importantly, the
documentation. It should be easier now to explain the user what is the
right way to launch a cluster peer, and more difficult to make mistakes.

As a side effect, the PR also:

* Fixes #381 - peers with dynamic addresses
* Fixes #371 - peers should be Raft configuration option
* Fixes #378 - waitForUpdates may return before state fully synced
* Fixes #235 - config option shadowing (no cfg saves, no need to shadow)

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 07:39:41 +02:00
Hector Sanjuan
dd4128affc Fix #339: Reduce Sleeps in tests
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-04-05 16:49:26 +02:00
Hector Sanjuan
bfdd59735c Fix #240: Add test flags. Remove build tags for logging control.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-01-16 09:28:40 +01:00
Wyatt
fc237b21d4 Feat: Enable Jenkins builds
This enables support for testing in jenkins.

Several minor adjustments have been performed to improve the probability
that the tests pass, but there are still some random
problems appearing with libp2p conections not becoming available or
stopping working (similar to travis, but perhaps more often).

MacOS and Windows builds are broken in worse ways (those issues will
need to be addressed in the future).

Thanks to @zenground0 and @victorbjelkholm for support!

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-01-11 18:11:46 +01:00
Wyatt Daviau
66606a98c9 Tweaking wait time
License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-01-05 07:45:41 -05:00
Wyatt Daviau
79bc8caddf Bring sleep times within reason
License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-01-04 16:51:50 -05:00
Wyatt Daviau
c2c3d6c992 Adjusting timeout to see if that helps
License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-01-04 16:04:06 -05:00
Wyatt Daviau
54f34ca36e make docker impl + launched from travis
License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2018-01-04 15:41:16 -05:00
Wyatt Daviau
8361b8afe4 Add and refine cli interface for cluster state
Added import, export, cleanup.
Changed state interface.
New sharness tests.

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2017-12-28 09:06:28 -05:00
Hector Sanjuan
620886366d release.sh: clean before releasing
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-11 14:10:16 +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
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
8d3c72b766 Fix tests: Make metric broadcasting async
When a peer is down, metric broadcasting hangs, and no more
ticks are sent for a while.
2017-07-21 23:45:33 +02:00
Hector Sanjuan
2f8f6af030 Update gx to v0.12.0 and gx-go to v1.5.0
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-07-07 06:45:00 +02:00
Wyatt
633c97961c Fixing whitespace and minor Make issues 2017-05-05 10:02:07 -07:00
Wyatt
22c0503a71 Correct untar during make 2017-05-05 10:01:09 -07:00
Wyatt
8286cd0ae2 Address 2nd round of comments 2017-05-05 10:00:17 -07:00
Wyatt
ab2f0273e3 Added test_sharness target and fixed small error. Also added gitignore 2017-05-05 09:55:21 -07:00
Wyatt
1a966aee53 GPL compatability, fully automatic sharness build and clean 2017-05-05 09:09:47 -07:00
Wyatt
14a047c2f3 Build fully automated, including aggregation 2017-05-05 09:09:47 -07:00
Wyatt
e9aef89be1 Added test_sharness target and fixed small error. Also added gitignore 2017-05-05 09:09:45 -07:00
Hector Sanjuan
9ac81a8539 gx install no longer verbose
Makes me scroll a lot

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-13 18:40:35 +01:00
Hector Sanjuan
58d962de4c Update gx version
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-02 17:05:21 +01:00
Hector Sanjuan
2512ecb701 Issue #41: Add Replication factor
New PeerManager, Allocator, Informer components have been added along
with a new "replication_factor" configuration option.

First, cluster peers collect and push metrics (Informer) to the Cluster
leader regularly. The Informer is an interface that can be implemented
in custom wayts to support custom metrics.

Second, on a pin operation, using the information from the collected metrics,
an Allocator can provide a list of preferences as to where the new pin
should be assigned. The Allocator is an interface allowing to provide
different allocation strategies.

Both Allocator and Informer are Cluster Componenets, and have access
to the RPC API.

The allocations are kept in the shared state. Cluster peer failure
detection is still missing and re-allocation is still missing, although
re-pinning something when a node is down/metrics missing does re-allocate
the pin somewhere else.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-14 19:13:08 +01:00
Hector Sanjuan
0e7091c6cb Move testing mocks to subpackage so they can be re-used
Related to #18

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-09 17:51:19 +01:00
Hector Sanjuan
43dea68edb Update README, Captain log, fix logging.
Addresses some stuff in #19.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-27 13:30:15 +01:00
Hector Sanjuan
cd307b08ad Try to fix gx-go not rewriting correctly
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 12:50:05 +01:00
Hector Sanjuan
8719d88e13 gx all dependencies
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 12:50:05 +01:00
Hector Sanjuan
154d4dab74 Issue #20: Download a local installation of gx
This way we do not mess with the users stuff

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 12:48:16 +01:00
Hector Sanjuan
81db084249 Make sure the commit string gets set. Fix PublicKey. Output JSON in cluster-ctl
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 16:56:14 +01:00
Hector Sanjuan
f19c4b5567 fix lowercase commit symbol
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 16:33:34 +01:00
Hector Sanjuan
dddd53fe5f Fix -X parameter
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 16:29:37 +01:00
Hector Sanjuan
d5fc795ee5 Re-add version method to cluster-ctl
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 16:26:42 +01:00
Hector Sanjuan
9111c6282c Issue-21: Add cluster ID() method
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 16:26:42 +01:00
Hector Sanjuan
365c549d7c Fix #5: Rename apps to ipfs-cluster-service and ipfs-cluster-ctl
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-23 13:34:22 +01:00
Hector Sanjuan
805b867651 Use go-libp2p-rpc. Tests updated.
The former RPC stuff had become a monster, really hard to have an overview
of the RPC api capabilities and with lots of magic.

go-libp2p-rpc allows to have a clearly defined RPC api which
shows which methods every component can use. A component to perform
remote requests, and the convoluted LeaderRPC, BroadcastRPC methods are
no longer necessary.

Things are much simpler now, less goroutines are needed, the central channel
handling bottleneck is gone, RPC requests are very streamlined in form.

In the future, it would be inmediate to have components living on different
libp2p hosts and it is way clearer how to plug into the advanced cluster rpc
api.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2016-12-27 18:19:54 +01:00