Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.dockerignore
Dockerfile
.git
.gitignore
.gitmodules
docker-compose.yml
secrets.env.json
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:15
WORKDIR /app
RUN apt update && apt install -y netcat
ADD --chmod=755 https://raw.githubusercontent.com/eficode/wait-for/v2.2.1/wait-for /app/wait-for
ADD package.json yarn.lock /app/
RUN yarn install
ADD . /app
RUN yarn && yarn build-deps
RUN chmod 0755 /app/wait-for
CMD ["yarn", "backend-start"]
41 changes: 41 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3.3'
services:
backend:
build: .
command: /app/wait-for dgraph-alpha:9080 -- yarn backend-start dgraph-alpha:9080
volumes:
- ./secrets.env.json:/app/secrets.env.json
depends_on:
- dgraph-zero
- dgraph-alpha
ports:
- 3001:3001
frontend:
build: .
entrypoint: yarn explorer-start
depends_on:
- backend
ports:
- 3000:3000
dgraph-zero:
ports:
- '5080:5080'
- '6080:6080'
restart: unless-stopped
image: ebdm/unigraph-dgraph
command: dgraph zero --my=dgraph-zero:5080
dgraph-alpha:
ports:
- '9080:9080'
- '8080:8080'
restart: unless-stopped
image: ebdm/unigraph-dgraph
command: dgraph alpha --my=dgraph-alpha:7080 --zero=dgraph-zero:5080 --whitelist="172.22.0.0/24"
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: "172.22.0.0/24"
gateway: "172.22.0.1"
2 changes: 1 addition & 1 deletion packages/unigraph-dev-backend/src/dgraphClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class DgraphClient {
constructor(connectionUri: string) {
this.dgraphClientStub = new DgraphClientStub(connectionUri, undefined, {'grpc.max_receive_message_length': 1024 * 1024 * 1024});
this.dgraphClientStub.checkVersion(new Check()).catch(e => {if (e.code === 14) {
throw new Error("Could not establish connection to Dgraph client, exiting...");
throw new Error(`Could not establish connection to Dgraph client at ${connectionUri}, exiting...`);
}})
this.dgraphClient = new ActualDgraphClient(this.dgraphClientStub);
this.txnlock = getAsyncLock();
Expand Down
4 changes: 3 additions & 1 deletion packages/unigraph-dev-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import Client from './dgraphClient';
import startServer from './server';

async function main() {
const client = new Client('localhost:9080');
const args = process.argv.slice(2);
const dgraphAddress = args[0] || 'localhost:9080';
const client = new Client(dgraphAddress);
const [app, server] = await startServer(client);

server.on('close', () => (console.log('CLOSING'), client.close()));
Expand Down