[3/3] Added doc to setup apt cache.

Message ID 20240927190650.128263-4-alexander.heinisch@siemens.com
State Under Review
Headers show
Series Added support for apt caching | expand

Commit Message

alexander.heinisch Sept. 27, 2024, 7:06 p.m. UTC
From: Alexander Heinisch <alexander.heinisch@siemens.com>

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 doc/apt-cache.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 doc/apt-cache.md

Comments

Niedermayr, BENEDIKT Oct. 8, 2024, 8:12 p.m. UTC | #1
On Fri, 2024-09-27 at 21:06 +0200, alexander.heinisch via isar-users wrote:
> From: Alexander Heinisch <alexander.heinisch@siemens.com>
> 
> Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
> ---
>  doc/apt-cache.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 doc/apt-cache.md
> 
> diff --git a/doc/apt-cache.md b/doc/apt-cache.md
> new file mode 100644
> index 00000000..f03ea7ee
> --- /dev/null
> +++ b/doc/apt-cache.md
> @@ -0,0 +1,55 @@
> +# Using an APT Cache
> +
> +When working on the road limited download bandwitdth oftentimes is an issue, and increases the
> build times drastically.
> +On the other hand large corporate networks could get rate limited by debian mirrors, as many
> peoply / pipelines / aso.
Just a small typo here. You mean "people", don't you?

> +fetch huge amounts of packets.
> +
> +An apt cache can mitigate these issues.
> +
> +## Setup
> +
> +1. Install apt cache
> +
> +```
> +apt install apt-cache-ng
> +```
> +
> +## Using the cache using premirrors
> +
> +1. Set `DISTRO_APT_PREMIRRORS` in your projects `bitbake` or `kas` config:
> +
> +```
> +DISTRO_APT_PREMIRRORS="http://deb\.debian\.org http://localhost:3142/deb.debian.org"\n""
> +```
> +
> +1. Invoke `kas menu` and select
> +    1. `Mirror selection ->
> +    1. Use specific (Debian | Ubuntu) mirror ->
> +    1. URL of (Debian | Ubuntu) mirror (e.g. `http://localhost:3142/deb.debian.org`).
> +
> +
> +## Using the cache when snapshot builds are configured
> +
> +When you chose to use isar's snapshot mechanism:
> +```
> +ISAR_USE_APT_SNAPSHOT = "1"
> +```
> +you can enable the cache, depending on your build environment, as follows:
> +
> +1. Set `DISTRO_APT_SNAPSHOT_PREMIRROR_BASE` in your projects `bitbake` or `kas` config:
> +
> +```
> +DISTRO_APT_SNAPSHOT_PREMIRROR_BASE=localhost:3142/snapshot.debian.org
> +```
> +
> +1. Set `DISTRO_APT_SNAPSHOT_PREMIRROR_BASE`  in your environment and include `kas/opt/mirror-
> snapshot.yaml` to your kas file or append it on kas cli invokation.
Same here: "invocation"

Regards,
Benedikt
> +
> +1. Invoke `kas menu` and select
> +    1. `Mirror selection ->
> +    1. Use the distros snapshot mirror ->
> +    1. Use a cache for snapshot mirror and specify the snapshot mirror you prefer (e.g.
> `localhost:3142/snapshot.debian.org`).
> +
> +
> +> Note: When invoking the build in a containerized environment like `kas/kas-container menu`, you
> have to specify the ip address of the machine running `apt-cacher-ng`.
> +
> +> Note: To limit access to the `apt-cacher-ng`, a dummy network interface can help!
> -- 
> 2.43.0
>

Patch

diff --git a/doc/apt-cache.md b/doc/apt-cache.md
new file mode 100644
index 00000000..f03ea7ee
--- /dev/null
+++ b/doc/apt-cache.md
@@ -0,0 +1,55 @@ 
+# Using an APT Cache
+
+When working on the road limited download bandwitdth oftentimes is an issue, and increases the build times drastically.
+On the other hand large corporate networks could get rate limited by debian mirrors, as many peoply / pipelines / aso.
+fetch huge amounts of packets.
+
+An apt cache can mitigate these issues.
+
+## Setup
+
+1. Install apt cache
+
+```
+apt install apt-cache-ng
+```
+
+## Using the cache using premirrors
+
+1. Set `DISTRO_APT_PREMIRRORS` in your projects `bitbake` or `kas` config:
+
+```
+DISTRO_APT_PREMIRRORS="http://deb\.debian\.org http://localhost:3142/deb.debian.org"\n""
+```
+
+1. Invoke `kas menu` and select
+    1. `Mirror selection ->
+    1. Use specific (Debian | Ubuntu) mirror ->
+    1. URL of (Debian | Ubuntu) mirror (e.g. `http://localhost:3142/deb.debian.org`).
+
+
+## Using the cache when snapshot builds are configured
+
+When you chose to use isar's snapshot mechanism:
+```
+ISAR_USE_APT_SNAPSHOT = "1"
+```
+you can enable the cache, depending on your build environment, as follows:
+
+1. Set `DISTRO_APT_SNAPSHOT_PREMIRROR_BASE` in your projects `bitbake` or `kas` config:
+
+```
+DISTRO_APT_SNAPSHOT_PREMIRROR_BASE=localhost:3142/snapshot.debian.org
+```
+
+1. Set `DISTRO_APT_SNAPSHOT_PREMIRROR_BASE`  in your environment and include `kas/opt/mirror-snapshot.yaml` to your kas file or append it on kas cli invokation.
+
+1. Invoke `kas menu` and select
+    1. `Mirror selection ->
+    1. Use the distros snapshot mirror ->
+    1. Use a cache for snapshot mirror and specify the snapshot mirror you prefer (e.g. `localhost:3142/snapshot.debian.org`).
+
+
+> Note: When invoking the build in a containerized environment like `kas/kas-container menu`, you have to specify the ip address of the machine running `apt-cacher-ng`.
+
+> Note: To limit access to the `apt-cacher-ng`, a dummy network interface can help!