Concerto 2.4.0-beta (Docker)

Debian 11

Запускал на чистой Debian BullsEye. Основывался на форке с гитхаба многоуважаемого Romolo Manfredini, но немного изменил Dockerfile, т.к. на момент сборки были проблемы с зависимостями ОС и актуальной на данный момент версией Ruby.

Т.е. в принципе ничего не мешает вам склонировать гит и собрать по инструкции с гитхаба (не забудьте самостоятельно скорректировать Dockerfile). Пароли на базу данных меняем при необходимости в файле docker-compose.yml

Изменения, которые внёс в Dockerfile:

RUN mv /etc/apt/sources.list.d /etc/apt/sources.list.d.bak
RUN apt update && apt install -y ca-certificates
RUN mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d
RUN apt install -y software-properties-common
RUN apt clean

Рабочий Dockerfile
# the ruby version is specified in the Dockerfile and the nginx.docker.conf files
FROM phusion/passenger-ruby25

LABEL Author="team@concerto-signage.org"

# because phusion says to...
ENV HOME /root
CMD ["/sbin/my_init"]

# we need libreoffice to convert documents to pdfs, imagemagick for graphics handling, nmap to tell us if the db is up
WORKDIR /tmp
RUN mv /etc/apt/sources.list.d /etc/apt/sources.list.d.bak
RUN apt update && apt install -y ca-certificates
RUN mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d
RUN apt install -y software-properties-common
RUN apt clean
RUN add-apt-repository ppa:libreoffice/ppa
RUN apt-get update
RUN install_clean libreoffice ghostscript libgs-dev imagemagick ruby-rmagick libmagickcore-dev libmagickwand-dev nmap gsfonts poppler-utils

# set up for eastern timezone by default
RUN ln -fs /usr/share/zoneinfo/Europe/Moscow /etc/localtime
RUN DEBIAN_FRONTEND=noninteractive install_clean tzdata

# enable nginx and configure the site
RUN rm -f /etc/service/nginx/down
RUN rm /etc/nginx/sites-enabled/default
COPY tools/nginx.docker.conf /etc/nginx/sites-enabled/concerto.conf

# set up the concerto application
RUN mkdir -p /home/app/concerto/log
RUN mkdir -p /home/app/concerto/tmp
WORKDIR /home/app/concerto
COPY . /home/app/concerto
COPY config/database.yml.docker /home/app/concerto/config/database.yml
RUN chown -R app:app /home/app/concerto
RUN setuser app bash --login -c "cd /home/app/concerto && gem install bundler -v '1.17.3' && RAILS_ENV=production bundle install --path=vendor/bundle"

# set up the background worker
RUN mkdir -p /etc/service/concerto_clockwork
COPY tools/service.clockwork.docker.sh /etc/service/concerto_clockwork/run
RUN chmod +x /etc/service/concerto_clockwork/run

RUN mkdir -p /etc/service/concerto_worker
COPY tools/service.worker.docker.sh /etc/service/concerto_worker/run
RUN chmod +x /etc/service/concerto_worker/run

# set up migration, and assets to precompile on each startup, but waits for db to be reachable first
RUN mkdir -p /etc/my_init.d
COPY tools/startup.docker.sh /etc/my_init.d/99_startup_concerto.sh
RUN chmod +x /etc/my_init.d/99_startup_concerto.sh

# set up log rotation
COPY tools/logrotate.app.docker /etc/logrotate.d/concerto
RUN chmod 0644 /etc/logrotate.d/concerto

# fix Imagemagick policy for converting files
# https://stackoverflow.com/a/52661288/1778068
RUN cat /etc/ImageMagick-6/policy.xml | sed 's/domain="coder" rights="none" pattern="PDF"/domain="coder" rights="read|write" pattern="PDF"/' >/etc/ImageMagick-6/policy.xml

WORKDIR /tmp
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir -p /usr/local/rvm/wrappers/ruby-2.5.5/ && ln -s /usr/local/rvm/wrappers/ruby-2.5.9/ruby /usr/local/rvm/wrappers/ruby-2.5.5/ruby
# TODO! we still need to figure out how to handle updates and accommodate changes from optional plugins
# db for schema.rb changes on migrations from plugins
# doc for custom help
# log for logs
# tmp for locks and assets?
# public for assets
# vendor for plugin gems
# what about Gemfile.lock and Gemfile-plugins and Gemfile-plugins.bak?
VOLUME ["/home/app/concerto/db", "/home/app/concerto/doc", "/home/app/concerto/log", "/home/app/concerto/tmp", "/home/app/concerto/public", "/home/app/concerto/vendor"]

Итак, приступаем!


Установка Docker & Docker-compose
apt update && apt install -y ca-certificates curl gnupg && install -m 0755 -d /etc/apt/keyrings && curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && chmod a+r /etc/apt/keyrings/docker.gpg && echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && apt-get update && apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin && ln -s /usr/libexec/docker/cli-plugins/docker-compose /sbin/docker-compose && systemctl status docker
Запуск Concerto Digital Signage

Переходим в домашнюю папку и создаём docker-compose.yaml (содержимое выше в инструкции):

cd ~ && mkdir concerto && cd concerto && nano docker-compose.yaml
version: "3"
services:
  db:
    image: mysql
    # utf8mb4 https://stackoverflow.com/a/53398381/1778068
    command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: concerto
      MYSQL_DATABASE: concerto
      MYSQL_USER: concerto
      MYSQL_PASSWORD: concerto
    volumes:
      - db:/var/lib/mysql

  concerto:
    image: tiotimolin/concerto:2.4.0
    restart: always
    ports:
      - "80:80"
    environment:
      CONCERTO_DB_HOST: db
      CONCERTO_DB_USER: concerto
      CONCERTO_DB_PASSWORD: concerto
      CONCERTO_DB_NAME: concerto
    volumes:
      - concerto:/home/app/concerto
    depends_on:
      - db
volumes:
  db:
  concerto:

И запускаем:

docker-compose up -d

Запуск займёт некоторое время, будьте терпеливы. У меня стартанул за 40 секунд.
И переходим по ссылке http://YOUR_IP/

Если же что-то пошло не так, то дебажим:

docker-compose up

Fuse

Адрес электронной почты защищен от спам-ботов. Для просмотра адреса в браузере должен быть включен Javascript.