Browse Source

WIP

pull/1/head
amper43 6 years ago
parent
commit
15fd7a2b38
  1. 6
      Dockerfile_analytics
  2. 28
      Dockerfile_server
  3. 9
      Makefile
  4. 0
      config.example.json
  5. 23
      docker-compose.yml
  6. 2
      server/src/services/analytics_service.ts

6
Dockerfile_analytics

@ -4,12 +4,12 @@ EXPOSE 8000
VOLUME [ "/var/www/data" ] VOLUME [ "/var/www/data" ]
COPY analytics config /var/www COPY analytics /var/www
WORKDIR /var/www/analytics WORKDIR /var/www/analytics
RUN pip install -r requirements.txt && RUN pip install -r requirements.txt \
apt-get update && apt-get install -y \ && apt-get update && apt-get install -y \
gnupg \ gnupg \
curl \ curl \
make \ make \

28
Dockerfile_server

@ -1,23 +1,23 @@
FROM alpine:3.8 FROM python:3.6.6
EXPOSE 8000
VOLUME [ "/var/www/data" ] VOLUME [ "/var/www/data" ]
COPY server config /var/www COPY server /var/www/
WORKDIR /var/www/server WORKDIR /var/www/server
#RUN apt-get update && apt-get install -y \ RUN apt-get install curl \
# gnupg \ bash \
# curl \ gnupg \
# make \ curl \
# g++ make \
g++ \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get update \
&& apt-get install nodejs \
&& npm install \
&& npm run build
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && ENV INSIDE_DOCKER true
apt-get update &&
apt-get install -y nodejs &&
npm install &&
npm run build
CMD ["npm", "start"] CMD ["npm", "start"]

9
Makefile

@ -0,0 +1,9 @@
.PHONY: server analytics
server:
docker build . -f Dockerfile_server
analytics:
docker build . -f Dockerfile_analytics
all: server analytics

0
config/config.example.json → config.example.json

23
docker-compose.yml

@ -0,0 +1,23 @@
version: '3'
services:
server:
build:
dockerfile: Dockerfile_server
volumes:
- "/var/www/data"
ports:
- data-volume:"8000:8000"
privileged: true
ipc: host
analytics:
build:
dockerfile: Dockerfile_analytics
volumes:
- data-volume:"/var/www/data"
ports:
- "8002:8002"
privileged: true
ipc: host
volumes:
data-volume:

2
server/src/services/analytics_service.ts

@ -67,7 +67,7 @@ export class AnalyticsService {
private async _init() { private async _init() {
this._requester = zmq.socket('pair'); this._requester = zmq.socket('pair');
let productionMode = process.env.NODE_ENV !== 'development'; 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://127.0.0.1:${config.ZMQ_DEV_PORT}`; // debug mode
if(productionMode) { if(productionMode) {

Loading…
Cancel
Save