Plone
To run the Plone content management system using Unit:
-
Install Unit with a Python 3.6+ language module.
-
Install and configure Plone’s prerequisites
-
Install Plone’s core files. Here, we install them at /path/to/app/; use a real path in your configuration:
mkdir /tmp/plone && cd /tmp/plone/
wget https://launchpad.net/plone/A.B/A.B.C/+download/Plone-A.B.C-UnifiedInstaller-1.0.tgz # Plone version
tar xzvf Plone-A.B.C-UnifiedInstaller-1.0.tgz --strip-components=1 # Plone version | Avoids creating a redundant subdirectory
./install.sh --target=:/path/to/app/ \ # Path to the application directory; use a real path in your configuration --with-python=/full/path/to/python \ # Full pathname of the Python executable used to create Plone's virtual environment standalone
Note:
Plone’s Zope instance and virtual environment are created in the zinstance/ subdirectory; later, the resulting path is used to configure Unit, so take care to note it in your setup. Also, make sure the Python version specified with--with-python
matches the module version from Step 1. -
To run Plone on Unit, add a new configuration file named /path/to/app/zinstance/wsgi.cfg:
[buildout] extends = buildout.cfg parts += wsgi.py # The basename is arbitrary; the extension is required to make the resulting Python module discoverable [wsgi.py] recipe = plone.recipe.zope2instance user = admin:admin # Instance credentials; omit this line to configure them interactively eggs = ${instance:eggs} scripts = initialization = from Zope2.Startup.run import make_wsgi_app wsgiapp = make_wsgi_app({}, '${buildout:parts-directory}/instance/etc/zope.conf') # Path to the Zope instance's configuration def application(*args, **kwargs):return wsgiapp(*args, **kwargs)
It creates a new Zope instance. The part’s name must end with .py for the resulting instance script to be recognized as a Python module; the initialization option defines a WSGI entry point using zope.conf from the instance part in buildout.cfg.
Rerun Buildout, feeding it the new configuration file:
cd /path/to/app/ # Path to the application directory; use a real path in your configurationzinstance/
bin/buildout -c wsgi.cfg ... Installing wsgi.py. Generated script '/path/to/app/zinstance/bin/wsgi.py'.
Thus created, the instance script can be used with Unit.
-
Change ownership:
Run the following command (as root) so Unit can access the application directory (If the application uses several directories, run the command for each one):
# chown -R unit:unit /path/to/app/ # User and group that Unit's router runs as by default
Note:
The unit:unit user-group pair is available only with official packages , Docker images, and some third-party repos. Otherwise, account names may differ; run theps aux | grep unitd
command to be sure.For further details, including permissions, see the security checklist.
-
Next, prepare the Plone configuration for Unit (use real values for path and home):
{ "listeners": { "*:80": { "pass": "applications/plone" } }, "applications": { "plone": { "type": "python 3.Y", "_comment_type": "Python executable version used to install Plone", "path": "/path/to/app/zinstance/", "_comment_path": "Path to the application directory; use a real path in your configuration", "home": "/path/to/app/zinstance/", "_comment_home": "Path to the application directory; use a real path in your configuration", "module": "bin.wsgi", "_comment_module": "WSGI module's qualified name with extension omitted" } } }
-
Upload the updated configuration.
Assuming the JSON above was added to
config.json
. Run the following command as root:# curl -X PUT --data-binary @config.json --unix-socket \ /path/to/control.unit.sock \ # Path to Unit's control socket in your installation http://localhost/config/ # Path to the config section in Unit's control API
After a successful update, your Plone instance should be available on the listener’s IP address and port: