2018-11-27 12:27:01 +01:00
[![banner ](https://raw.githubusercontent.com/oceanprotocol/art/master/github/repo-banner%402x.png )](https://oceanprotocol.com)
2018-08-10 14:30:25 +02:00
2018-12-18 14:04:04 +01:00
< h1 align = "center" > barge< / h1 >
2018-08-10 14:30:25 +02:00
2020-09-24 22:38:39 +02:00
> 🐳 Docker Compose files for the full Ocean Protocol stack running locally for development.
2018-08-10 14:30:25 +02:00
2018-09-19 18:52:52 +02:00
---
2019-07-26 18:03:42 +02:00
- [Prerequisites ](#prerequisites )
- [Get Started ](#get-started )
2023-05-11 04:30:32 +02:00
- [Cleanup ](#cleanup )
- [Troubleshooting ](#troubleshootin )
- [Startup Options ](#startup-options )
2021-04-09 11:44:50 +02:00
- [Component Versions ](#component-versions-and-exposed-ports )
2023-05-11 04:30:32 +02:00
- [Log levels ](#log-levels )
2019-07-26 18:03:42 +02:00
- [All Options ](#all-options )
- [Docker Building Blocks ](#docker-building-blocks )
- [Aquarius ](#aquarius )
2020-09-08 18:23:10 +02:00
- [Provider ](#provider )
- [Ganache ](#ganache )
2021-04-16 08:53:20 +02:00
- [TheGraph ](#thegraph )
2020-09-24 22:38:39 +02:00
- [ocean-contracts ](#ocean-contracts )
2019-10-09 15:29:02 +02:00
- [Dashboard ](#dashboard )
2019-07-26 18:03:42 +02:00
- [Contributing ](#contributing )
- [License ](#license )
2018-12-19 10:52:44 +01:00
2018-08-10 14:30:25 +02:00
---
2018-09-19 18:52:52 +02:00
## Prerequisites
2018-08-16 12:20:54 +02:00
2018-12-18 14:04:04 +01:00
You need to have the newest versions of:
2018-08-13 15:12:21 +02:00
2019-05-08 14:08:17 +02:00
- Linux or macOS. Windows is not currently supported. If you are on Windows, we recommend running Barge inside a Linux VM. Another option might be to use the [Windows Subsystem for Linux (WSL) ](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux ).
- [Docker ](https://www.docker.com/get-started )
2021-05-27 19:03:19 +02:00
- On Linux, [allow non-root users ](https://www.thegeekdiary.com/run-docker-as-a-non-root-user/ )
2022-05-26 13:56:50 +02:00
- On Windows or MacOS, [increase memory to 4 GB (default is 2 GB) ](https://stackoverflow.com/a/44533437 ). Or, for C2D, make it 8 to 16 GB
2019-05-08 14:08:17 +02:00
- [Docker Compose ](https://docs.docker.com/compose/ )
2018-12-03 16:53:30 +01:00
2018-09-19 18:52:52 +02:00
## Get Started
2018-08-10 14:30:25 +02:00
2019-07-18 14:16:02 +02:00
If you're new to Barge, it's best to start with the defaults:
2018-08-10 14:30:25 +02:00
```bash
2018-12-18 14:04:04 +01:00
git clone git@github.com:oceanprotocol/barge.git
cd barge
2019-02-28 16:49:30 +01:00
2019-04-03 14:52:15 +02:00
./start_ocean.sh
2018-09-27 14:47:06 +02:00
```
2020-09-24 22:38:39 +02:00
This will run the current default versions of [Aquarius ](https://github.com/oceanprotocol/aquarius ), [Provider ](https://github.com/oceanprotocol/provider-py ), and [Ganache ](https://github.com/trufflesuite/ganache-cli ) with [our contracts ](https://github.com/oceanprotocol/ocean-contracts ) deployed to it.
2019-02-28 17:15:02 +01:00
2019-06-05 14:21:31 +02:00
< img width = "486" alt = "Welcome to Ocean Protocol" src = "Welcome_to_Ocean_Protocol.png" >
2018-09-27 14:47:06 +02:00
2019-07-18 13:17:34 +02:00
2022-12-08 13:23:38 +01:00
## Cleanup
To clean up your environment, you can run
2020-09-24 22:38:39 +02:00
> ```bash
2022-12-08 13:23:38 +01:00
> ./cleanup.sh
2020-09-24 22:38:39 +02:00
> ```
2019-07-18 13:17:34 +02:00
2023-05-11 04:30:32 +02:00
This will stop & remove any ocean related containers, then delete any volumes and networks created by barge.
2022-12-08 13:23:38 +01:00
2023-05-11 04:30:32 +02:00
### Troubleshooting
If your code using Barge hits `KeyError: "development"` , this is a Barge issue: Barge couldn't deploy the contracts and update `address.json` in `~/.ocean/` . _Further_ cleanup is needed. Further cleanup can fix other issues too. Here are tactics.
Tactic: clean up old Docker containers
```console
docker system prune -a --volumes
```
Tactic: delete Ocean cache, or a sub-directory of it. (This is not part of cleanup.sh in case you want to preserve parts of `~/.ocean/` .)
```console
# delete whole cache
rm -rf ~/.ocean
# OR, delete sub-directory
# (find the sub-directory, and rm -rf it)
```
Tactic: Kill redis or postgres processes. Why: they usually have autostart enabled and can interfere with Barge.
```console
# use ps. Do as superuser to ensure you see the process.
sudo ps aux | grep redis
sudo ps aux | grep postgresql
# If you see unwanted processes, kill them by process id. -9 to force
kill -9 < pid >
```
Tactic: reboot your computer. Why: will stop any other unwanted process.
## Startup Options
2019-07-18 13:17:34 +02:00
2019-09-02 09:50:09 +02:00
The startup script comes with a set of options for customizing various things.
2018-12-19 10:52:44 +01:00
2021-04-09 11:44:50 +02:00
### Component Versions and exposed ports
2018-08-10 14:30:25 +02:00
2019-07-18 13:17:34 +02:00
The default versions are always a combination of component versions which are considered stable.
2019-06-05 14:21:31 +02:00
2022-07-21 09:40:31 +02:00
| Component name | Required by | Version | IP Address | Ports exposed |
2021-04-09 11:44:50 +02:00
| -------------- | ------------------ | --------------------------------- | --------------- | ------------- |
| ganache | ocean-contracts | latest | 172.15.0.3 | 8545 -> 8545 |
2022-10-23 10:19:22 +02:00
| ocean-contracts | | v1.1.8 | 172.15.0.14 | |
2023-03-20 14:46:05 +01:00
| Aquarius | | v5.1.0 | 172.15.0.5 | 5000 -> 5000 |
2023-01-06 09:04:21 +01:00
| Elasticsearch | Aquarius | 8.5.1 | 172.15.0.6 | |
2023-03-20 08:06:29 +01:00
| Provider | | v2.0.0 | 172.15.0.4 | 8030 -> 8030 |
| Provider2 | | v2.0.0 | 172.15.0.7 | 8030 -> 8030 |
2021-06-09 08:46:50 +02:00
| RBAC Server | | main | 172.15.0.8 | 3000 -> 3000 |
2022-11-24 14:51:19 +01:00
| GraphNode | | graphprotocol/graph-node:v0.28.2 | 172.15.0.15 | 9000 -> 8000 ,9001 -> 8001 , 9020 -> 8020, 9030 -> 8030, 9040 -> 8040 |
2021-04-09 11:44:50 +02:00
| Graphipfs | | ipfs/go-ipfs:v0.4.23 | 172.15.0.16 | 5001 -> 5001 |
| Graphpgsql | | postgres | 172.15.0.7 | 5432 -> 5432 |
2021-04-13 11:17:57 +02:00
| Dashboard | | portainer/portainer | 172.15.0.25 | 9100 -> 9000 |
2021-12-06 11:25:45 +01:00
| Redis | | bitnami/redis:latest | 172.15.0.18 | 6379 -> 6379 |
2022-01-14 11:42:45 +01:00
| C2d | | multiple components | 172.15.0.12,172.15.0.13 | 31000 -> 31000 |
2021-12-06 11:25:45 +01:00
2021-04-09 11:44:50 +02:00
2019-07-18 12:03:03 +02:00
You can override the Docker image tag used for a particular component by setting its associated environment variable before calling `start_ocean.sh` :
- `AQUARIUS_VERSION`
2020-09-08 18:23:10 +02:00
- `PROVIDER_VERSION`
2020-09-11 11:31:47 +02:00
- `CONTRACTS_VERSION`
2021-06-09 08:46:50 +02:00
- `RBAC_VERSION`
2022-11-29 12:36:48 +01:00
- `ELASTICSEARCH_VERSION`
2019-07-18 12:03:03 +02:00
For example:
2019-02-28 16:49:30 +01:00
```bash
2020-09-08 18:23:10 +02:00
export AQUARIUS_VERSION=v2.0.0
2019-04-03 14:52:15 +02:00
./start_ocean.sh
2019-02-28 16:49:30 +01:00
```
2022-09-23 15:59:43 +02:00
### Log levels
You can specify what type of logs barge should display for `Aquarius` , `Provider` or `Subgraph`
by exporting the following environment variables.
- `AQUARIUS_LOG_LEVEL`
- `PROVIDER_LOG_LEVEL`
- `SUBGRAPH_LOG_LEVEL`
Currently, they are all set to `INFO` .
For example:
```bash
export AQUARIUS_LOG_LEVEL=DEBUG
./start_ocean.sh
```
2019-07-18 13:17:34 +02:00
### All Options
2018-10-10 12:53:16 +02:00
2019-06-26 14:55:39 +02:00
| Option | Description |
| -------------------------- | ----------------------------------------------------------------------------------------------- |
| `--no-aquarius` | Start up Ocean without the `aquarius` Building Block. |
2022-08-01 12:08:20 +02:00
| `--no-elasticsearch` | Start up Ocean without the `elasticsearch` Building Block. |
2020-09-08 18:23:10 +02:00
| `--no-provider` | Start up Ocean without the `provider` Building Block. |
2022-01-14 11:31:01 +01:00
| `--no-ipfs` | Start up Ocean without the `ipfs` Building Block |
2021-03-03 08:11:42 +01:00
| `--with-provider2` | Runs a 2nd provider, on port 8031. This is required for ocean.js/ocean.py integration tests. 2nd Provider will use the same image and parameters (log_level, ipfs gateway, compute gateway, etc) as provider1, but has a different private key |
2019-10-09 19:26:45 +02:00
| `--no-dashboard` | Start up Ocean without the `dashboard` Building Block. |
2021-06-09 08:46:50 +02:00
| `--with-rbac` | Start up Ocean with RBAC Server |
2022-02-12 17:34:01 +01:00
| `--with-thegraph` | Start up Ocean with graphnode,postgresql and deploys ocean-subgraph |
2022-08-01 12:08:20 +02:00
| `--skip-subgraph-deploy` | Will skip deployment of ocean-subgraphs |
2021-02-09 23:56:31 +01:00
| `--skip-deploy` | Start up Ocean without deploying the contracts. Useful when ethereum node already has contracts.|
2019-06-26 14:55:39 +02:00
| `--force-pull` | Force pulling the latest revision of the used Docker images. |
| `--purge` | Removes the Docker containers, volumes, artifact folder and networks used by the script. |
2020-09-08 18:23:10 +02:00
| `--exposeip` | Binds the components to that specific ip. Example: `./start_ocean.sh --exposeip 192.168.0.1` |
2022-01-14 11:42:45 +01:00
| `--with-c2d` | Runs a local C2D Cluster |
2018-10-10 12:53:16 +02:00
2019-12-10 14:48:40 +01:00
2018-12-11 11:54:06 +01:00
## Docker Building Blocks
2018-11-15 11:34:21 +01:00
2019-02-28 16:49:30 +01:00
Barge consists of a set of building blocks that can be combined to form a local test environment. By default all building blocks will be started by the `start_ocean.sh` script.
2018-11-15 11:34:21 +01:00
2018-12-11 11:54:06 +01:00
### Aquarius
2018-11-15 10:30:28 +01:00
2020-10-13 10:39:09 +02:00
By default it will start two containers (one for Aquarius and one for its database engine). By default, Barge will use Elasticsearch for its database engine.
2019-07-26 18:03:42 +02:00
2019-02-27 17:11:13 +01:00
This Building Block can be disabled by setting the `--no-aquarius` flag.
2018-11-15 10:30:28 +01:00
2019-06-26 11:47:01 +02:00
| Hostname | External Port | Internal URL | Local URL | Description |
| --------------- | ------------- | -------------------- | --------------------- | ----------------------------------------------------- |
| `aquarius` | `5000` | http://aquarius:5000 | http://localhost:5000 | [Aquarius ](https://github.com/oceanprotocol/aquarius ) |
| `elasticsearch` | | | | The Elasticsearch used by Aquarius |
2018-08-13 15:12:21 +02:00
2020-09-08 18:23:10 +02:00
### Provider
2018-11-15 10:30:28 +01:00
2020-09-08 18:23:10 +02:00
| Hostname | External Port | Internal URL | Local URL | Description |
| ----------- | ------------- | --------------------- | --------------------- | --------------------------------------------------- |
2021-04-16 08:50:01 +02:00
| `provider` | `8030` | http://provider:8030 | http://localhost:8030 | |
2019-07-18 12:03:03 +02:00
2020-09-08 18:23:10 +02:00
### Ganache
2019-07-18 12:03:03 +02:00
2020-09-08 18:23:10 +02:00
| Hostname | External Port | Internal URL | Local URL | Description |
| ----------- | ------------- | --------------------- | --------------------- | --------------------------------------------------- |
2021-04-16 08:50:01 +02:00
| `ganache` | `8545` | http://ganache:8545 | http://localhost:8545 | |
### TheGraph
| Hostname | External Port | Internal URL | Local URL | Description |
| ----------- | ------------- | --------------------- | --------------------- | --------------------------------------------------- |
| `graphnode` | `9000` | http://graphnode:9000 | http://localhost:9000 | |
2019-07-18 15:41:41 +02:00
2020-09-11 11:31:47 +02:00
### ocean-contracts
2020-09-24 22:38:39 +02:00
* Deploy all smart contracts from the `ocean-contracts` repo
2020-09-11 11:31:47 +02:00
* Export artifacts files (.json) to default shared folder between all containers
2020-09-24 22:38:39 +02:00
* Create address file (address.json) that has the address of each deployed smart contract that is required by the ocean library. This file is saved to the same folder with the artifacts files
2020-09-11 11:31:47 +02:00
The accounts can be accessed with this seed phrase:
2019-12-10 14:48:40 +01:00
2020-09-08 18:23:10 +02:00
```
taxi music thumb unique chat sand crew more leg another off lamp
```
2019-12-10 14:48:40 +01:00
2020-09-08 18:23:10 +02:00
Alternatively, you can pass your own mnemonic with `GANACHE_MNEMONIC` .
2019-12-10 14:48:40 +01:00
2019-10-09 15:29:02 +02:00
### Dashboard
This will start a `portainer` dashboard with the following admin credentials and connects to the local docker host. This Building Block can be disabled by setting the `--no-dashboard` flag.
- User: `admin`
- Password: `oceanprotocol`
| Hostname | External Port | Internal URL | Local URL | Description |
| ----------- | ------------- | --------------------- | --------------------- | --------------------------------------------------- |
2021-04-13 11:17:57 +02:00
| `dashboard` | `9100` | http://dashboard:9100 | http://localhost:9100 | [Portainer ](https://github.com/portainer/portainer ) |
2019-10-09 15:29:02 +02:00
2021-06-09 08:46:50 +02:00
### RBAC Server
| Hostname | External Port | Internal URL | Local URL | Description |
| ----------- | ------------- | --------------------- | --------------------- | --------------------------------------------------- |
| `rbac` | `3000` | http://rbac:3000 | http://localhost:3000 | |
The following addresses are preconfigured for testing: (first 10 addresses from the default mnemonic)
| Address | Roles |
| ----------------------------------------- | ------------------------------- |
| 0xe2DD09d719Da89e5a3D0F2549c7E24566e947260 | ["user","publisher","consumer"] |
| 0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e | ["user","publisher","consumer"] |
| 0xA78deb2Fa79463945C247991075E2a0e98Ba7A09 | ["user","publisher","consumer"] |
| 0x02354A1F160A3fd7ac8b02ee91F04104440B28E7 | ["user","publisher","consumer"] |
| 0xe17D2A07EFD5b112F4d675ea2d122ddb145d117B | ["user","publisher","consumer"] |
| 0xA32C84D2B44C041F3a56afC07a33f8AC5BF1A071 | ["user","publisher","consumer"] |
| 0xFF3fE9eb218EAe9ae1eF9cC6C4db238B770B65CC | ["user"] |
| 0x529043886F21D9bc1AE0feDb751e34265a246e47 | ["consumer"] |
| 0xe08A1dAe983BC701D05E492DB80e0144f8f4b909 | ["publisher"] |
| 0xbcE5A3468386C64507D30136685A99cFD5603135 | ["consumer","publisher"] |
2018-08-10 14:30:25 +02:00
## Contributing
2018-11-30 15:46:13 +01:00
See the page titled "[Ways to Contribute](https://docs.oceanprotocol.com/concepts/contributing/)" in the Ocean Protocol documentation.
2018-08-10 14:30:25 +02:00
2022-01-14 11:31:01 +01:00
## Readiness
Several building blocks on barge are going to require some time until they are ready. Watch for the following files to be created:
2022-04-21 17:45:35 +02:00
| Building block | File | Condition |
| ----------------------------------------- | ------------------------------- | -------------- |
2022-01-14 11:31:01 +01:00
| ocean-contracts | ${OCEAN_HOME}/ocean-contracts/artifacts/ready |
2022-07-21 09:40:31 +02:00
| c2d | ${OCEAN_HOME}/ocean-c2d/ready | |
2022-04-21 17:46:12 +02:00
| c2d | ${OCEAN_HOME}/ocean-c2d/imagesready | Only if WAIT_FOR_C2DIMAGES == 'yeah' |
2022-01-14 11:31:01 +01:00
## Certs
Registry certs were created using the following commands:
```bash
openssl genrsa 2048 > registry.key
openssl req -new -x509 -nodes -sha1 -days 3650 -key registry.key -out registry.crt -addext 'subjectAltName = IP:172.15.0.11'
```
2022-01-14 11:42:45 +01:00
2018-08-10 14:30:25 +02:00
## License
2018-11-15 11:34:21 +01:00
```text
2023-02-22 12:18:02 +01:00
Copyright 2023 Ocean Protocol Foundation
2018-08-10 14:30:25 +02:00
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```