diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..824c59d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +quickX3 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c477cf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +quickX3/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c064cdf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +FROM python:2.7-buster +LABEL maintainer="Emerson Rocha " + +# @see https://hub.docker.com/_/python +# @see https://github.com/docker-library/docs/tree/master/python#how-to-use-this-image +# @see https://github.com/HXLStandard/hxl-proxy/blob/master/Dockerfile + +# File initialy based on # @see https://github.com/fititnt/uwazi-docker/blob/master/Dockerfile + +## Install common software +RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \ + bzip2 \ + dh-autoreconf \ + git + +# ## Download Uwazi v1.4 +# RUN git clone -b v1.4 --single-branch --depth=1 https://github.com/huridocs/uwazi.git /home/node/uwazi/ \ +# && chown node:node -R /home/node/uwazi/ \ +# && cd /home/node/uwazi/ \ +# && yarn install \ +# && yarn production-build + +RUN git clone -b master --single-branch --depth=1 https://github.com/SimonbJohnson/quickX3.git /usr/src/app/ +# RUN git clone -b master --single-branch --depth=1 https://github.com/SimonbJohnson/quickX3.git /usr/src/app/ \ +# && chown node:node -R /home/node/uwazi/ \ +# && cd /home/node/uwazi/ \ +# && yarn install \ +# && yarn production-build + +WORKDIR /usr/src/app/ +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +#COPY --chown=node:node docker-entrypoint.sh /docker-entrypoint.sh +COPY docker-entrypoint.sh /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 5d8875a..a9d5a59 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ # hxldash-docker [draft] Unofficial dockerized version of HXLdash ("Create data visualisations quickly by leveraging the HXL - Humanitarian eXchange Language") for local development. The hosted version (maintained by British Red Cross) is at https://hxldash.com/ + +## Usage + +```bash +docker build -t hxldash . +docker run -it --rm --name hxldash-app hxldash +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..68d79b0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,174 @@ +# From https://github.com/fititnt/uwazi-docker/blob/master/docker-compose.yml + +version: "3" + +services: + uwazi: + build: ./ + working_dir: /home/node/uwazi + ports: + - 3000:3000 + environment: + - DBHOST=mongo + - DATABASE_NAME=uwazi_development + - ELASTICSEARCH_URL=http://elasticsearch:9200 + - UPLOADS_FOLDER=/data/uploaded_documents + # - LOGS_DIR=/path/to/log + - IS_FIRST_RUN=${IS_FIRST_RUN:-false} + volumes: + - uploaded_documents:/data/uploaded_documents + depends_on: + - elasticsearch + - mongo + + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:5.5.3 + restart: unless-stopped + command: elasticsearch -Expack.security.enabled=false -Ecluster.name=docker-cluster -Ehttp.port=9200 -Ehttp.cors.allow-origin="http://localhost:51000" -Ehttp.cors.enabled=true -Ehttp.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -Ehttp.cors.allow-credentials=true + environment: + - cluster.name=docker-cluster + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + - xpack.security.enabled=false + ulimits: + memlock: + soft: -1 + hard: -1 + volumes: + - elasticsearch_data1:/usr/share/elasticsearch/data + # Close these ports. No unprotected elasticsearch should be published. + # ports: + # - 9200:9200 + + # dejavu "The Missing Web UI for Elasticsearch" + # See https://github.com/appbaseio/dejavu + # To configure, access http://localhost:51000 and use: + # http://localhost:9200 + # uwazi_development + elasticsearch-gui-dejavu: + image: appbaseio/dejavu:latest + ports: + #- "1358:1358" + - "51000:1358" + depends_on: + - elasticsearch + + mongo: + image: mongo:3.4 + restart: unless-stopped + volumes: + # - ./data/mongo:/data/db + - mongodb_data1:/data/db + command: mongod --smallfiles + # Don't publish unprotected mongod + # ports: + # - 27017:27017 + logging: + options: + max-size: 10m + max-file: '3' + + # Cross-platform and self hosted, easy to use mongodb management tool - Formerly Mongoclient + # See https://github.com/nosqlclient/nosqlclient + mongo-gui-mongoclient: + image: mongoclient/mongoclient:latest + volumes: + - ./data/mongo:/data/db + environment: + - MONGO_URL=mongodb://mongo:27017 + depends_on: + - mongo + ports: + - 52000:3000 + +volumes: + uploaded_documents: + driver: local + mongodb_data1: + driver: local + elasticsearch_data1: + driver: local +services: + uwazi: + build: ./ + working_dir: /home/node/uwazi + ports: + - 3000:3000 + environment: + - DBHOST=mongo + - DATABASE_NAME=uwazi_development + - ELASTICSEARCH_URL=http://elasticsearch:9200 + - UPLOADS_FOLDER=/data/uploaded_documents + # - LOGS_DIR=/path/to/log + - IS_FIRST_RUN=${IS_FIRST_RUN:-false} + volumes: + - uploaded_documents:/data/uploaded_documents + depends_on: + - elasticsearch + - mongo + + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:5.5.3 + restart: unless-stopped + command: elasticsearch -Expack.security.enabled=false -Ecluster.name=docker-cluster -Ehttp.port=9200 -Ehttp.cors.allow-origin="http://localhost:51000" -Ehttp.cors.enabled=true -Ehttp.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -Ehttp.cors.allow-credentials=true + environment: + - cluster.name=docker-cluster + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + - xpack.security.enabled=false + ulimits: + memlock: + soft: -1 + hard: -1 + volumes: + - elasticsearch_data1:/usr/share/elasticsearch/data + # Close these ports. No unprotected elasticsearch should be published. + # ports: + # - 9200:9200 + + # dejavu "The Missing Web UI for Elasticsearch" + # See https://github.com/appbaseio/dejavu + # To configure, access http://localhost:51000 and use: + # http://localhost:9200 + # uwazi_development + elasticsearch-gui-dejavu: + image: appbaseio/dejavu:latest + ports: + #- "1358:1358" + - "51000:1358" + depends_on: + - elasticsearch + + mongo: + image: mongo:3.4 + restart: unless-stopped + volumes: + # - ./data/mongo:/data/db + - mongodb_data1:/data/db + command: mongod --smallfiles + # Don't publish unprotected mongod + # ports: + # - 27017:27017 + logging: + options: + max-size: 10m + max-file: '3' + + # Cross-platform and self hosted, easy to use mongodb management tool - Formerly Mongoclient + # See https://github.com/nosqlclient/nosqlclient + mongo-gui-mongoclient: + image: mongoclient/mongoclient:latest + volumes: + - ./data/mongo:/data/db + environment: + - MONGO_URL=mongodb://mongo:27017 + depends_on: + - mongo + ports: + - 52000:3000 + +volumes: + uploaded_documents: + driver: local + mongodb_data1: + driver: local + elasticsearch_data1: + driver: local \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..edfde7a --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +whoami + +python --version + +pwd + +ls -lha /usr/src/app/ + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d5d3322 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +django +psycopg2 +django-cookie-law \ No newline at end of file