pretalx / pretalx-docker

Docker setup for a complete pretalx installation. Community-sourced, not officially supported.
30 stars 42 forks source link

Installation of plugins #13

Closed saschafoerster closed 4 years ago

saschafoerster commented 5 years ago

It would be great, if someone could help to extend the documentation or docker file with hints about how to install other pretalx plugins in the docker environment. Thanks!

rixx commented 4 years ago

Sounds like a good idea! This repository is entirely maintained by the pretalx community, not by the developers, so the only way to make this change is by way of a Pull Request – feel free to submit one!

saschafoerster commented 4 years ago

I tried my very best, but maybe the community can help.

Created a Dockerfile

FROM pretalx/standalone:latest
USER root
RUN pip install pretalx-pages
RUN cd /pretalx/src && sudo -u pretalxuser make production
USER pretalxuser

First part of docker-compose.yml

version: '2'
services:
  pretalx:
    #image: pretalx/standalone:latest
    build: .
    container_name: pretalx
    restart: unless-stopped
    depends_on:
      - redis
      - db
    ports:
      - "8346:80"
    volumes:
      - ./conf/pretalx.cfg:/etc/pretalx/pretalx.cfg:ro
      - pretalx-data:/data
    labels:
       traefik.docker.network: "pretalxdocker"
       traefik.enable: "true"

Result:

docker-compose up 
Building pretalx
Step 1/5 : FROM pretalx/standalone:latest
 ---> 4e3f5077baea
Step 2/5 : USER root
 ---> Using cache
 ---> a20d6bb5074b
Step 3/5 : RUN pip install pretalx-pages
 ---> Running in ff54ed5a19a0
Collecting pretalx-pages
  Downloading https://files.pythonhosted.org/packages/ee/f9/6ea7c293fbe4e82ff2ce2f79bd14d470d6e42e0d8e578368102d7f0f7bfa/pretalx-pages-1.0.0.tar.gz
Building wheels for collected packages: pretalx-pages
  Building wheel for pretalx-pages (setup.py): started
  Building wheel for pretalx-pages (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hcow22tz/pretalx-pages/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hcow22tz/pretalx-pages/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-g2ol1zcq --python-tag cp36
       cwd: /tmp/pip-install-hcow22tz/pretalx-pages/
  Complete output (29 lines):
  running bdist_wheel
  running build
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-hcow22tz/pretalx-pages/setup.py", line 41, in <module>
      """,
    File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-hcow22tz/pretalx-pages/setup.py", line 18, in run
      management.call_command("compilemessages", verbosity=1)
    File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 148, in call_command
      return command.execute(*args, **defaults)
    File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
      output = self.handle(*args, **options)
    File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/compilemessages.py", line 76, in handle
      raise CommandError("This script should be run from the Django Git "
  django.core.management.base.CommandError: This script should be run from the Django Git checkout or your project or app tree, or with the settings module specified.
  ----------------------------------------
  ERROR: Failed building wheel for pretalx-pages
  Running setup.py clean for pretalx-pages
Failed to build pretalx-pages
Installing collected packages: pretalx-pages
    Running setup.py install for pretalx-pages: started
    Running setup.py install for pretalx-pages: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hcow22tz/pretalx-pages/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hcow22tz/pretalx-pages/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-bz2dgxj9/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-hcow22tz/pretalx-pages/
    Complete output (31 lines):
    running install
    running build
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-hcow22tz/pretalx-pages/setup.py", line 41, in <module>
        """,
      File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/local/lib/python3.6/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-hcow22tz/pretalx-pages/setup.py", line 18, in run
        management.call_command("compilemessages", verbosity=1)
      File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 148, in call_command
        return command.execute(*args, **defaults)
      File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
        output = self.handle(*args, **options)
      File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/compilemessages.py", line 76, in handle
        raise CommandError("This script should be run from the Django Git "
    django.core.management.base.CommandError: This script should be run from the Django Git checkout or your project or app tree, or with the settings module specified.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hcow22tz/pretalx-pages/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hcow22tz/pretalx-pages/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-bz2dgxj9/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.3.1; however, version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Service 'pretalx' failed to build: The command '/bin/sh -c pip install pretalx-pages' returned a non-zero code: 1
saschafoerster commented 4 years ago

Okay, getting closer:

Dockerfile:

FROM pretalx/standalone:latest
USER root
RUN pip install -U pip setuptools wheel
RUN pip install tox
RUN git clone https://github.com/pretalx/pretalx-public-voting local/pretalx-public-voting
RUN python local/pretalx-public-voting/setup.py develop
RUN make -C local/pretalx-public-voting
RUN pip install pretalx-public-voting
USER pretalxuser

then

docker-compose build
db uses an image, skipping
redis uses an image, skipping
Building pretalx
Step 1/9 : FROM pretalx/standalone:latest
 ---> 4e3f5077baea
Step 2/9 : USER root
 ---> Using cache
 ---> a20d6bb5074b
Step 3/9 : RUN pip install -U pip setuptools wheel
 ---> Using cache
 ---> 19817a076d10
Step 4/9 : RUN pip install tox
 ---> Using cache
 ---> 2c2a4b58c5c9
Step 5/9 : RUN git clone https://github.com/pretalx/pretalx-public-voting local/pretalx-public-voting
 ---> Using cache
 ---> bb742d24b84e
Step 6/9 : RUN python local/pretalx-public-voting/setup.py develop
 ---> Using cache
 ---> a47f6cee8b55
Step 7/9 : RUN make -C local/pretalx-public-voting
 ---> Using cache
 ---> 9b61928142c5
Step 8/9 : RUN pip install pretalx-public-voting
 ---> Using cache
 ---> ed147dd5396a
Step 9/9 : USER pretalxuser
 ---> Using cache
 ---> e0ddb55bccf8
Successfully built e0ddb55bccf8
Successfully tagged pretalx_pretalx:latest

But then:

docker-compose up
Starting pretalx-db    ... done
Starting pretalx-redis ... done
Starting pretalx       ... done
Attaching to pretalx-redis, pretalx-db, pretalx
pretalx-db | 2020-05-29 14:34:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.28-1debian9 started.
pretalx-db | 2020-05-29 14:34:39+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
pretalx-db | 2020-05-29 14:34:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.28-1debian9 started.
pretalx-redis | 1:C 29 May 2020 14:34:39.218 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
pretalx-redis | 1:C 29 May 2020 14:34:39.218 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1, just started
pretalx-redis | 1:C 29 May 2020 14:34:39.218 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
pretalx-db | 2020-05-29T14:34:39.723084Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
pretalx-db | 2020-05-29T14:34:39.725529Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 1 ...
pretalx-db | 2020-05-29T14:34:39.730140Z 0 [Note] InnoDB: PUNCH HOLE support available
pretalx-db | 2020-05-29T14:34:39.730189Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
pretalx-db | 2020-05-29T14:34:39.730197Z 0 [Note] InnoDB: Uses event mutexes
pretalx-db | 2020-05-29T14:34:39.730203Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
pretalx-db | 2020-05-29T14:34:39.730209Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
pretalx-db | 2020-05-29T14:34:39.730214Z 0 [Note] InnoDB: Using Linux native AIO
pretalx-db | 2020-05-29T14:34:39.730578Z 0 [Note] InnoDB: Number of pools: 1
pretalx-db | 2020-05-29T14:34:39.730762Z 0 [Note] InnoDB: Using CPU crc32 instructions
pretalx-redis | 1:M 29 May 2020 14:34:39.219 * Running mode=standalone, port=6379.
pretalx-db | 2020-05-29T14:34:39.733555Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
pretalx-redis | 1:M 29 May 2020 14:34:39.219 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
pretalx-redis | 1:M 29 May 2020 14:34:39.219 # Server initialized
pretalx-redis | 1:M 29 May 2020 14:34:39.220 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
pretalx-db | 2020-05-29T14:34:39.745338Z 0 [Note] InnoDB: Completed initialization of buffer pool
pretalx-redis | 1:M 29 May 2020 14:34:39.220 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
pretalx-db | 2020-05-29T14:34:39.748972Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
pretalx-db | 2020-05-29T14:34:39.761653Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
pretalx-db | 2020-05-29T14:34:39.784999Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
pretalx-db | 2020-05-29T14:34:39.785129Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
pretalx-db | 2020-05-29T14:34:39.801081Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
pretalx-redis | 1:M 29 May 2020 14:34:39.222 * DB loaded from disk: 0.002 seconds
pretalx-redis | 1:M 29 May 2020 14:34:39.222 * Ready to accept connections
pretalx-db | 2020-05-29T14:34:39.802280Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
pretalx-db | 2020-05-29T14:34:39.802312Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
pretalx-db | 2020-05-29T14:34:39.803324Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 27848248
pretalx-db | 2020-05-29T14:34:39.803608Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
pretalx-db | 2020-05-29T14:34:39.803801Z 0 [Note] Plugin 'FEDERATED' is disabled.
pretalx-db | 2020-05-29T14:34:39.808129Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200529 14:34:39
pretalx-db | 2020-05-29T14:34:39.812274Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
pretalx-db | 2020-05-29T14:34:39.812326Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
pretalx-db | 2020-05-29T14:34:39.813246Z 0 [Warning] CA certificate ca.pem is self signed.
pretalx-db | 2020-05-29T14:34:39.813305Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
pretalx-db | 2020-05-29T14:34:39.813949Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
pretalx-db | 2020-05-29T14:34:39.814130Z 0 [Note] IPv6 is available.
pretalx-db | 2020-05-29T14:34:39.814170Z 0 [Note]   - '::' resolves to '::';
pretalx-db | 2020-05-29T14:34:39.814210Z 0 [Note] Server socket created on IP: '::'.
pretalx-db | 2020-05-29T14:34:39.816322Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
pretalx-db | 2020-05-29T14:34:39.837190Z 0 [Note] Event Scheduler: Loaded 0 events
pretalx-db | 2020-05-29T14:34:39.837593Z 0 [Note] mysqld: ready for connections.
pretalx-db | Version: '5.7.28'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
pretalx    | Traceback (most recent call last):
pretalx    |   File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
pretalx    |     "__main__", mod_spec)
pretalx    |   File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
pretalx    |     exec(code, run_globals)
pretalx    |   File "/pretalx/src/pretalx/__main__.py", line 9, in <module>
pretalx    |     execute_from_command_line(sys.argv)
pretalx    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
pretalx    |     utility.execute()
pretalx    |   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
pretalx    |     django.setup()
pretalx    |   File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
pretalx    |     apps.populate(settings.INSTALLED_APPS)
pretalx    |   File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 91, in populate
pretalx    |     app_config = AppConfig.create(entry)
pretalx    |   File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
pretalx    |     module = import_module(entry)
pretalx    |   File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
pretalx    |     return _bootstrap._gcd_import(name[level:], package, level)
pretalx    |   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
pretalx    |   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
pretalx    |   File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
pretalx    | ModuleNotFoundError: No module named 'pretalx_public_voting'
pretalx    | ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
pretalx    | ┃ ┏━━━━━━━━━━┓  pretalx v1.1.2                        ┃
pretalx    | ┃ ┃  ┌─·──╮  ┃  Settings:  /etc/pretalx/pretalx.cfg   ┃
pretalx    | ┃ ┃  │  O │  ┃  Database:  pretalx (mysql)            ┃
pretalx    | ┃ ┃  │ ┌──╯  ┃  Logging:   /data/logs                 ┃
pretalx    | ┃ ┃  └─┘     ┃  Root dir:  /pretalx/src/pretalx       ┃
pretalx    | ┃ ┗━━━┯━┯━━━━┛  Python:    /usr/local/bin/python3     ┃
pretalx    | ┃     ╰─╯       Plugins:   pretalx_public_voting      ┃
pretalx    | ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
pretalx    | 2020-05-29 14:34:41,351 CRIT Supervisor running as root (no user in config file)
pretalx    | 2020-05-29 14:34:41,364 INFO RPC interface 'supervisor' initialized
pretalx    | 2020-05-29 14:34:41,364 CRIT Server 'unix_http_server' running without any HTTP authentication checking
pretalx    | 2020-05-29 14:34:41,365 INFO supervisord started with pid 12
pretalx    | 2020-05-29 14:34:42,367 INFO spawned: 'pretalxtask' with pid 15
pretalx    | 2020-05-29 14:34:42,370 INFO spawned: 'pretalxweb' with pid 16
pretalx    | 2020-05-29 14:34:42,373 INFO spawned: 'nginx' with pid 17
pretalx    | 2020-05-29 14:34:43,709 INFO success: pretalxtask entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
pretalx    | 2020-05-29 14:34:43,709 INFO success: pretalxweb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
pretalx    | 2020-05-29 14:34:43,709 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
pretalx    | 2020-05-29 14:34:45,138 INFO exited: pretalxtask (exit status 1; not expected)
pretalx    | 2020-05-29 14:34:45,143 INFO spawned: 'pretalxtask' with pid 58
pretalx    | 2020-05-29 14:34:45,238 INFO exited: pretalxweb (exit status 1; not expected)
pretalx    | 2020-05-29 14:34:45,241 INFO spawned: 'pretalxweb' with pid 61
saschafoerster commented 4 years ago

Okay, got it! :)

FROM pretalx/standalone:latest
USER root
RUN pip3 install -Ue "git+https://github.com/pretalx/pretalx-public-voting.git@master#egg=pretalx-public-voting"
RUN pip3 install -Ue "git+https://github.com/pretalx/pretalx-pages.git@master#egg=pretalx-pages"
USER pretalxuser