手动启动Docker容器内的plone 6示例

qgelzfjb  于 2023-02-21  发布在  Docker
关注(0)|答案(1)|浏览(161)

基于示例here,我添加了entrypoint: sh -c 'tail -f /dev/null'

version: "3"
services:

  backend:
    image: plone/plone-backend:6.0
    restart: always
    environment:
      ZEO_ADDRESS: zeo:8100
    ports:
    - "8080:8080"
    depends_on:
      - zeo
    entrypoint: sh -c 'tail -f /dev/null'

  zeo:
    image: plone/plone-zeo:latest
    restart: always
    volumes:
      - data:/data
    ports:
    - "8100:8100"

volumes:
  data: {}

我像往常一样使用docker-compose up启动应用,然后运行docker-compose exec backend bash。现在我找不到启动示例的方法。bin/instace fg.
我试了很多次都没有成功。没有使用build: .,没有使用基于plone/plone-backend:6.0 + buildout.cfg的新Dockerfile,等等。我觉得应该很简单,但就是想不通。
我发现了这个:https://community.plone.org/t/interactive-shell-for-debugging-with-plone-6-docker-compose-the-wsgi-equivalent-of-bin-instance-debug/16370
但是在我的例子中,我不想以这种方式进入调试模式。我的目标是用vim编辑eggs中的一些文件,添加一些pdb,然后我想在前台模式下启动示例,以便研究一些功能是如何工作的。我在Plone 4中经常这样做。我如何在Plone 6中做到这一点?

r3i60tvu

r3i60tvu1#

解决方案(但请参见更新的解决方案)

version: "3"
services:

  backend:
    image: plone/plone-backend:6.0
    restart: always
    environment:
      ZEO_ADDRESS: zeo:8100
      SECURITY_POLICY_IMPLEMENTATION: "C"
      VERBOSE_SECURITY: "off"
      DEFAULT_ZPUBLISHER_ENCODING: "utf-8"
      DEBUG_MODE: "off"
      ZODB_CACHE_SIZE: "50000"
    tty: true
    stdin_open: true
    command: cat
    ports:
    - "8080:8080"
    depends_on:
      - zeo

  zeo:
    image: plone/plone-zeo:latest
    restart: always
    volumes:
      - data:/data
    ports:
    - "8100:8100"

volumes:
  data: {}

放入容器中:
$ docker-compose exec backend bash
然后运行:
$ gosu plone /app/bin/runwsgi -v etc/zope.ini config_file=zope.conf
这将在fg模式下启动示例。(http://0.0.0.0:8080/
我在这里找到了这个:https://github.com/plone/plone-backend/issues/64#issuecomment-1211912408

更新(更好的解决方案):

您可以将整个代码复制到您的docer-compose.yml中,并且您将获得作为注解的说明。

# CREATE PROJECT
# $ mkdir plone6
# $ cd plone6
# $ vim docker-compose.yml
#   Copy example from
#   https://6.docs.plone.org/install/containers/images/backend.html#example
#     Update: - data:/data
#       with: - ./data:/data
#
# START PLONE
# Stop all docker containers:
# $ docker stop $(docker ps -aq)
# $ docker-compose build
# $ sudo chown -R 500 data/
# $ docker-compose up
#
# ENTER THE BACKEND CONTAINER 
# $ docker-compose exec backend bash
#
# INSTALL VIM INTO CONTAINER
# $ apt update
# $ apt install vim
#
# FIND THE PACKAGES, EDIT (example plone.restapi)
# $ ./bin/python
# >>> import plone.restapi
# >>> plone.restapi.__file__
# '/app/lib/python3.11/site-packages/plone/restapi/__init__.py'
# >>> exit()
# $ vim /app/lib/python3.11/site-packages/plone/restapi/__init__.py
# To add a breakpoint write: import pdb; pdb.set_trace()
#
# START INSTANCE IN FG MODE
# In docker-compose.yml add for backend:
    # tty: true
    # stdin_open: true
    # command: cat
# docker-compose up
# docker-compose exec backend bash
# ./docker-entrypoint.sh
# set
# ./docker-entrypoint.sh start
version: "3"
services:

  backend:
    image: plone/plone-backend:6.0
    restart: always
    environment:
      ZEO_ADDRESS: zeo:8100
    tty: true
    stdin_open: true
    command: cat
    ports:
    - "8080:8080"
    depends_on:
      - zeo

  zeo:
    image: plone/plone-zeo:latest
    restart: always
    volumes:
      - ./data:/data
    ports:
    - "8100:8100"

volumes:
  data: {}

相关问题