This is a graphql server that is designed to complement a room-server. When properly configured it will provide a GraphQL API allowing you to query:
- details about the room (name, notices)
- membership of the room
- posts made by room members
The data provided by this API conforms to the [ssb-public-web-hosting-spec]
npm install
npm run dev
- spin up a droplet, adding SSH keys
- assign a "reserved IP address" (static address)
- ssh into the droplet, e.g.
- install node
- install nvm
nvm install 16
- (you may need to log out and in for nvm to be registered)
- install
planetary-graphql
git clone https://github.com/planetary-social/planetary-graphql.git cd planetary-graphql npm i
- set up environment variables
cp .env.template .env
- you will need to edit this file to make sure the details are correct`
- these environment variables are required for room related API:
ROOM_KEY
- ssb id of the roomROOM_HOST
- the hostname of the roomROOM_URL
- the URL the room is being served at. This should be an absolute URL. E.g.https://localhost:3000
orhttps://civic.love
MAGIC_TOKEN
- the token used to bypass invites for thego-ssb-room
server
- these environment variables are required for room related API:
- you will need to edit this file to make sure the details are correct`
- install pm2 (process manager)
npm install pm2 -g pm2 startup
- start the process!
npm start
- check the server is live using your browser
- visit e.g.
http://157.230.72.191:4000/graphql
(assume default PORT)
- visit e.g.
Other useful commands:
npm run stop // close the pm2 process does
pm2 restart graphql // restart the graphql process
pm2 monit // detailed monitoring for pm2 processes
You will need to add this peer as a member of the room (so that it can poll the room for updates).
- open the
secret
file atDB_PATH/secret
(default:./db/secret
) - copy the
id
from this file - in the room-server, add this
id
as a member
If using pm2
, you can run pm2 list
to see the cpu/mem/uptime of your server.
Checking disk usage in the planetary-graphql
folder:
bash du -h db/db2 ls -lh db/db2/log.bipf
cd planetary-graph
git pull origin master
npm install
pm2 restart all
ssb-public-web-hosting-spec: https://github.com/ssbc/ssb-public-web-hosting-spec