Software updates
Some parts of Hosty update themselves, and the rest you update by hand. Update the manual parts little and often: a long gap brings several breaking changes at once, and they're harder to find and fix together. Check now and then that the automatic updates still run, too.
What updates itself
What | How | Where it's set |
|---|---|---|
Operating system of the nodes (Bottlerocket) | A maintenance window of AWS Systems Manager runs AWS-UpdateEKSManagedNodeGroup every day at 4am London time, for both node groups. Nodes are replaced one by one. | terraform/modules/cluster/updates.tf |
Minor versions of Aurora | Every tofu apply sets the latest minor version of rds_engine_version, and AWS applies it in the maintenance window of the database (Tuesday 5:00-6:00 UTC). AWS also applies the minor upgrades it marks as automatic. | rds.tf |
Software of OpenSearch | AWS applies service software updates in the off-peak window (opensearch_off_peak_window_start_hour). | opensearch.tf |
Base images of applications | Each build takes the latest release of the version in hosty.yaml, for example the latest wodby/php:8.4. See below. | Hosty CLI |
Packages of the Hosty images | Alpine packages, such as the AWS CLI, Git, PHP and Docker, are the latest ones of the Alpine version whenever an image is built. The lifecycle image is built only once for each of its versions (see below). | Dockerfile.* |
To see that the node updates run, open Systems Manager, then Maintenance windows, <cluster>-autoupdater and its history.
Base images of applications
Applications are built on the images of Wodby (wodby/php, wodby/node, wodby/python, wodby/nginx, wodby/apache, wodby/redis). A project sets the version line in hosty.yaml, such as PHP 8.4, and every build takes the latest release of that line from Docker Hub.
Since 1.5.2, Hosty also checks that the release it found has the latest version of the software, by comparing the version in the image (like PHP 8.4.27) with the newest tag of the line. If Wodby has released a newer version under tags Hosty doesn't recognise, the build stops. If Wodby hasn't released it yet, or Docker Hub doesn't answer, Hosty only warns. Setting tag of a container in hosty.yaml pins a release and skips the check.
Redis is the exception: a deployment keeps the image that runs in the environment as long as it has the latest version of Redis, since a new image restarts Redis and empties it.
The versions that Hosty CLI supports (PHP, Python, Node.js, nginx, Apache) are listed in cli/src/Constants.php. Add new versions there when Wodby releases them, and remove the ones that reach their end of life.
Hosty images
Hosty has three images:
Image | Dockerfile | Used by |
|---|---|---|
hosty (local) | Dockerfile.admins | Admins, through make cli |
systemseed/hosty | Dockerfile.developers | Developers and CI. CircleCI publishes latest on every push to main, and vX.Y.Z for each release tag. |
systemseed/hosty-lifecycle | Dockerfile.lifecycle | Jobs of environments: import, backup, cleanup and cron jobs, and the database accounts job of OpenTofu. |
Tools
The versions of the tools are in .env. Each line has a link to the list of releases above it:
Variable | Tool |
|---|---|
LINUX_ALPINE_VERSION | Alpine Linux, the base of all three images |
OPEN_TOFU_VERSION | OpenTofu (admin image only) |
KUBECTL_VERSION | kubectl. Keep it within one minor version of the clusters: kubectl doesn't support servers further apart. The lifecycle image has it too, for cron jobs. |
HELM_VERSION | Helm |
After you change .env, run make build to rebuild your local image.
Lifecycle image
The lifecycle image has its own version, LIFECYCLE_IMAGE_VERSION in .env, which is its tag. Tags are never overwritten: CI publishes the image only when the tag doesn't exist yet. Raise the version on every change of Dockerfile.lifecycle, and to pick up a new Alpine version. Change it in all these places together:
- LIFECYCLE_IMAGE_VERSION in .env;
- lifecycleHelper.image in helm/php/values.yaml, helm/node/values.yaml and helm/python/values.yaml;
- database_accounts_image in terraform/modules/cluster/database_accounts.tf.
The image has a PostgreSQL client for each supported major version, because pg_dump must match the server. Add a client before you move a cluster to a new major version of PostgreSQL.
Dependencies of Hosty CLI
Hosty CLI is a PHP application with Composer. To update its dependencies, open the container with make cli and run:
cd /src/cli
composer outdated
composer update # all packages
composer update symfony/console # or only some of themCommit composer.json and composer.lock. Other admins then run composer install --working-dir=/src/cli in their container.
Releasing Hosty
Changes reach projects with a new release of Hosty, listed in CHANGELOG.md. Choose the version carefully: a new minor or major release stops the commands of older Hosty CLIs until they're updated, so it affects every project at once. A newer patch release only shows a notice. For an urgent fix before the update, set the environment variable HOSTY_SKIP_VERSION_CHECK=1 to skip the check.
OpenTofu modules and providers
Hosty uses modules from the OpenTofu registry and GitHub. Their versions are in the version of each module block (or ref in its source), with a link to the releases in a comment above it:
- terraform/modules/cluster/: eks.tf (EKS, EKS Blueprints add-ons, Container Insights, KMS), rds.tf, vpc.tf, alarms.tf;
- terraform/modules/hosting/: storages.tf, logging.tf, terraform_state.tf.
To update a module:
- Read its changelog from your version to the new one. Note breaking changes and the changes of defaults.
- Change version, and the code if the changelog asks for it.
- Download the new version and check the plan:
cd /src/terraform
tofu init -upgrade
tofu plan- Apply only when every change in the plan is one you expect from the changelog. A new version of a module shouldn't replace resources that already exist.
Providers are pinned to a major version (~> 6.0) in terraform/providers.tf and in providers.tf or versions.tf of each module. tofu init -upgrade takes their latest version within it and updates terraform/.terraform.lock.hcl. Commit the lock file. A new major version needs a change of the pin and a careful read of its upgrade guide.
Charts of the add-ons
Two controllers are installed as Helm charts by the EKS Blueprints add-ons, with versions set in eks.tf:
- AWS Load Balancer Controller, chart_version. Helm doesn't upgrade the CRDs of a chart, so read the release notes: a new version may need its CRDs applied by hand.
- Cluster Autoscaler, chart_version and image_tag_override. The minor version of the autoscaler must match the minor version of Kubernetes, so update it together with the cluster.
Kubernetes version of a cluster
Each cluster has its version of Kubernetes in k8s_version of its cluster module in main.tf. EKS supports a version for about 14 months and then charges extra for extended support, so plan an upgrade about twice a year. You can upgrade only one minor version at a time.
Before the upgrade
- Read the Kubernetes versions on EKS for the changes of the new version.
- Check Upgrade insights of the cluster in the EKS console. It lists the APIs in use that the new version removes.
- Set image_tag_override of the Cluster Autoscaler to the latest release for the new version. If it's not out yet, use the closest older one.
- Check that the AWS Load Balancer Controller supports the new version, and update its chart if needed.
- Keep KUBECTL_VERSION in .env within one minor version of the new one.
- Compare the Corefile of CoreDNS in eks.tf with the default one of the new version, as the comment above it explains: Hosty sets the whole Corefile on every cluster.
For a big jump, or when you're unsure, try the new version on a test cluster first, as described in Adding a new cluster, and delete it afterwards.
Upgrade
Change k8s_version and run tofu plan and tofu apply. EKS upgrades the control plane first, then OpenTofu rolls both node groups to the new version, replacing the nodes one by one. The EKS add-ons (VPC CNI, CoreDNS, kube-proxy, metrics server, EFS CSI driver) move to their latest versions for the new Kubernetes on the same apply. So does the CloudWatch observability add-on.
Production runs at least 2 pods of each application, and its nodes are drained one pod at a time, so sites stay up while the nodes are replaced. Development environments have one pod, so they stop briefly while it moves to a new node. The same happens on the daily updates of the nodes.
Databases
Aurora
rds_engine_version of the cluster sets the major version: 8.0 for MySQL, or a number like 16 for PostgreSQL. Minor versions update themselves (see the table above).
A new major version isn't automatic, and Hosty has no setting for it yet: the database module in rds.tf needs allow_major_version_upgrade for it. All projects of the cluster share the database, so try the upgrade on a cluster restored from a snapshot first, and plan the downtime with the projects.
OpenSearch
opensearch_engine_version of the cluster sets the version of OpenSearch. AWS upgrades the domain with a blue/green deployment without downtime, to the next versions only. To see the versions you can upgrade to, run:
aws opensearch get-compatible-versions --domain-name <cluster>-search --region <region>Other runtimes
The Lambda function that sends the alarms to Slack runs on a version of Python set in runtime in terraform/modules/cluster/alarms.tf. AWS emails the account before a runtime reaches its end of support. Raise it then.