Server won't start with custom addon

I finally got my addon developed in Docker to build without errors. Here was the final buildout:

[buildout]
extends = buildout.cfg
extensions = mr.developer
auto-checkout =
    collective.saml2
    my.mytheme

eggs =
    collective.saml2
    my.mytheme

[sources]
collective.saml2 = git https://github.com/collective/collective.saml2.git
my.mytheme = git https://our.github.repo/my.mytheme

[versions]
Zope2 = 4.0a4
zope.formlib = 4.4
zExceptions = 3.4
transaction = 2.4
DocumentTemplate = 3.0b5
RestrictedPython = 4.0a1
AccessControl = 4.0b4
Persistence = 3.0a3

Now the trouble is...

Traceback (most recent call last):
  File "bin/instance", line 257, in <module>
    import plone.recipe.zope2instance.ctl
  File "/plone/buildout-cache/eggs/plone.recipe.zope2instance-4.4.1-py2-none-any.ovo/plone/recipe/zope2instance/ctl.py", line 38, in <module>
    if zopectl.WIN:
  File "/plone/buildout-cache/eggs/zope.deferredimport-3.5.3-py2.7.egg/zope/deferredimport/deferredmodule.py", line 69, in __getattr__
    v = get.get()
  File "/plone/buildout-cache/eggs/zope.deferredimport-3.5.3-py2.7.egg/zope/deferredimport/deferredmodule.py", line 54, in get
    return super(DeferredAndDeprecated, self).get()
  File "/plone/buildout-cache/eggs/zope.deferredimport-3.5.3-py2.7.egg/zope/deferredimport/deferredmodule.py", line 37, in get
    v = __import__(module, *self._import_chicken)
ImportError: No module named ZServer.Zope2.Startup.zopectl

Any suggestions on what I've done wrong to lose this module?

I would start to check which part of the module hierarchy is missing.

Note, that with "Zope [4]", Zserver is no longer an integral part but must be included specially. If you have not done this, then it would be natural that the complete ZServer package is missing.

Check out https://github.com/collective/buildout.plonetest/blob/master/plone-5.2.x.cfg where plone 5.2 with Zope 4 is used.

I tried including ZServer 3.0, but that didn't change anything.... @petschki Did you mean including zc.recipe.cmmi = 1.3.6 as a dependency, or did you mean look at the build.cfg that it extended? I don't see anything for Zope4 in either place, but I see that the cfg file extends the Zope4 compilation configuration... should I be extending that?

Zope [4] will need a ZServer 4.x (likely some beta version).

Usually you do not have to care about versions yourself... all required pins are defined in the versions.cfg of a plone release. For example http://dist.plone.org/release/5.2-latest/versions.cfg

I‘d recommend extending from there and remove all pins in your config.

Unfortunately, plone.recipe.zope2instance (which is what 5.1.5 uses I believe) appears to be limited to Zope 2.3.27... it won't let me build with a newer version.

The recipe Name is indeed a bit missleading. Since plone.recipe.zope2instance==5.0.0 Zope >= 4.0 is required (see pypi.org) . btw. Plone 5.1.x isn‘t compatible with Zope 4 and therefore the recipe version has to be < 5.0 ... shiny new Zope 4 works in plone 5.2 only

Ah, sounds as if I need a new docker container entirely... the one I've been using is the official 5.1.5 docker image

You know a lot of time would have been saved had I been smart enough to read the instructions here...

There's an environment variable you can set to add your own addons. It's supposed to download addons automatically, but now, I'm getting the error "couldn't find index page for collective.saml2". I wonder why that's different than the "eea.facetednavigation" example they gave...

Plone/Python packages are usually installed based on pypi.org package index. Thus, your add-on need to be listed there before using Docker with PLONE_ADDONS (short ADDONS) environment variable.

See https://pypi.org/project/eea.facetednavigation/ vs https://pypi.org/project/collective.saml2/

If your package is still in the development phase, you can run docker with your add-on locally like:

  $ cd collective.saml2
  $ docker run -it --rm -p 8080:8080 \
      -v $(pwd):/plone/instance/src/collective.saml2 \
      -e ADDONS="collective.saml2" \
      -e DEVELOP="src/collective.saml2" \
      plone:5 fg

See https://docs.plone.org/manage/docker/docs/usage/addons.html#add-ons