Skip to content

Commit

Permalink
Start gremlin servers with docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmusso committed Jun 4, 2017
1 parent 9cc5c1f commit 678fede
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ cache:
yarn: true

before_install:
- docker run -d -p 8182:8182 jbmusso/gremlin-server:$GREMLIN_SERVER_VERSION conf/gremlin-server-classic.yaml
- docker ps -a
- docker-compose up

install:
- yarn
Expand Down
71 changes: 71 additions & 0 deletions ci/conf/gremlin-server-secure-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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:https://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.

##############################################################
# This configuration is meant to be a "quick start" for a
# secure configuration of Gremlin Server. Keep in mind that
# this configuration uses a generated self-signed certificate
# for SSL and a not so secure TinkerGraph for the credential
# store - not suitable for production.
##############################################################

host: 0.0.0.0
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
graph: conf/tinkergraph-empty.properties}
plugins:
- tinkerpop.tinkergraph
scriptEngines: {
gremlin-groovy: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI],
scripts: [scripts/empty-sample-secure.groovy],
config: {
compilerCustomizerProviders: {
"org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ThreadInterruptCustomizerProvider":[],
"org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider":[10000],
"org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompileStaticCustomizerProvider":["org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.SimpleSandboxExtension"]}}}}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+gryo
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+gryo-lite
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }} # application/vnd.gremlin-v1.0+gryo-stringd
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+json
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2d0] }} # application/vnd.gremlin-v2.0+json
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/json
processors:
- { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
- { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
consoleReporter: {enabled: true, interval: 180000},
csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
jmxReporter: {enabled: true},
slf4jReporter: {enabled: true, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}}
strictTransactionManagement: false
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
enabled: true}
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
version: '2'
services:
gremlin-server:
image: jbmusso/gremlin-server:${GREMLIN_SERVER_VERSION}
command: conf/gremlin-server-classic.yaml
ports:
- "8182:8182"
gremlin-server-secure:
image: jbmusso/gremlin-server:${GREMLIN_SERVER_VERSION}
entrypoint: /opt/gremlin-server/bin/gremlin-server.sh
command: conf/gremlin-server-secure-ci.yaml
volumes:
- ./ci/conf/gremlin-server-secure-ci.yaml:/opt/gremlin-server/conf/gremlin-server-secure-ci.yaml
ports:
- "8192:8182"
2 changes: 2 additions & 0 deletions src/GremlinClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class GremlinClient extends EventEmitter {
* @param {MessageEvent} event
*/
handleProtocolMessage(message) {
console.log('------------------------------------------------')
console.log(this.options)
let rawMessage, requestId, statusCode, statusMessage;
try {
const { data } = message;
Expand Down
2 changes: 1 addition & 1 deletion src/bindForClient.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('chai').should();

import { createClient, bindForClient } from '../';
import { createClient, bindForClient } from './';
import { assert } from 'chai';


Expand Down
2 changes: 1 addition & 1 deletion src/bindings.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('chai').should();
/*jshint -W030 */
import gremlin from '../';
import gremlin from './';


describe('Bindings', function() {
Expand Down
2 changes: 1 addition & 1 deletion src/buildCommand.session.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('chai').should();

import gremlin from '../';
import gremlin from './';

describe('.buildMessage()', function() {
describe('session', function() {
Expand Down
13 changes: 8 additions & 5 deletions src/createClient.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require('chai').should();
import gremlin from '../';
import gremlin from './';
import { assert } from 'chai';


describe('.createClient()', function() {
Expand Down Expand Up @@ -89,18 +90,20 @@ describe('.createClient()', function() {
});
});

describe.skip('Secure WebSocket', () => {
describe.only('Secure WebSocket', () => {
it('should support secure SSL websockets', (done) => {
const client = gremlin.createClient({
const client = gremlin.createClient(8192/* start with docker-compose */, {
ssl: true,
rejectUnauthorized: false, // using TP-dev self-signed certificate
});

client.options.ssl.should.equal(true);
client.options.rejectUnauthorized.should.equal(false);

client.execute('g.V()', (err, results) => {
results.length.should.equal(6);
client.execute('1+1', (err, result) => {
console.log(err, result)
assert.equal(result, 2);
// result.should.equal("2");
done();
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/execute.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('chai').should();
import { assert } from 'chai';
import gremlin, { statics } from '../';
import gremlin, { statics } from './';


describe('.execute()', function() {
Expand Down
2 changes: 1 addition & 1 deletion src/makeTemplateTag.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require('chai').should();
import { createClient, makeTemplateTag } from '../';
import { createClient, makeTemplateTag } from './';
import { assert } from 'chai';

const client = createClient();
Expand Down
2 changes: 1 addition & 1 deletion src/messageStream.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require('chai').should();
import gremlin from '../';
import gremlin from './';


describe('.messageStream', function() {
Expand Down
2 changes: 1 addition & 1 deletion src/stream.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require('chai').should();
import gremlin from '../';
import gremlin from './';


describe('.stream()', function() {
Expand Down

0 comments on commit 678fede

Please sign in to comment.