Browse Source

fix ZMQ connection string

pull/1/head
amper43 6 years ago
parent
commit
f72cc35589
  1. 4
      analytics/.dockerignore
  2. 2
      analytics/Dockerfile
  3. 25
      docker-compose.yml
  4. 1
      server/.dockerignore
  5. 2
      server/Dockerfile
  6. 1
      server/src/config.ts
  7. 2
      server/src/services/analytics_service.ts

4
analytics/.dockerignore

@ -1,3 +1,5 @@
.git .git
node_modules
npm-debug npm-debug
node_modules
__pychache__
.vscode

2
analytics/Dockerfile

@ -2,7 +2,7 @@ FROM python:3.6.6
VOLUME [ "/var/www/data" ] VOLUME [ "/var/www/data" ]
COPY analytics/ /var/www/analytics/ COPY . /var/www/analytics/
WORKDIR /var/www/analytics WORKDIR /var/www/analytics

25
docker-compose.yml

@ -1,28 +1,23 @@
version: '2' version: '2'
services: services:
server: server:
build: server image: hastic-server
#build: server
environment:
HASTIC_API_KEY: "eyJrIjoiNzhiYjIyTGZDMjY4M3lnYTNwWHo3WFVaNnVDSm9qakkiLCJuIjoiaGFzIiwiaWQiOjF9"
ZMQ_HOST: analytics
volumes: volumes:
- "/var/www/data" - data-volume:/var/www/data
ports: ports:
- data-volume:"8000:8000" - 8000:8000
privileged: true privileged: true
ipc: host
# deploy:
# restart_policy:
# condition: on-failure
analytics: analytics:
build: analytics image: hastic-analytics
#build: analytics
volumes: volumes:
- data-volume:"/var/www/data" - data-volume:/var/www/data
ports:
- "8002:8002"
privileged: true privileged: true
ipc: host
# deploy:
# restart_policy:
# condition: on-failure
volumes: volumes:
data-volume: data-volume:

1
server/.dockerignore

@ -1,3 +1,4 @@
.git .git
node_modules node_modules
npm-debug npm-debug
.vscode

2
server/Dockerfile

@ -2,7 +2,7 @@ FROM python:3.6.6
VOLUME [ "/var/www/data" ] VOLUME [ "/var/www/data" ]
COPY server /var/www/ COPY . /var/www/
WORKDIR /var/www/server WORKDIR /var/www/server

1
server/src/config.ts

@ -20,6 +20,7 @@ export const HASTIC_PORT = getConfigField('HASTIC_PORT', '8000');
export const ZMQ_CONNECTION_STRING = getConfigField('ZMQ_CONNECTION_STRING', null); export const ZMQ_CONNECTION_STRING = getConfigField('ZMQ_CONNECTION_STRING', null);
export const ZMQ_IPC_PATH = getConfigField('ZMQ_IPC_PATH', path.join(os.tmpdir(), 'hastic')); export const ZMQ_IPC_PATH = getConfigField('ZMQ_IPC_PATH', path.join(os.tmpdir(), 'hastic'));
export const ZMQ_DEV_PORT = getConfigField('ZMQ_DEV_PORT', '8002'); export const ZMQ_DEV_PORT = getConfigField('ZMQ_DEV_PORT', '8002');
export const ZMQ_HOST = getConfigField('ZMQ_HOST', '127.0.0.1');
export const HASTIC_API_KEY = getConfigField('HASTIC_API_KEY'); export const HASTIC_API_KEY = getConfigField('HASTIC_API_KEY');
export const ANLYTICS_PING_INTERVAL = 500; // ms export const ANLYTICS_PING_INTERVAL = 500; // ms

2
server/src/services/analytics_service.ts

@ -69,7 +69,7 @@ export class AnalyticsService {
this._requester = zmq.socket('pair'); this._requester = zmq.socket('pair');
let productionMode = process.env.NODE_ENV !== 'development' && process.env.INSIDE_DOCKER !== 'true'; let productionMode = process.env.NODE_ENV !== 'development' && process.env.INSIDE_DOCKER !== 'true';
this._zmqConnectionString = `tcp://127.0.0.1:${config.ZMQ_DEV_PORT}`; // debug mode this._zmqConnectionString = `tcp://${config.ZMQ_HOST}:${config.ZMQ_DEV_PORT}`; // debug mode
if(productionMode) { if(productionMode) {
this._zmqConnectionString = config.ZMQ_CONNECTION_STRING; this._zmqConnectionString = config.ZMQ_CONNECTION_STRING;
if(this._zmqConnectionString === null) { if(this._zmqConnectionString === null) {

Loading…
Cancel
Save