Von olaf, 1 Woche vorher, geschrieben in Plain Text.
Einbetten
  1. Docker Compose
  2. ==========================================================================================================================================
  3. ersion: '3'
  4. services:
  5.  
  6.   db:
  7.     restart: always
  8.     image: postgres:9.6-alpine
  9.     shm_size: 256mb
  10.     networks:
  11.       - internal_network
  12.     healthcheck:
  13.       test: ["CMD", "pg_isready", "-U", "postgres"]
  14.     volumes:
  15.       - ./postgres:/var/lib/postgresql/data
  16.  
  17.   redis:
  18.     restart: always
  19.     image: redis:6.0-alpine
  20.     networks:
  21.       - internal_network
  22.     healthcheck:
  23.       test: ["CMD", "redis-cli", "ping"]
  24.     volumes:
  25.       - ./redis:/data
  26.  
  27. #  es:
  28. #    restart: always
  29. #    image:
  30. #    environment:
  31. #      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
  32. #      - "=es-mastodon"
  33. #      - "discovery.type=single-node"
  34. #      - "bootstrap.memory_lock=true"
  35. #    networks:
  36. #      - internal_network
  37. #    healthcheck:
  38. #    environment:
  39. #      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
  40. #      - "=es-mastodon"
  41. #      - "discovery.type=single-node"
  42. #      - "bootstrap.memory_lock=true"
  43. #    networks:
  44. #      - internal_network
  45. #    healthcheck:
  46. #      test: ["CMD-SHELL", "curl --silent --fail  || exit 1"]
  47. #    volumes:
  48. #      - ./elasticsearch:/usr/share/elasticsearch/data
  49. #    ulimits:
  50. #      memlock:
  51. #        soft: -1
  52. #        hard: -1
  53.  
  54.   web:
  55.     build: .
  56.     image: tootsuite/mastodon
  57.     restart: always
  58.     env_file: .env.production
  59.     command: bash -c "rm -f /mastodon/tmp/pids/; bundle exec rails s -p 3000"
  60.     networks:
  61.       - external_network
  62.       - internal_network
  63.     healthcheck:
  64.       test: ["CMD-SHELL", "wget -q --spider --proxy=off  || exit 1"]
  65.     ports:
  66.       - "127.0.0.1:3000:3000"
  67.     depends_on:
  68.       - db
  69.       - redis
  70. #      - es
  71.     volumes:
  72.    - ./public/system:/mastodon/public/system
  73.  
  74.   streaming:
  75.     build: .
  76.     image: tootsuite/mastodon
  77.     restart: always
  78.     env_file: .env.production
  79.     command: node ./streaming
  80.     networks:
  81.       - external_network
  82.       - internal_network
  83.     healthcheck:
  84.       test: ["CMD-SHELL", "wget -q --spider --proxy=off  || exit 1"]
  85.     ports:
  86.       - "127.0.0.1:4000:4000"
  87.     depends_on:
  88.       - db
  89.       - redis
  90.  
  91.   sidekiq:
  92.     build: .
  93.     image: tootsuite/mastodon
  94.     restart: always
  95.     env_file: .env.production
  96.     command: bundle exec sidekiq
  97.     depends_on:
  98.       - db
  99.       - redis
  100.     networks:
  101.       - external_network
  102.       - internal_network
  103.     volumes:
  104.       - ./public/system:/mastodon/public/system
  105. ## Uncomment to enable federation with tor instances along with adding the following ENV variables
  106. ## http_proxy=
  107. ## ALLOW_ACCESS_TO_HIDDEN_SERVICE=true
  108. #  tor:
  109. #    image: sirboops/tor
  110. #    networks:
  111. #      - external_network
  112. #      - internal_network
  113. #
  114. #  privoxy:
  115. #    image: sirboops/privoxy
  116. #    volumes:
  117. #      - ./priv-config:/opt/config
  118. #    networks:
  119. #      - external_network
  120. #      - internal_network
  121.  
  122. networks:
  123.   external_network:
  124.   internal_network:
  125.     internal: true
  126.  
  127. ================================================================================================================================
  128.  
  129. Dockerfile
  130.  
  131. =================================================================================================================================
  132.  
  133. FROM ubuntu:20.04 as build-dep
  134.  
  135. # Use bash for the shell
  136. SHELL ["bash", "-c"]
  137.  
  138. # Install Node v12 (LTS)
  139. ENV NODE_VER="12.16.3"
  140. RUN ARCH= && \
  141.     dpkgArch="$(dpkg --print-architecture)" && \
  142.   case "${dpkgArch##*-}" in \
  143.     amd64) ARCH='x64';; \
  144.     ppc64el) ARCH='ppc64le';; \
  145.     s390x) ARCH='s390x';; \
  146.     arm64) ARCH='arm64';; \
  147.     armhf) ARCH='armv7l';; \
  148.     i386) ARCH='x86';; \
  149.     *) echo "unsupported architecture"; exit 1 ;; \
  150.   esac && \
  151.     echo "Etc/UTC" > /etc/localtime && \
  152.         apt update && \
  153.         apt -y install wget python && \
  154.         cd ~ && \
  155.         wget  && \
  156.         tar xf node-v$NODE_VER-linux-$ARCH.tar.gz && \
  157.         rm node-v$NODE_VER-linux-$ARCH.tar.gz && \
  158.         mv node-v$NODE_VER-linux-$ARCH /opt/node
  159.  
  160. # Install jemalloc
  161. ENV JE_VER="5.2.1"
  162. RUN apt update && \
  163.         apt -y install make autoconf gcc g++ && \
  164.         cd ~ && \
  165.         wget  && \
  166.         tar xf $JE_VER.tar.gz && \
  167.         cd jemalloc-$JE_VER && \
  168.  ./ && \
  169.         ./configure --prefix=/opt/jemalloc && \
  170.         make -j$(nproc) > /dev/null && \
  171.         make install_bin install_include install_lib && \
  172.         cd .. && rm -rf jemalloc-$JE_VER $JE_VER.tar.gz
  173.  
  174. # Install Ruby
  175. ENV RUBY_VER="2.6.6"
  176. ENV CPPFLAGS="-I/opt/jemalloc/include"
  177. ENV LDFLAGS="-L/opt/jemalloc/lib/"
  178. RUN apt update && \
  179.         apt -y install build-essential \
  180.                 bison libyaml-dev libgdbm-dev libreadline-dev \
  181.                 libncurses5-dev libffi-dev zlib1g-dev libssl-dev && \
  182.         cd ~ && \
  183.         wget  && \
  184.         tar xf ruby-$RUBY_VER.tar.gz && \
  185.         cd ruby-$RUBY_VER && \
  186.         ./configure --prefix=/opt/ruby \
  187.           --with-jemalloc \
  188.           --with-shared \
  189.           --disable-install-doc && \
  190.         ln -s /opt/jemalloc/lib/* /usr/lib/ && \
  191.         make -j$(nproc) > /dev/null && \
  192.         make install && \
  193.         cd .. && rm -rf ruby-$RUBY_VER.tar.gz ruby-$RUBY_VER
  194.  
  195. ENV PATH="${PATH}:/opt/ruby/bin:/opt/node/bin"
  196.  
  197. RUN npm install -g yarn && \
  198.         gem install bundler && \
  199.         apt update && \
  200.         apt -y install git libicu-dev libidn11-dev \
  201.         libpq-dev libprotobuf-dev protobuf-compiler
  202. COPY Gemfile* package.json yarn.lock /opt/mastodon/
  203.  
  204. RUN cd /opt/mastodon && \
  205.   bundle config set deployment 'true' && \
  206.   bundle config set without 'development test' && \
  207.         bundle install -j$(nproc) && \
  208.         yarn install --pure-lockfile
  209.  
  210. F
captcha