diff --git a/analytics/.dockerignore b/analytics/.dockerignore index 4a0e90e..0a87603 100644 --- a/analytics/.dockerignore +++ b/analytics/.dockerignore @@ -1,3 +1,5 @@ .git -node_modules npm-debug +node_modules +__pychache__ +.vscode diff --git a/analytics/Dockerfile b/analytics/Dockerfile index 79a71ec..c1e80eb 100644 --- a/analytics/Dockerfile +++ b/analytics/Dockerfile @@ -2,7 +2,7 @@ FROM python:3.6.6 VOLUME [ "/var/www/data" ] -COPY analytics/ /var/www/analytics/ +COPY . /var/www/analytics/ WORKDIR /var/www/analytics diff --git a/docker-compose.yml b/docker-compose.yml index 6341237..89d9906 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,23 @@ version: '2' services: server: - build: server + image: hastic-server + #build: server + environment: + HASTIC_API_KEY: "eyJrIjoiNzhiYjIyTGZDMjY4M3lnYTNwWHo3WFVaNnVDSm9qakkiLCJuIjoiaGFzIiwiaWQiOjF9" + ZMQ_HOST: analytics volumes: - - "/var/www/data" + - data-volume:/var/www/data ports: - - data-volume:"8000:8000" + - 8000:8000 privileged: true - ipc: host - # deploy: - # restart_policy: - # condition: on-failure - + analytics: - build: analytics + image: hastic-analytics + #build: analytics volumes: - - data-volume:"/var/www/data" - ports: - - "8002:8002" + - data-volume:/var/www/data privileged: true - ipc: host - # deploy: - # restart_policy: - # condition: on-failure volumes: data-volume: diff --git a/server/.dockerignore b/server/.dockerignore index 4a0e90e..cf23c6e 100644 --- a/server/.dockerignore +++ b/server/.dockerignore @@ -1,3 +1,4 @@ .git node_modules npm-debug +.vscode diff --git a/server/Dockerfile b/server/Dockerfile index 2aa9945..6db9cae 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -2,7 +2,7 @@ FROM python:3.6.6 VOLUME [ "/var/www/data" ] -COPY server /var/www/ +COPY . /var/www/ WORKDIR /var/www/server diff --git a/server/src/config.ts b/server/src/config.ts index 46349b9..ced4f12 100644 --- a/server/src/config.ts +++ b/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_IPC_PATH = getConfigField('ZMQ_IPC_PATH', path.join(os.tmpdir(), 'hastic')); 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 ANLYTICS_PING_INTERVAL = 500; // ms diff --git a/server/src/services/analytics_service.ts b/server/src/services/analytics_service.ts index 94413b2..5592a20 100644 --- a/server/src/services/analytics_service.ts +++ b/server/src/services/analytics_service.ts @@ -69,7 +69,7 @@ export class AnalyticsService { this._requester = zmq.socket('pair'); 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) { this._zmqConnectionString = config.ZMQ_CONNECTION_STRING; if(this._zmqConnectionString === null) {