← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ruinedyourlife/lp-archive:feat-landing-page into lp-archive:main

 

Quentin Debhi has proposed merging ~ruinedyourlife/lp-archive:feat-landing-page into lp-archive:main.

Commit message:
Add a landing page

Display a stylized html page with the snapshot documentation

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ruinedyourlife/lp-archive/+git/lp-archive/+merge/463217
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ruinedyourlife/lp-archive:feat-landing-page into lp-archive:main.
diff --git a/charm/lp-archive/templates/index.html b/charm/lp-archive/templates/index.html
new file mode 100644
index 0000000..757a6ba
--- /dev/null
+++ b/charm/lp-archive/templates/index.html
@@ -0,0 +1,116 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Ubuntu Snapshot Service</title>
+    <link rel="stylesheet" href="https://assets.ubuntu.com/v1/vanilla-framework-version-4.9.0.min.css";>
+</head>
+<body class="is-paper">
+
+<div class="p-strip--light">
+    <div class="row">
+        <div class="col-12">
+            <h1 class="p-heading--1">Ubuntu Snapshot Service</h1>
+            <p>The Ubuntu snapshot service allows you to see and use the Ubuntu archive as it was at any specified date and time, with snapshots available for any date and time after March 1, 2023.</p>
+        </div>
+    </div>
+</div>
+
+<div class="p-strip">
+    <div class="row">
+        <div class="col-8">
+            <h2>Common Use Cases</h2>
+            <ul>
+                <li>Enabling reproducible deployments of a set of packages as at a particular date and time</li>
+                <li>Determining when a change in behaviour occurred in the archive</li>
+                <li>Supporting a structured update workflow</li>
+            </ul>
+            <h2>Quick-start Example</h2>
+            <pre><code>apt install hello --update --snapshot 20240301T030400Z</code></pre>
+        </div>
+        <div class="col-4">
+            <h2>Supported Versions</h2>
+            <p>Snapshots are supported in Ubuntu 23.10 onwards, and on updated installations of Ubuntu 20.04 LTS and Ubuntu 22.04 LTS.</p>
+        </div>
+    </div>
+</div>
+
+<div class="p-strip-light">
+    <div class="row">
+        <div class="col-12">
+            <h2>How to Use Snapshots on Ubuntu</h2>
+            <h3>Enable Snapshot Service</h3>
+            <p>For Ubuntu 24.04 and later, snapshots are enabled by default. For earlier versions, edit <code>/etc/apt/sources.list</code> as follows:</p>
+            <pre><code>deb [snapshot=yes] http://archive.ubuntu.com/ubuntu/ jammy main restricted
+deb [snapshot=yes] http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
+deb [snapshot=yes] http://security.ubuntu.com/ubuntu jammy-security main restricted</code></pre>
+            <h3>Use a Snapshot ID with apt Commands</h3>
+            <p>The Snapshot ID will be the desired date and UTC time in the YYYYMMDDTHHMMSSZ format, for example 20230302T030400Z for 03:04 UTC on 2 March 2023.</p>
+            <p>Once enabled, you can use a snapshot ID with most apt commands:</p>
+            <pre><code>apt update --snapshot 20231102T030400Z
+apt policy hello -S 20231102T030400Z
+apt install hello --snapshot 20231102T030400Z</code></pre>
+            <p>Note that the <code>apt update</code> command needs to be run immediatly before the other <code>apt</code> commands. These commands will also fail if the snapshot format is incorrect or the snapshot does not exist.</p>
+            <p>Alternatively, it is possible to set apt to use a particular snapshot for all apt commands. To do this, the specific Snapshot ID can be used in the place of “yes” in the relevant source. If a specific snapshot is configured in this way then it will be used even if a different snapshot ID is given as part of an apt command.</p>
+            <p>Ubuntu 24.04 LTS onwards:</p>
+            <pre><code>Types: deb
+URIs: http://archive.ubuntu.com/ubuntu
+Suites: noble noble-updates
+Components: main universe
+Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
+Snapshot: 20240301T030400Z
+
+Ubuntu security updates. Aside from URIs and Suites,
+## this should mirror your choices in the previous section.
+Types: deb
+URIs: http://security.ubuntu.com/ubuntu
+Suites: noble-security
+Components: main universe
+Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
+Snapshot: 20240301T030400Z</code></pre>
+            <p>Ubuntu 23.10 and earlier:</p>
+            <pre><code>deb [snapshot=20230302T030400Z] http://archive.ubuntu.com/ubuntu/ jammy main restricted
+deb [snapshot=20230302T030400Z] http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
+deb [snapshot=20230302T030400Z] http://security.ubuntu.com/ubuntu jammy-security main restricted</code></pre>
+            <h3>Disable Snapshot Service</h3>
+            <p>For Ubuntu 24.04 and later, since snapshots are enabled automatically for supported repositories, edit the relevant sources file (e.g.  /etc/apt/sources.list.d/ubuntu.sources) to add <code>Snapshot: no</code> to the relevant sources, for example:</p>
+            <pre><code>Types: deb
+URIs: http://archive.ubuntu.com/ubuntu
+Suites: noble noble-updates
+Components: main universe
+Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
+Snapshot: no</pre></code>
+            <p>For Ubuntu 23.10 and earlier, snapshots should not be enabled as explained above. You can always remove the <code>[snapshot=yes]</code> tag if you previously enabled them.</p>
+
+
+        </div>
+    </div>
+</div>
+
+<div class="p-strip--light">
+    <div class="row">
+        <div class="col-12">
+            <h2>See Also</h2>
+            <ul class="p-list">
+                <li><a href="https://www.youtube.com/watch?v=0tAzyHsNi3s";>APT Archive Snapshot Integration Demo (Ubuntu 23.10)</a></li>
+                <li><a href="https://ubuntu.com/blog/ubuntu-snapshots-on-azure-ensuring-predictability-and-consistency-in-cloud-deployments";>Ubuntu Snapshots on Microsoft Azure: Ensuring predictability and consistency in cloud deployments</a></li>
+                <li><a href="https://ubuntu.com/blog/securing-multiple-ubuntu-instances-while-maximising-uptime";>Ubuntu Explained: How to ensure security and stability in cloud instances—part 3</a></li>
+                <li><a href="https://manpages.ubuntu.com/manpages/noble/en/man8/apt-get.8.html";>apt-get manpage</a></li>
+                <li><a href="https://manpages.ubuntu.com/manpages/noble/en/man5/apt.conf.5.html";>apt.conf manpage</a></li>
+                <li><a href="https://manpages.ubuntu.com/manpages/noble/en/man5/sources.list.5.html";>sources.list manpage</a></li>
+                <li><a href="https://techcommunity.microsoft.com/t5/linux-and-open-source-blog/increased-security-and-resiliency-of-canonical-workloads-on/ba-p/3970623";>Increased security and resiliency of Canonical workloads on Azure - now in preview</a></li>
+                <li><a href="https://www.youtube.com/watch?v=hxDPqRDY5Lk";>Using Ubuntu’s new snapshot service at scale with Azure and AKS</a></li>
+            </ul>
+        </div>
+    </div>
+</div>
+
+<footer class="p-strip is-shallow">
+    <div class="row">
+        <p class="u-align-text--center">© 2004 <a href="http://canonical.com/";>Canonical&nbsp;Ltd.</a></p>
+    </div>
+</footer>
+
+</body>
+</html>
diff --git a/lp_archive/root.py b/lp_archive/root.py
index f0304b5..e175759 100644
--- a/lp_archive/root.py
+++ b/lp_archive/root.py
@@ -3,11 +3,11 @@
 
 """API views for the Launchpad archive service."""
 
-from flask import Flask
+from flask import Flask, render_template
 
 
 def root() -> tuple[str, dict[str, str]]:
-    return "Launchpad archive service.\n", {"Content-Type": "text/plain"}
+    return render_template("index.html"), {"Content-Type": "text/html"}
 
 
 def init_app(app: Flask) -> None: