Skip to content

Commit

Permalink
examples: working example with scylla db
Browse files Browse the repository at this point in the history
  • Loading branch information
esatterwhite committed Feb 26, 2018
1 parent 0de29cb commit 554a5bb
Show file tree
Hide file tree
Showing 5 changed files with 2,152 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/scylla-storage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# skyring-scylladown

Example skyring cluster using [ScyllaDB] as a storage backend.

```bash
# start Syclla & nats
$ docker-compose up -d

# Start Seed Node 1
$ PORT=3000 DEBUG=* node . --storage:path=skyring-1 --storage:contactPoints=0.0.0.0:9042 --storage:contactPoints=0.0.0.0:9043 --channel:port=3455

# Start Seed Node 1
$ PORT=3001 DEBUG=* node . --storage:path=skyring-2 --storage:contactPoints=0.0.0.0:9042 --storage:contactPoints=0.0.0.0:9043 --channel:port=3456
```

[ScyllaDB]: https://scylladb.com
43 changes: 43 additions & 0 deletions examples/scylla-storage/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: "2.1"
services:
scylla-1:
image: scylladb/scylla
hostname: scylla-1
command: --broadcast-address scylla-1 --listen-address scylla-1 --overprovisioned 1 --smp 1
ports:
- 9042:9042
networks:
- scylla

scylla-2:
image: scylladb/scylla
hostname: scylla-2
command: --seeds scylla-1 --broadcast-address scylla-2 --listen-address scylla-2 --overprovisioned 1 --smp 1
networks:
- scylla
ports:
- 9043:9042
depends_on:
- scylla-1

scylla-3:
image: scylladb/scylla
hostname: scylla-3
command: --seeds scylla-1 --broadcast-address scylla-3 --listen-address scylla-3 --overprovisioned 1 --smp 1
networks:
- scylla
ports:
- 9044:9042
depends_on:
- scylla-1

nats:
image: nats:latest
ports:
- 4222:4222
networks:
- scylla

networks:
scylla:
driver: bridge
26 changes: 26 additions & 0 deletions examples/scylla-storage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict'

const Skyring = require('skyring')

const server = new Skyring({
storage: {
backend: '@skyring/scylladown'
}
})

server.listen(process.env.PORT || 3000, (err) => {
if(err) {
process.exitCode = 1;
console.error(err);
throw err;
}
console.log('server listening');
});

function onSignal() {
server.close(()=>{
console.log('shutting down');
});
}
process.once('SIGINT', onSignal);
process.once('SIGTERM', onSignal);
Loading

0 comments on commit 554a5bb

Please sign in to comment.