Skip to content

Deployment

DavidZ edited this page May 25, 2022 · 4 revisions

InfluenceMap

InfluenceMap consists of four modules.

The dependency graph is shown below:

Steps

Prepare data

  1. Elasticsearch data e.g. /data/elasticsearch/data.
  2. Bingraph data e.g. /data/bingraph.

Clone the project

git clone https://github.com/csmetrics/influencemap.git
cd influencemap

Configure ports, volumes and environment variables in the compose.yaml

services:
  konigsberg:
    build:
      context: .
      dockerfile: konigsberg.dockerfile
    restart: unless-stopped
    volumes:
      - /data/bingraph:/influencemap/bingraph # <-- !!!
    environment:
      GUNICORN_CMD_ARGS: --workers 32 --timeout 90 --graceful-timeout 90 --bind 0.0.0.0:8000 # <-- !!!
  webapp:
    build:
      context: .
      dockerfile: webapp.dockerfile
    restart: unless-stopped
    ports:
      - "8001:8000" # <-- !!!
    environment:
      KONIGSBERG_URL: http://konigsberg:8000
      ELASTICSEARCH_URL: elasticsearch:9200
      GUNICORN_CMD_ARGS: --workers 32 --timeout 90 --graceful-timeout 90 --bind 0.0.0.0:8000 # <-- !!!
    depends_on:
      - konigsberg
      - elasticsearch
  elasticsearch:
    image: elasticsearch:6.8.23
    restart: unless-stopped
    volumes:
      - /data/elasticsearch/data:/usr/share/elasticsearch/data # <-- !!!
      - elasticsearch_config:/usr/share/elasticsearch/config
      - elasticsearch_log:/usr/share/elasticsearch/logs
    environment:
      - "discovery.type=single-node"
      - "cluster.name=elasticsearch"
      - "network.host=0.0.0.0"
      - "node.master=true"
      - "node.data=true"
      - "ES_JAVA_OPTS=-Xms32g -Xmx32g" # <-- !!!
  kibana:
    image: kibana:6.8.23
    restart: unless-stopped
    ports:
      - "8014:5601" # <--
    volumes:
      - kibana_config:/usr/share/kibana/config
      - kibana_data:/usr/share/kibana/data
      - kibana_log:/usr/share/kibana/logs
    environment:
      ELASTICSEARCH_URL: http://elasticsearch:9200
    depends_on:
      - elasticsearch
volumes:
  elasticsearch_config:
  elasticsearch_log:
  kibana_config:
  kibana_data:
  kibana_log:

Build and start all services

sudo docker compose up -d

Restart all services

sudo docker compose restart

Stop all services

sudo docker compose stop

Stop and remove all services

sudo docker compose down

Management

Portainer is a Universal Container Management System for Kubernetes, Docker/Swarm, and Nomad that simplifies container operations so you can deliver software to more places, faster

Steps

sudo docker run -d \
    -p 8010:9000 \
    --restart=unless-stopped \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v portainer_data:/data \
    --name portainer \
    portainer/portainer-ce

With watchtower you can update the running version of your containerized app simply by pushing a new image to the Docker Hub or your own image registry.

Watchtower will pull down your new image, gracefully shut down your existing container and restart it with the same options that were used when it was deployed initially.

Steps

sudo docker run -d \
    --name watchtower \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --restart=unless-stopped \
    containrrr/watchtower \
    --cleanup \
    --interval 86400 \
    netdata portainer umami uptime-kuma watchtower
  • --cleanup: Cleanup old containers and images
  • --interval: Interval in seconds to check for new images, 86400 = 1 day
  • netdata portainer umami uptime-kuma watchtower: List of container names to watch

One-time run

sudo docker run --rm \
    -v /var/run/docker.sock:/var/run/docker.sock \
    containrrr/watchtower \
    --run-once \
    --cleanup \
    netdata portainer umami uptime-kuma watchtower
  • --rm: Remove container after run
  • --run-once: Run once and exit

Monitoring

Architected for speed. Automated for easy. Monitoring and troubleshooting, transformed. Slash your time to detect, troubleshoot and resolve infrastructure performance problems. With the permanently free, zero-configuration tool that makes infrastructure monitoring and troubleshooting dramatically easier for both experts and beginners.

Steps

sudo docker run -d \
    --name=netdata \
    --restart=unless-stopped \
    -p 8011:19999 \
    -v /var/run/docker.sock:/var/run/docker.sock:ro \
    -v /etc/passwd:/host/etc/passwd:ro \
    -v /etc/group:/host/etc/group:ro \
    -v /proc:/host/proc:ro \
    -v /sys:/host/sys:ro \
    -v /etc/os-release:/host/etc/os-release:ro \
    --cap-add SYS_PTRACE \
    --security-opt apparmor=unconfined \
    netdata/netdata

It is a self-hosted monitoring tool like "Uptime Robot".

Steps

sudo docker run -d \
    --name uptime-kuma \
    --restart=unless-stopped \
    -p 8012:3001 \
    -v kuma_data:/app/data \
    louislam/uptime-kuma:1

Umami is a simple, fast, privacy-focused alternative to Google Analytics.

Steps

Create a folder

mkdir umami
cd umami

Get init SQL script

wget https://raw.githubusercontent.com/mikecao/umami/master/sql/schema.postgresql.sql

Create an .env file

HASH_SALT=replace-me-with-a-random-string
POSTGRES_PASSWORD=replace-me-with-a-password

Create a docker-compose.yaml file

version: "3"
services:
  umami:
    image: ghcr.io/mikecao/umami:postgresql-latest
    ports:
      - "8013:3000"
    environment:
      DATABASE_URL: postgresql://umami:${POSTGRES_PASSWORD}@db:5432/umami
      DATABASE_TYPE: postgresql
    depends_on:
      - db
    restart: unless-stopped
  db:
    image: postgres:12-alpine
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - ./schema.postgresql.sql:/docker-entrypoint-initdb.d/schema.postgresql.sql:ro
      - db_data:/var/lib/postgresql/data
    restart: unless-stopped
volumes:
  db_data:

Run

sudo docker compose -p umami up -d

Tips

username admin
password umami