|
| 1 | +--- |
| 2 | +date: 2025-03-11T08:30:00+00:00 |
| 3 | +title: Checkpoint Support - A Journey Towards Predictable and Consistent Deployments |
| 4 | +author: Moustafa Moustafa |
| 5 | +tags: |
| 6 | + - announcement |
| 7 | +--- |
| 8 | + |
| 9 | +In the ever-evolving landscape of software development, ensuring predictability and consistency in |
| 10 | +deployments has always been a challenge. |
| 11 | +Our team faced similar hurdles, especially when managing historical versions of repositories. |
| 12 | +We needed a solution that could help us recreate environments from specific points in time, ensure |
| 13 | +reproducible deployments, and track changes in package behavior over time. |
| 14 | + |
| 15 | +Inspired by the success stories of [Ubuntu Snapshots on Azure](https://ubuntu.com/blog/ubuntu-snapshots-on-azure-ensuring-predictability-and-consistency-in-cloud-deployments) and the |
| 16 | +[increased security and resiliency of Canonical workloads on Azure](https://techcommunity.microsoft.com/blog/linuxandopensourceblog/increased-security-and-resiliency-of-canonical-workloads-on-azure---now-in-previ/3970623), we |
| 17 | +embarked on a journey to develop a feature that could address these challenges. |
| 18 | + |
| 19 | +## The Problem |
| 20 | + |
| 21 | +Imagine working on a project where you need to ensure that your deployment environment is consistent |
| 22 | +with a specific point in time. |
| 23 | +This is crucial for debugging, testing, and even for compliance purposes. However, without a robust |
| 24 | +system in place, managing and accessing historical versions of repositories can be a daunting task. |
| 25 | + |
| 26 | +## The Solution: Checkpoint |
| 27 | + |
| 28 | +After weeks of brainstorming, development, and testing, we are thrilled to announce the release of |
| 29 | +the Checkpoint feature in Pulp! |
| 30 | +Think of it as similar to [snapshot.debian.org](https://snapshot.debian.org/) or [snapshot.ubuntu.com](https://snapshot.ubuntu.com/). |
| 31 | +This new addition allows you to manage and access historical versions of repositories, enhancing |
| 32 | +your content management capabilities. |
| 33 | +**This feature is available as a tech-preview starting from Pulp version 3.74.0.** |
| 34 | + |
| 35 | +## Key Benefits |
| 36 | + |
| 37 | +* **Historical Version Management:** Easily recreate environments from specific points in time. |
| 38 | +This is particularly useful for debugging and compliance purposes. |
| 39 | +* **Reproducible Deployments:** Ensure consistent replication of validated environments. |
| 40 | +This means that you can deploy the same environment multiple times with the same results. |
| 41 | +* **Structured Update Workflow:** Track changes in package behavior over time. |
| 42 | +This helps in understanding how updates affect your environment and in planning future updates. |
| 43 | + |
| 44 | +## How It Works |
| 45 | + |
| 46 | +The Checkpoint feature integrates seamlessly with Pulp, allowing you to create and manage |
| 47 | +checkpoints for your repositories. |
| 48 | +These checkpoints act as snapshots, capturing the state of your repository at a specific point in time. |
| 49 | +You can then use these checkpoints to recreate environments, ensuring that they are consistent with |
| 50 | +the state of the repository at the time the checkpoint was created. |
| 51 | + |
| 52 | +For more details on how plugins can enable the checkpoint feature, check out [this guide](https://pulpproject.org/pulpcore/docs/dev/learn/subclassing/checkpoint/). |
| 53 | + |
| 54 | +For repo admins looking to manage checkpoints for their repos, [this guide](https://pulpproject.org/pulpcore/docs/user/guides/checkpoint/) provides all the necessary steps. |
| 55 | + |
| 56 | +## Example Usage with Pulp CLI |
| 57 | + |
| 58 | +Here's a step-by-step example of how to use the checkpoint feature with the pulp CLI. |
| 59 | + |
| 60 | +### Setting Up the Repository, Remote, and Distributions |
| 61 | + |
| 62 | +First, set up the repository, remote, and distributions: |
| 63 | + |
| 64 | +```shell |
| 65 | +pulp file remote create --url https://fixtures.pulpproject.org/file/PULP_MANIFEST --name myfile |
| 66 | +pulp file repository create --name myfile --remote myfile |
| 67 | +pulp file distribution create --name myfile --repository myfile --base-path myfile # regular distro |
| 68 | +pulp file distribution create --checkpoint --name myfile-snapshot --repository myfile --base-path checkpoints/myfile # checkpoint distro |
| 69 | +``` |
| 70 | + |
| 71 | +### Creating an Empty Publication for Testing |
| 72 | + |
| 73 | +Next, create an empty publication for testing purposes: |
| 74 | + |
| 75 | +```shell |
| 76 | +pulp file publication create --checkpoint --repository myfile # use "--checkpoint" to create the publication |
| 77 | +http ${CONTENT_ADDR}/pulp/content/checkpoints/myfile/ # one checkpoint |
| 78 | + |
| 79 | +HTTP/1.1 200 OK |
| 80 | +Content-Length: 296 |
| 81 | +Content-Type: text/html |
| 82 | +Date: Tue, 18 Mar 2025 14:04:11 GMT |
| 83 | +Server: Python/3.10 aiohttp/3.8.1 |
| 84 | +X-PULP-CACHE: MISS |
| 85 | +<html> |
| 86 | +<head><title>Index of </title></head> |
| 87 | +<body bgcolor="white"> |
| 88 | +<h1>Index of </h1> |
| 89 | +<hr><pre><a href="../">../</a> |
| 90 | +<a href="20250318T140338Z/">20250318T140338Z/</a> 18-Mar-2025 14:03 |
| 91 | +</pre><hr></body> |
| 92 | +</html> |
| 93 | +``` |
| 94 | + |
| 95 | +### Syncing the Repository and Creating Another Checkpoint Publication |
| 96 | + |
| 97 | +Sync the repository and create another checkpoint publication: |
| 98 | + |
| 99 | +```shell |
| 100 | +pulp file repository sync --name myfile |
| 101 | +pulp file publication create --checkpoint --repository myfile |
| 102 | +http ${CONTENT_ADDR}/pulp/content/checkpoints/myfile/ |
| 103 | + |
| 104 | +HTTP/1.1 200 OK |
| 105 | +Content-Length: 448 |
| 106 | +Content-Type: text/html |
| 107 | +Date: Tue, 18 Mar 2025 14:05:04 GMT |
| 108 | +Server: Python/3.10 aiohttp/3.8.1 |
| 109 | +X-PULP-CACHE: MISS |
| 110 | +<html> |
| 111 | +<head><title>Index of </title></head> |
| 112 | +<body bgcolor="white"> |
| 113 | +<h1>Index of </h1> |
| 114 | +<hr><pre><a href="../">../</a> |
| 115 | +<a href="20250318T140338Z/">20250318T140338Z/</a> 18-Mar-2025 14:03 |
| 116 | +<a href="20250318T140442Z/">20250318T140442Z/</a> 18-Mar-2025 14:04 |
| 117 | +</pre><hr></body> |
| 118 | +</html> |
| 119 | + |
| 120 | + |
| 121 | +http ${CONTENT_ADDR}/pulp/content/checkpoints/myfile/20250318T140442Z/ |
| 122 | + |
| 123 | +HTTP/1.1 200 OK |
| 124 | +Content-Length: 835 |
| 125 | +Content-Type: text/html |
| 126 | +Date: Tue, 18 Mar 2025 14:06:31 GMT |
| 127 | +Server: Python/3.10 aiohttp/3.8.1 |
| 128 | +X-PULP-CACHE: MISS |
| 129 | +<html> |
| 130 | +<head><title>Index of /pulp/content/checkpoints/myfile/20250318T140442Z/</title></head> |
| 131 | +<body bgcolor="white"> |
| 132 | +<h1>Index of /pulp/content/checkpoints/myfile/20250318T140442Z/</h1> |
| 133 | +<hr><pre><a href="../">../</a> |
| 134 | +<a href="1.iso">1.iso</a> 18-Mar-2025 14:04 1.0 kB |
| 135 | +<a href="2.iso">2.iso</a> 18-Mar-2025 14:04 1.0 kB |
| 136 | +<a href="3.iso">3.iso</a> 18-Mar-2025 14:04 1.0 kB |
| 137 | +<a href="PULP_MANIFEST">PULP_MANIFEST</a> 18-Mar-2025 14:04 228 Bytes |
| 138 | +</pre><hr></body> |
| 139 | +</html> |
| 140 | +``` |
| 141 | + |
| 142 | +### Testing the Redirect |
| 143 | + |
| 144 | +Finally, test the redirect by attempting to access a timestamp for which no checkpoint exists. The system will automatically redirect you to the nearest checkpoint created at or before the specified timestamp in the URL. |
| 145 | + |
| 146 | +```shell |
| 147 | +$ http ${CONTENT_ADDR}/pulp/content/checkpoints/myfile/20250318T140340Z/ |
| 148 | + |
| 149 | +HTTP/1.1 301 Moved Permanently |
| 150 | +Content-Length: 22 |
| 151 | +Content-Type: text/plain; charset=utf-8 |
| 152 | +Date: Tue, 18 Mar 2025 14:09:19 GMT |
| 153 | +Location: /pulp/content/checkpoints/myfile/20250318T140338Z/ |
| 154 | +Server: Python/3.10 aiohttp/3.8.1 |
| 155 | +301: Moved Permanently |
| 156 | +``` |
| 157 | + |
| 158 | +## Moving Towards SDP |
| 159 | + |
| 160 | +The introduction of the Checkpoint feature is a significant step towards achieving Safe Deployment |
| 161 | +Practices (SDP). |
| 162 | +By ensuring that deployments are predictable and consistent, we can reduce the risk of errors and |
| 163 | +improve the overall quality of our software. |
| 164 | + |
| 165 | +We are excited about the possibilities that the Checkpoint feature brings and look forward to seeing |
| 166 | +how it helps you in your projects. |
| 167 | + |
| 168 | +Happy coding! |
0 commit comments