How to deploy Volto sites automatically in non-docker scenarios
Talk by Mikel Larreategi at the Plone Conference 2022 in Namur.
We are not in the docker-world yet, at least not for deploying sites. Last year we had to publish several Volto sites in production and needed some automated way to handle those deployments because Volto's build process takes so time. We have manged to build a CI-CD pipeline using Gitlab-CI and several other tools to release, build and publish volto addons and sites in an automated way. Earlier this year we published a blog-post explaining this process and this talk will be the extended version of the blog-post.
Why are we not using Docker? We are migrating Plone 4.3 to 5.2. We use DigitalOcean standard droplets. We are used to Buildout. These are not Docker deployments. We are starting some Volto developments, and did not want to change our standard deployment yet.
Running yarn build
on the server took half an hour, and then broke, so that was not a solution. We had to upgrade the server to run the build.
The solution was to automate the process. Automate add-on package creation, frontend package compilation.
Problem: we are using private repositories, so could not use the public npmjs registry for packages. Do something private? This is not that easy.
Verdaccio to the rescue. This is a private npm repository, which proxies to the real npmjs for public packages. We configured this to work only in authenticated mode. We needed to configure npm and yarn to use authentication.
We setup a pipeline in GitLab. When a pull request of a Volto add-on is merged, a package is created and published. When a pull request for the front end is merged, the frontend is built and copied to the server with scp and then a supervisor restart. When finished an e-mail is sent through MailJet api.
GitLab CI configuration is hard. You have stages, steps, artefacts. Artefacts are shared beween jobs, but not between pipelines. Use artefacts to cache already built things. Use variables for everything. We share configuration in a GitHub repos and sync it to other repos with a Python script.
Links to the configuration can be seen at labur.eus/deploy-volto.