Browse Source

Fix docker issues (#873)

pull/1/head
rozetko 5 years ago committed by GitHub
parent
commit
d0f241bb15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .dockerignore
  2. 14
      docker-compose-mongo.yml
  3. 13
      docker-compose.yml
  4. 5
      server/Dockerfile

4
.dockerignore

@ -1,4 +1,4 @@
* *
!.git/HEAD # TODO: we don't need all files from .git
!.git/refs !.git
!server !server

14
docker-compose-mongo.yml

@ -6,12 +6,10 @@ services:
dockerfile: server/Dockerfile dockerfile: server/Dockerfile
context: . context: .
environment: environment:
HASTIC_API_KEY: ${HASTIC_API_KEY?"HASTIC_API_KEY variable is required"} HASTIC_API_KEY: ${HASTIC_API_KEY?"HASTIC_API_KEY variable is required"}
GRAFANA_URL: ${GRAFANA_URL?"GRAFANA_URL variable is required"} GRAFANA_URL: ${GRAFANA_URL?"GRAFANA_URL variable is required"}
HASTIC_DB_CONNECTION_STRING: ${HASTIC_MONGO_USER:-hastic}:${HASTIC_MONGO_PASSWORD:-password}@mongo:27017/${HASTIC_MONGO_DB:-hastic} HASTIC_DB_CONNECTION_STRING: ${HASTIC_MONGO_USER:-hastic}:${HASTIC_MONGO_PASSWORD:-password}@mongo:27017/${HASTIC_MONGO_DB:-hastic}
ZMQ_CONNECTION_STRING: ${ZMQ_CONNECTION_STRING:-tcp://analytics:8002}
HASTIC_ALERT_TYPE: ${HASTIC_ALERT_TYPE} HASTIC_ALERT_TYPE: ${HASTIC_ALERT_TYPE}
HASTIC_ALERTMANAGER_URL: ${HASTIC_ALERTMANAGER_URL} HASTIC_ALERTMANAGER_URL: ${HASTIC_ALERTMANAGER_URL}
@ -24,6 +22,8 @@ services:
ports: ports:
- ${HASTIC_PORT:-8000}:8000 - ${HASTIC_PORT:-8000}:8000
networks:
- hastic-network
restart: always restart: always
depends_on: depends_on:
- mongo - mongo
@ -31,6 +31,11 @@ services:
analytics: analytics:
image: hastic/analytics:latest image: hastic/analytics:latest
build: analytics build: analytics
environment:
# TODO: use any port for server connection
HASTIC_SERVER_URL: "ws://server:8002"
networks:
- hastic-network
restart: always restart: always
mongo: mongo:
@ -39,6 +44,8 @@ services:
MONGO_INITDB_ROOT_USERNAME: ${HASTIC_MONGO_ADMIN_USER:-admin} MONGO_INITDB_ROOT_USERNAME: ${HASTIC_MONGO_ADMIN_USER:-admin}
MONGO_INITDB_ROOT_PASSWORD: ${HASTIC_MONGO_ADMIN_PASSWORD:-password} MONGO_INITDB_ROOT_PASSWORD: ${HASTIC_MONGO_ADMIN_PASSWORD:-password}
MONGO_INITDB_DATABASE: ${HASTIC_MONGO_DB:-hastic} MONGO_INITDB_DATABASE: ${HASTIC_MONGO_DB:-hastic}
networks:
- hastic-network
restart: always restart: always
volumes: volumes:
- hastic_mongo:/data/db - hastic_mongo:/data/db
@ -48,3 +55,6 @@ services:
volumes: volumes:
hastic_mongo: hastic_mongo:
hastic_mongo_config: hastic_mongo_config:
networks:
hastic-network:

13
docker-compose.yml

@ -6,12 +6,9 @@ services:
dockerfile: server/Dockerfile dockerfile: server/Dockerfile
context: . context: .
environment: environment:
HASTIC_API_KEY: ${HASTIC_API_KEY?"HASTIC_API_KEY variable is required"} HASTIC_API_KEY: ${HASTIC_API_KEY?"HASTIC_API_KEY variable is required"}
GRAFANA_URL: ${GRAFANA_URL?"GRAFANA_URL variable is required"} GRAFANA_URL: ${GRAFANA_URL?"GRAFANA_URL variable is required"}
ZMQ_CONNECTION_STRING: ${ZMQ_CONNECTION_STRING:-tcp://analytics:8002}
HASTIC_ALERT_TYPE: ${HASTIC_ALERT_TYPE} HASTIC_ALERT_TYPE: ${HASTIC_ALERT_TYPE}
HASTIC_ALERTMANAGER_URL: ${HASTIC_ALERTMANAGER_URL} HASTIC_ALERTMANAGER_URL: ${HASTIC_ALERTMANAGER_URL}
HASTIC_WEBHOOK_URL: ${HASTIC_WEBHOOK_URL} HASTIC_WEBHOOK_URL: ${HASTIC_WEBHOOK_URL}
@ -25,12 +22,22 @@ services:
- ${HASTIC_PORT:-8000}:8000 - ${HASTIC_PORT:-8000}:8000
volumes: volumes:
- data-volume:/var/www/data - data-volume:/var/www/data
networks:
- hastic-network
restart: always restart: always
analytics: analytics:
image: hastic/analytics:latest image: hastic/analytics:latest
build: analytics build: analytics
environment:
# TODO: use any port for server connection
HASTIC_SERVER_URL: "ws://server:8002"
networks:
- hastic-network
restart: always restart: always
volumes: volumes:
data-volume: data-volume:
networks:
hastic-network:

5
server/Dockerfile

@ -1,10 +1,9 @@
FROM node:8-alpine AS build FROM node:8-alpine AS build
# tools for building zeromq RUN apk add --no-cache git
RUN apk add --no-cache curl gnupg make g++ bash python
# Note: context starts in the directory above (see docker-compose file) # Note: context starts in the directory above (see docker-compose file)
COPY .git /var/www/.git
COPY server /var/www/server COPY server /var/www/server
WORKDIR /var/www/server WORKDIR /var/www/server

Loading…
Cancel
Save