Weblog
Paul Roeland: The value of longevity
Talk by Paul Roeland at the Plone conference 2024 in Brasilia.
Link to talk information on Plone conference website.
I work for the Clean Clothes Campaign: https://cleanclothes.org/
After three large disasters in factories in 2012 and 2013 with over 1000 deaths, it took three years to get an agreement with clothes manufacturers to get 30 million dollar compensation. It does not bring lives back, but it helps the survivors.
See Open Supply Hub for open data that we collected, for checking which brands are produced in which factories.
Documenting history matters. Stories must be told.
The global closing industry is worth around 1.8 trillion dollars, in a country that would put them on the 12th place in the world. 75 million workers.
Our strongest weapon: backlinks. We have links from OECD, UN, wikipedia, school curriculum, books. Especially those last two don't change ever, so you should never change urls.
Plone: enable the sitemap, please, why not by default? Create a good robots.txt. I weekly check Google Search console, looking for broken links. Tag early, tag often, great tool, even if you have an AI do it.
Our website: started 1998 written in Notepad, 2004 Dreamweaver, 2006 Bluefish, 2010 Joomla, 2013 Plone 4, 2020 Castle CMS (opinionated distribution of Plone, but does not really exist anymore) 2024 Plone 6 with Volto Light Theme (work in progress). Thank you kitconcept for all the help, especially Jonas.
Migrations are painful. Along the years we used wget to csv to SQL to csv, Python script, "Franken-mogrifier", collective.exportimport.
Lessons learned: stable urls are awesome, migrations are painful. Please don't try to salvage CSS from your old site, just start fresh in your new system. Do not try to migrate composite pages or listings.
What if your website does not provide an export? Use wget, still works and is better than httrack. sed/awk/regex are your friend. archivebox (WARC).
Document your steps for your own sanity.
To manage json, jq or jello can be used. sq is a Swiss knife for json/sql/csv. emuto is a hybrid between jq and GraphQL.
Normalize import/export. We have `plone.exportimport` in core now.
In the future I would like a plone exporter script that accepts a regex and exports only matching pages. Switch backends: ZODB, relstorage, nick, quantum-db. Sitewide search/replace/sed. Sneakernet is useful in difficult countries where you cannot send data over the internet: so export to a usb stick.
A backup is only a backup if it regularly gets restored so you know that it works.
- Keeping content and URL stability is a superpower.
- Assuming that export/import/backup/restore/migration are rare occurrences, is wrong.
- Quick export/import is very useful.
Do small migrations, treat it as maintenance. Don't be too far behind. Large migrations one every five years will be costly. Do a small migration every year. Do your part. Clients should also do their part, by budgeting this yearly. That is how budgeting works. Use every iteration to review custom code.
Make your sites live long and prosper.
Fred van Dijk: Run Plone in containers on your own cluster with coolify.io
Talk by Fred van Dijk at the Plone conference 2024 in Brasilia.
Link to talk information on Plone conference website.
Sorry, I ran out of time trying to set up https://coolify.io
So let's talk about another problem. Running applications (stacks) in containers is the future. Well: abstraction and isolation is the future, and containers is the current phase.
I am on the Plone A/I team, with Paul, Kim, Erico. All senior sysadmins, so we kept things running. In 2022 we worked on containerisation. Kubernetes was the kool kid then, but Docker Swarm was easier. Checkout Erico's training with new cookieplone templates.
Doing devops well is hard. You have a high workload, but still need to keep learning new stuff to keep up with what is changing.
I want to plug Coolify, which is a full open source product. "Self-hosting with super powers." The main developer, Andras Bacsal, believes in open source and 'hates' pay by usage cloud providers with a vengeance.
Coolify is still docker swarm. We also want Kubernetes support. But we still need sysadmins. Someone will still need to install coolify, and keep it updated.
I would like to run an online DevOps course somewhere January-March 2025. 4-6 meetings of 2 hours, maybe Friday afternoon. Talk through devops and sysadmin concepts, show docker swarm, try coolify, etc.
Ziming Yuan: How a Beginner Built an RSS Feed Provider in Volto
Talk by Ziming Yuan at the Plone conference 2024 in Brasilia.
Link to talk information on Plone conference website.
I am studying computer science. This summer I have participated in the Google Summer of Code for Plone. Thank you to mentors Paul, Roeland and Mike!
I have built several full-stack web apps with React, but am new to open source.
What is RSS? It is Really Simple Syndication. It is used by websites to publish updated information, such as blog or news. It lets users decide what they read every day, instead of algorithms.
In Plone the RSS feed should use a catalog query to filter contents, for example a feed of science articles or of events.
For an RSS feed content type we could use a collection behavior or a blocks behavior with a listing block. The listing block is the way to go for Volto. So I did that. Plus extra fields like maximum title length and maximum description length.
I created a view component for the content type. Important is the Express middleware with which we got information from the backend.
We decided on `rss` as Node package for the feed. We looked at another newer one called `feed`, but it did not work for us or was missing features.
There were challenges for me as person new to Plone. Do I really understand the code? Often the answer is: no. For example ZCML? i18n? XML files in the profiles? There is a really nested structure. Create a new project, then you have backend / src / rss / src / rss, at least something very deeply nested. It was always confusing to me as I did not really know what should end up in git or in a release. The worst is that I don't know what are the most important files.
And what if my code fails, it was hard to understand errors on the front end. There are just too many things that may be the source of the error.
Another challenge: what if I want to create something new? The training lets you learn by example. But what does each line of the example code actually do? Are there other options?
Missing documentation: how do prevent the user from removing the title or rss block? We found out about initialBlocks per content type. And prevent adding new blocks? There is a feature disableNewBlocks, that could be set on an individual block, but what about doing this for all instances of this content type?
An overview of the code base would be good. How different components are connected, how different files work together. A guide about how to approach the source code, what files I should look at first.
For developers new to Plone: the source code is your friend, the Plone community is helpful, but be specific in the questions you ask, and tell what you have already tried.
Source code:
Érico Andrei: Plone + pytest: Tips and tricks
Talk by Érico Andrei at the Plone conference 2024 in Brasilia.
Link to talk information on Plone conference website.
Plone loves tests. The first was committed in October 2002 by Sidnei da Silva. We have used lots of different testing framework. I like using pytest
. The unittest
framework was inspired by Java testing and you see it. pytest is simple and pythonic. It does dependency injection, which can look magical, okay. There is a large ecosystem of plugins. It has support for unittest. There is a Brazilian maintainer.
I have created pytest-plone, built upon zope.pytest. It provides fixtures and helpers. it is the default in cookieplone templates. Take a look at plone.distribution and plone.exportimport for examples.
Golden rules
If you need a Plone site in your test, you need to wrap your test in a class. That helps for not tearing down everything after every test. Start with a method that gets portal and probably get_fti, and use @pytest.fixture(autouse=True)
.
Use @parametrize
to run the same test function with multiple inputs and output.
Use fixtures.
Trust and love pytest plugins. There are plugins for running the tests in random order, or in parallel. Code coverage is a plugin. You can start a docker container.
Use helpers in pytest-plone to check that your latest upgrade step matches the metadata profile version. Check that your add-on is installed.
plone-pytest 1.0 is coming. Small problem: the tests are breaking on Python 3.9.
Write more tests with less code. I will sprint on pytest-plone.
Fabiano Weimar: Plone on Kubernetes
Talk by Fabiano Weimar (Xiru) at the Plone conference 2024 in Brasilia.
Link to talk information on Plone conference website.
Kubernetes (k8s) is an open source system for managing containerised applications It provides mechanisms for deployment and scaling. It is part of the Cloud Native Computing Foundation.
Kubernetes' benefits are scalability, fault tolerant, self-healing, efficient resource utilisation, declarative configuration, rich ecosystem.
Kubernetes basics:
- pods: the smallest deployable unit of computing, consisting of one or more containers. Containers in one pod can talk with each other like they are all on localhost.
- deployments: manage the replication and updates of pods
- RepicaSets: manage a fixed number of identical pods.
- StatefulSets: manage stateful apps, lik databases
- Jobs: one-off tasks
- CronJob: regular tasks
- ConfigMap: store configuration data
- Secrets: store sensitive information
- PersistentVolumeClaims: request storage
- PersistentVolumes: actual storage
- Pod Disruption Budgets (pdb): limit the number of pods that can be unavailable at any given time, for example during upgrades, self-healing during disaster recovery.
- Autoscaler: automatically scale the number of nodes in a cluster based on workload. Resource optimisation.
- Ingress: routing external traffic to services, SSL termination, load balancing, caching, rate limiting.
- Operator: software extensions to Kubernetes that make use of custom resources to manage applications and their components. Think of this as a human operator who would go in and do some stuff.
Plone components as Kubernetes resources:
- Plone backend: StatefulSet
- Plone frontend: Depoloyment
- PostgreSQL: StatefulSet
- Varnish: Deployment
- nginx
- cronjobs
Kubernetes for Devops. It has a steep learning curve. For your laptop you have microk8s and k3d so you have the Kubernetes api, although without the options that you would have with multiple machines. Basics: `apt install docker.io` and `snap install kubectl --classic` and `snap install heml --classic`. And read https://k3d.io/
At the Alpine City Sprint this year we worked on helm charts for Plone: https://github.com/plone/helm-charts/
Tips and tricks:
- You can use ArgoCD to automatically do a deploy when something changes in a git repo. You need to configure this correctly of course.
- Plone can do better on integration with proper observability tools like Grafana and Prometheus. For example, how can such tools get the logs when they are in multiple places.
- Use ZODB with PostgreSQL and relstorage. I think it is the most stable implementation today.
- Varnish Operator from IBM looks promising when you want to run multiple instances of varnish.
- If you run the `test.sh` from Plone help charts this may use a lot of bandwidth downloading docker images. k3d supports import of docker images so they are in a cache.