|
3 | 3 | Since 0.4.11 go-ipfs has an experimental plugin system that allows augmenting
|
4 | 4 | the daemons functionality without recompiling.
|
5 | 5 |
|
6 |
| -When an IPFS node is created, it will load plugins from the `$IPFS_PATH/plugins` |
| 6 | +When an IPFS node is started, it will load plugins from the `$IPFS_PATH/plugins` |
7 | 7 | directory (by default `~/.ipfs/plugins`).
|
8 | 8 |
|
9 |
| -### Plugin types |
| 9 | +**Table of Contents** |
| 10 | + |
| 11 | +- [Plugin Types](#plugin-types) |
| 12 | + - [IPLD](#ipld) |
| 13 | + - [Datastore](#datastore) |
| 14 | +- [Available Plugins](#available-plugins) |
| 15 | +- [Installing Plugins](#installing-plugins) |
| 16 | + - [External Plugin](#external-plugin) |
| 17 | + - [In-tree](#in-tree) |
| 18 | + - [Out-of-tree](#out-of-tree) |
| 19 | + - [Preloaded Plugins](#preloaded-plugins) |
| 20 | +- [Creating A Plugin](#creating-a-plugin) |
| 21 | + |
| 22 | +## Plugin Types |
| 23 | + |
| 24 | +### IPLD |
10 | 25 |
|
11 |
| -#### IPLD |
12 | 26 | IPLD plugins add support for additional formats to `ipfs dag` and other IPLD
|
13 | 27 | related commands.
|
14 | 28 |
|
15 |
| -### Supported plugins |
| 29 | +### Datastore |
| 30 | + |
| 31 | +Datastore plugins add support for additional datastore backends. |
| 32 | + |
| 33 | +## Available Plugins |
| 34 | + |
| 35 | +| Name | Type | Preloaded | Description | |
| 36 | +|---------------------------------------------------------------------------------|-----------|-----------|------------------------------------------------| |
| 37 | +| [git](https://github.com/ipfs/go-ipfs/tree/master/plugin/plugins/git) | IPLD | x | An IPLD format for git objects. | |
| 38 | +| [badgerds](https://github.com/ipfs/go-ipfs/tree/master/plugin/plugins/badgerds) | Datastore | x | A high performance but experimental datastore. | |
| 39 | +| [flatfs](https://github.com/ipfs/go-ipfs/tree/master/plugin/plugins/flatfs) | Datastore | x | A stable filesystem-based datastore. | |
| 40 | +| [levelds](https://github.com/ipfs/go-ipfs/tree/master/plugin/plugins/levelds) | Datastore | x | A stable, flexible datastore backend. | |
16 | 41 |
|
17 |
| -| Name | Type | |
18 |
| -|------|------| |
19 |
| -| git | IPLD | |
| 42 | +* **Preloaded** plugins are built into the go-ipfs binary and do not need to be |
| 43 | + installed separately. At the moment, all in-tree plugins are preloaded. |
20 | 44 |
|
21 |
| -#### Installation |
| 45 | +## Installing Plugins |
22 | 46 |
|
23 |
| -##### Linux |
| 47 | +Go-ipfs supports two types of plugins: External and Preloaded. |
| 48 | + |
| 49 | +* External plugins must be installed in `$IPFS_PATH/plugins/` (usually |
| 50 | +`~/.ipfs/plugins/`). |
| 51 | +* Preloaded plugins are built-into the go-ipfs when it's compiled. |
| 52 | + |
| 53 | +### External Plugin |
| 54 | + |
| 55 | +The advantage of an external plugin is that it can be built, packaged, and |
| 56 | +installed independently of go-ipfs. Unfortunately, this method is only supported |
| 57 | +on Linux and MacOS at the moment. Users of other operating systems should follow |
| 58 | +the instructions for preloaded plugins. |
| 59 | + |
| 60 | +#### In-tree |
| 61 | + |
| 62 | +To build plugins included in |
| 63 | +[plugin/plugins](https://github.com/ipfs/go-ipfs/tree/master/plugin/plugins), |
| 64 | +run: |
24 | 65 |
|
25 |
| -1. Build included plugins: |
26 | 66 | ```bash
|
27 | 67 | go-ipfs$ make build_plugins
|
28 | 68 | go-ipfs$ ls plugin/plugins/*.so
|
29 | 69 | ```
|
30 | 70 |
|
31 |
| -3. Copy desired plugins to `$IPFS_PATH/plugins` |
| 71 | +To install, copy desired plugins to `$IPFS_PATH/plugins`. For example: |
| 72 | + |
32 | 73 | ```bash
|
33 | 74 | go-ipfs$ mkdir -p ~/.ipfs/plugins/
|
34 | 75 | go-ipfs$ cp plugin/plugins/git.so ~/.ipfs/plugins/
|
35 | 76 | go-ipfs$ chmod +x ~/.ipfs/plugins/git.so # ensure plugin is executable
|
36 | 77 | ```
|
37 | 78 |
|
38 |
| -4. Restart daemon if it is running |
| 79 | +Finally, restart daemon if it is running. |
39 | 80 |
|
40 |
| -##### Other |
| 81 | +#### Out-of-tree |
41 | 82 |
|
42 |
| -Go currently only supports plugins on Linux, for other platforms you will need |
43 |
| -to compile them into IPFS binary. |
| 83 | +To build out-of-tree plugins, use the plugin's Makefile if provided. Otherwise, |
| 84 | +you can manually build the plugin by running: |
44 | 85 |
|
45 |
| -1. Uncomment plugin entries in `plugin/loader/preload_list` |
| 86 | +```bash |
| 87 | +myplugin$ go build -buildmode=plugin -i -o myplugin.so myplugin.go |
| 88 | +``` |
| 89 | + |
| 90 | +Finally, as with in-tree plugins: |
| 91 | + |
| 92 | +1. Install the plugin in `$IPFS_PATH/plugins`. |
| 93 | +2. Mark the plugin as executable (`chmod +x $IPFS_PATH/plugins/myplugin.so`). |
| 94 | +3. Restart your IPFS daemon (if running). |
| 95 | + |
| 96 | +### Preloaded Plugins |
| 97 | + |
| 98 | +The advantages of preloaded plugins are: |
| 99 | + |
| 100 | +1. They're bundled with the go-ipfs binary. |
| 101 | +2. They work on all platforms. |
| 102 | + |
| 103 | +To preload a go-ipfs plugin: |
| 104 | + |
| 105 | +1. Add the plugin to the preload list: `plugin/loader/preload_list` |
46 | 106 | 2. Build ipfs
|
47 | 107 | ```bash
|
48 | 108 | go-ipfs$ make build
|
49 | 109 | ```
|
| 110 | + |
| 111 | +## Creating A Plugin |
| 112 | + |
| 113 | +To create your own out-of-tree plugin, use the [example |
| 114 | +plugin](https://github.com/ipfs/go-ipfs-example-plugin/) as a starting point. |
| 115 | +When you're ready, submit a PR adding it to the list of [available |
| 116 | +plugins](#available-plugins). |
0 commit comments