3box.js and related tools built by 3Box Labs are deprecated and no loger supported. Developers are encurraged to build with https://ceramic.network which is a more secure and decentralized protocol for sovereign data.
⚠️ This package is slowly being phased out in favor of a new more decentralized system called IDX (https://idx.xyz) which is built on top of the Ceramic network. You can use it for now, but be aware that support will be limited as Ceramic is moving closer to a mainnet release.
This package contains information for spinning up your Ghost Pinbot server used for attaching/detaching to Ghost threads.
There are various ways of how to start the app depending on how you want to run the Ghost Pinbot application. The application supports three different modes:
-
API
: service for communicating with the Ghost Pinbot API -
PEER
: service for handling Ghost Thread functionalities -
BUNDLED
: service which bundles both the API and PEER services.
There is a Dockerfile
which can be used to build the image and deploy it on your infrastructure.
Note: the same Dockerfile
is used for all the execution modes. This needs to be separated in some of the future versions of the Ghost Pinbot.
The docker-compose.yml
can be a good start to bootstrap Ghost Pinbot server.
./docker-compose up
In order to run the Ghost Pinbot service on Heroku run the following script from the root dir.
./deploy/heroku/build.sh <API_APP_NAME> <PEER_APP_NAME>
That script will create the script for deployment:
./deploy/heroku/build/deploy.sh
Just run the script and your services will be deployed on Heroku. For example, if you run:
./deploy/heroku/build.sh ghostpinbot-api ghostpinbot-peer
When you run the deploy.sh
script your services will be deployed as:
The PEER service registers on the API service upon bootstrap. You can query the API service in order to get multiaddress of the peer node:
GET PEER INFO
: https://ghostpinbot-api.herokuapp.com/api/v0/peer
The multiaddress will be listed in the response:
Multiaddress example
: /dns4/ghostpinbot-peer.herokuapp.com/wss/ipfs/Qma9vbkfBMxWPEMzYybECAXenxwYiwXztbtSsQDDYcpPna
Note: Make sure that the names of the applications are available on Heroku.
If you plan to deploy the Ghost Pinbot server on AWS there are Terraform scripts located in deploy/aws-terraform-example
.
In order to setup secure WebSocket for swarm
direct connect over https
that's automatically implemented in the Terraform scripts provided. The only input that needs to be provided is the certificate arn from AWS.
Upon successful start and deployment, the MultiAddress of a Ghost Pinbot node can be passed as an option ghostPinbot
to 3Box
on create.
The options example:
{
"ghostPinbot": "/dns4/ghostpinbot-peer.herokuapp.com/wss/ipfs/Qma9vbkfBMxWPEMzYybECAXenxwYiwXztbtSsQDDYcpPna"
}
Using it with the 3Box:
Box.create(provider, {
ghostPinbot: "/dns4/ghostpinbot-peer.herokuapp.com/wss/ipfs/Qma9vbkfBMxWPEMzYybECAXenxwYiwXztbtSsQDDYcpPna"
})
RESTful APIs are enabled on http://localhost:8081/api/v0/
by default.
Starts to listen for one thread.
-
URL
/rooms
-
Method:
POST
-
Data Params
- Content:
{ "space": "hello-world-space", "thread": "hello-world-thread" }
- Content:
-
Success Response:
-
Code: 200
-
Content:
{ "status": "THREAD_JOINING" }
-
Stops to listen to a thread.
-
URL
/rooms
-
Method:
DELETE
-
Data Params
- Content:
{ "space": "hello-world-space", "thread": "hello-world-thread" }
- Content:
-
Success Response:
-
Code: 200
-
Content:
{ "status": "THREAD_LEAVING" }
-
Gets list of attached rooms.
-
URL
/rooms
-
Method:
GET
-
Success Response:
- Code: 200
Content:[ { "space": "hello-world-space", "thread": "hello-world-thread", "status": "THREAD_JOINED" }, { "space": "bye-world-space", "thread": "bye-world-thread", "status": "THREAD_LEFT" } ]
- Code: 200
Gets IPFS peer information.
-
URL
/peer
-
Method:
GET
-
Success Response:
- Code: 200
Content:{ "id": "Qma9vbkfBMxWPEMzYybECAXenxwYiwXztbtSsQDDYcpPna", "multiaddrs": [ "/dns4/ghostpinbot-peer.herokuapp.com/wss/ipfs/Qma9vbkfBMxWPEMzYybECAXenxwYiwXztbtSsQDDYcpPna" ] }
- Code: 200
If you want to add new features to the pinbot or submit bug reports please submit a PR.
This project is licensed under the MIT License - see the LICENSE file for details.