From 6f5d5e501c6bc8f02dc379dda57010e775fadd6f Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 27 May 2020 18:34:35 +0000 Subject: [PATCH] rocketchat --- production/rocket/docker-compose.yml | 128 ++++++++++++++++++ production/rocket/hubot/Dockerfile | 59 ++++++++ production/rocket/hubot/entrypoint.sh | 3 + production/rocket/hubot/external-scripts.json | 33 +++++ production/rocket/rocketchat/Dockerfile | 19 +++ production/rocket/rocketchat/entrypoint.sh | 11 ++ 6 files changed, 253 insertions(+) create mode 100644 production/rocket/docker-compose.yml create mode 100644 production/rocket/hubot/Dockerfile create mode 100644 production/rocket/hubot/entrypoint.sh create mode 100644 production/rocket/hubot/external-scripts.json create mode 100644 production/rocket/rocketchat/Dockerfile create mode 100644 production/rocket/rocketchat/entrypoint.sh diff --git a/production/rocket/docker-compose.yml b/production/rocket/docker-compose.yml new file mode 100644 index 0000000..0608cf9 --- /dev/null +++ b/production/rocket/docker-compose.yml @@ -0,0 +1,128 @@ +version: '2' +services: + db-rocketchat1: + image: mongo + restart: always + container_name: db-rocketchat1 + hostname: db-rocketchat1 + command: --keyFile /opt/keyfile --replSet "rs0" + volumes: + - ./mongo/data1:/data/db + - ./mongo/mongodb-keyfile:/opt/keyfile + networks: + mynet: + ipv4_address: 172.133.0.99 + + db-rocketchat2: + image: mongo + restart: always + container_name: db-rocketchat2 + hostname: db-rocketchat2 + command: --keyFile /opt/keyfile --replSet "rs0" + volumes: + - ./mongo/data2:/data/db + - ./mongo/mongodb-keyfile:/opt/keyfile + networks: + mynet: + ipv4_address: 172.133.0.100 + + rocketchat: + image: rocket.chat +# build: ./rocketchat + restart: always + container_name: rocketchat + hostname: rocketchat + extra_hosts: + - "rocketchat:172.133.0.101" + - "rocketchat:172.200.0.2" + - "smtp.hatthieves.es:172.200.0.101" +# entrypoint: +# - /bin/bash +# - /entrypoint.sh + environment: + - MONGO_URL=mongodb://db-rocketchat1:27017/rocketchat + - ROOT_URL=https://talk.hatthieves.es + - PORT=3000 + - MAIL_URL=smtp.hatthieves.es + - Accounts_UseDNSDomainCheck=False + - NODE_ENV=production + - Accounts_AvatarStorePath=/app/uploads + - MONGO_URL=mongodb://rocket:p4ssw0rd@db-rocketchat1:27017,db-rocketchat2:27017/rocketchat?authSource=admin&replicaSet=rs0&readPreference=nearest&w=majority + - MONGO_OPLOG_URL=mongodb://oploguser:p4ssw0rd@db-rocketchat1:27017,db-rocketchat2:27017/local?authSource=admin&replicaSet=rs0 + - INSTANCE_IP=172.133.0.101 + volumes: +# - ./rocketchat/entrypoint.sh:/entrypoint.sh:ro + - ./rocketchat/uploads:/app/uploads +# - ./rocketchat/turnserver.conf:/etc/turnserver.conf:ro +# - ./rocketchat/coturn:/etc/default/coturn:ro +# - /opt/docker/secure/privkey.pem:/etc/turn_server_pkey.pem:ro +# - /opt/docker/secure/fullchain.pem:/etc/turn_server_cert.pem:ro + links: + - db-rocketchat1:db-rocketchat1 + - db-rocketchat2:db-rocketchat2 + depends_on: + - db-rocketchat1 + - db-rocketchat2 + expose: + - 3000 +# ports: +# - 3478:3478/tcp +# - 3478:3478/udp +# - 5349:5349/tcp +# - 5349:5349/udp + networks: + mynet: + ipv4_address: 172.133.0.101 + wildduck: + + hubot: + build: ./hubot + restart: always + container_name: hubot + hostname: hubot + entrypoint: + - /bin/bash + - /entrypoint.sh +# environment: +# - ROCKETCHAT_URL=https://talk.hatthieves.es +# - ROCKETCHAT_ROOM='' +# - ROCKETCHAT_USER=rocketbot +# - ROCKETCHAT_PASSWORD=vL6atw8ynmcErpagZ +# - BOT_NAME=RocketBot +# - LISTEN_ON_ALL_PUBLIC=true +# - ROCKETCHAT_AUTH=password +# - EXTERNAL_SCRIPTS=hubot-help,hubot-seen,hubot-links,hubot-greetings +# - EXTERNAL_SCRIPTS=hubot-help,hubot-seen,hubot-links,hubot-diagnostics,hubot-google,hubot-reddit,hubot-bofh,hubot-bookmark,hubot-shipit,hubot-maps,hubot-pugme + volumes: + - ./hubot/entrypoint.sh:/entrypoint.sh + links: + - rocketchat:rocketchat +# this is used to expose the hubot port for notifications on the host on port 3001, e.g. for hubot-jenkins-notifier + expose: + - 3001 + networks: + mynet: + ipv4_address: 172.133.0.102 + + redis: + image: redis:alpine + hostname: redis-rocketchat + container_name: redis-rocketchat + restart: always + volumes: + - ./redis:/data + expose: + - 6379 + networks: + mynet: + ipv4_address: 172.133.0.103 + +networks: + mynet: + driver: bridge + ipam: + config: + - subnet: 172.133.0.0/24 + wildduck: + external: + name: harakawildduck_mynet diff --git a/production/rocket/hubot/Dockerfile b/production/rocket/hubot/Dockerfile new file mode 100644 index 0000000..2b979ab --- /dev/null +++ b/production/rocket/hubot/Dockerfile @@ -0,0 +1,59 @@ +FROM node:10-slim +RUN apt update && apt -y upgrade && apt -y install git sudo python build-essential && apt clean +RUN mkdir -p /hubot/scripts +RUN useradd -ms /bin/bash hubot +RUN chown hubot.hubot -R /hubot +WORKDIR /hubot +USER hubot +RUN npm install --single-threaded \ +coffeescript \ +yo \ +generator-hubot \ +hubot +RUN node node_modules/.bin/yo hubot --owner="No owner specified" --name="rocketbot" --description="Hubot with rocketbot adapter" --defaults +RUN npm install --single-threaded \ +hubot-scripts \ +hubot-rocketchat \ +hubot-help \ +hubot-seen \ +hubot-links \ +hubot-phrases \ +hubot-putear \ +hubot-country \ +hubot-morse \ +hubot-fun \ +hubot-pony \ +hubot-suggest \ +hubot-url-title \ +hubot-current-time \ +hubot-lmgtfy \ +hubot-thesimpsons \ +hubot-victory \ +hubot-plusplus \ +hubot-diagnostics \ +hubot-anon \ +hubot-anime-dl \ +hubot-taboo-topics \ +hubot-pugme \ +hubot-maps \ +hubot-rules \ +hubot-shipit \ +hubot-motivate \ +hubot-encourage \ +hubot-ascii-art \ +hubot-wikipedia-lang \ +hubot-markov \ +hubot-brain-inspect \ +hubot-qr-generator +RUN npm install --single-threaded +RUN cp -r node_modules/hubot-* scripts/ +ADD ./external-scripts.json /external-scripts.json +RUN cp /external-scripts.json /hubot/external-scripts.json +ENV ROCKETCHAT_URL http://172.133.0.101:3000 +ENV ROCKETCHAT_ROOM general +ENV ROCKETCHAT_USER rocketbot +ENV ROCKETCHAT_PASSWORD RbwX6hrPPpjgdBaCX +ENV BOT_NAME RocketBot +#ENV LISTEN_ON_ALL_PUBLIC true +ENV ROCKETCHAT_AUTH password +ENV REDIS_URL redis://172.133.0.103:6379/rocketchat diff --git a/production/rocket/hubot/entrypoint.sh b/production/rocket/hubot/entrypoint.sh new file mode 100644 index 0000000..e297d9c --- /dev/null +++ b/production/rocket/hubot/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash +sleep 120s +node node_modules/.bin/coffee node_modules/.bin/hubot --name rocketbot -n RocketBot -a rocketchat diff --git a/production/rocket/hubot/external-scripts.json b/production/rocket/hubot/external-scripts.json new file mode 100644 index 0000000..9890b97 --- /dev/null +++ b/production/rocket/hubot/external-scripts.json @@ -0,0 +1,33 @@ +[ + "hubot-help", + "hubot-redis-brain", + "hubot-seen", + "hubot-links", + "hubot-putear", + "hubot-country", + "hubot-morse", + "hubot-fun", + "hubot-pony", + "hubot-diagnostics", + "hubot-pugme", + "hubot-maps", + "hubot-rules", + "hubot-shipit", + "hubot-suggest", + "hubot-url-title", + "hubot-current-time", + "hubot-lmgtfy", + "hubot-thesimpsons", + "hubot-victory", + "hubot-plusplus", + "hubot-motivate", + "hubot-encourage", + "hubot-anon", + "hubot-anime-dl", + "hubot-taboo-topics", + "hubot-ascii-art", + "hubot-wikipedia-lang", + "hubot-markov", + "hubot-brain-inspect", + "hubot-qr-generator" +] diff --git a/production/rocket/rocketchat/Dockerfile b/production/rocket/rocketchat/Dockerfile new file mode 100644 index 0000000..7bc23e4 --- /dev/null +++ b/production/rocket/rocketchat/Dockerfile @@ -0,0 +1,19 @@ +FROM node:12-slim +ENV VERSION latest +RUN apt update && apt -y upgrade && apt -y install \ +build-essential \ +curl \ +wget \ +rsync \ +git \ +xz-utils \ +ca-certificates \ +procps \ +python \ +&& apt clean +WORKDIR /home/node +USER node +RUN wget -q https://releases.rocket.chat/$VERSION/download && tar -zxf download && rm download +WORKDIR /home/node/bundle/programs/server +RUN npm install && mkdir /home/node/uploads +WORKDIR /home/node/bundle diff --git a/production/rocket/rocketchat/entrypoint.sh b/production/rocket/rocketchat/entrypoint.sh new file mode 100644 index 0000000..8cddda0 --- /dev/null +++ b/production/rocket/rocketchat/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +export ROOT_URL="https://talk.hatthieves.es" +export PORT=3000 +export MAIL_URL="smtp.hatthieves.es" +export Accounts_UseDNSDomainCheck="False" +export NODE_ENV="production" +export Accounts_AvatarStorePath="/home/rocketchat/uploads" +export MONGO_URL="mongodb://rocket:p4%24%24w0rd@db-rocketchat1:27017,db-rocketchat2:27017/rocketchat?authSource=admin&replicaSet=rs0&readPreference=nearest&w=majority" +export MONGO_OPLOG_URL="mongodb://oploguser:p4%24%24w0rd@db-rocketchat1:27017,db-rocketchat2:27017/local?authSource=admin&replicaSet=rs0" +export INSTANCE_IP="172.133.0.101" +node main.js