Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local dev experience: improving ports.ubuntu.com situation #402

Open
ewdurbin opened this issue Jul 24, 2024 · 1 comment
Open

local dev experience: improving ports.ubuntu.com situation #402

ewdurbin opened this issue Jul 24, 2024 · 1 comment
Assignees

Comments

@ewdurbin
Copy link
Member

ARM64 packages for Ubuntu are not served off of the main mirror network, but rather ports.ubuntu.com.

@JacobCoffee and I have noticed poor performance from this service when running psf-salt Vagrant containers on Apple Silicon (arm64).

We should research ways to improve this situation and maybe implement something like a transparent caching proxy when running locally.

@ewdurbin
Copy link
Member Author

ewdurbin commented Jul 24, 2024

just hacking around a bit, applied this diff (orbstack dependent!):

diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..9ff6842
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,15 @@
+---
+version: '3'
+
+services:
+  apt-cacher-ng:
+    image: sameersbn/apt-cacher-ng
+    container_name: apt-cacher-ng
+    ports:
+      - "3142:3142"
+    volumes:
+      - apt-cacher-ng:/var/cache/apt-cacher-ng
+    restart: always
+
+volumes:
+  apt-cacher-ng:
diff --git a/dockerfiles/Dockerfile.jammy b/dockerfiles/Dockerfile.jammy
index 303bb4a..a3bb4df 100644
--- a/dockerfiles/Dockerfile.jammy
+++ b/dockerfiles/Dockerfile.jammy
@@ -8,6 +8,9 @@ ENV container docker
 
 RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo $TZ > /etc/timezone
 
+RUN echo 'Acquire::HTTP::Proxy "http://apt-cacher-ng.psf-salt.orb.local:3142";' >> /etc/apt/apt.conf.d/01proxy \
+ && echo 'Acquire::HTTPS::Proxy "false";' >> /etc/apt/apt.conf.d/01proxy
+
 RUN apt-get update -y && apt-get dist-upgrade -y
 
 # Install system dependencies, you may not need all of these
diff --git a/dockerfiles/Dockerfile.noble b/dockerfiles/Dockerfile.noble
index 944a0d4..0b68457 100644
--- a/dockerfiles/Dockerfile.noble
+++ b/dockerfiles/Dockerfile.noble
@@ -8,6 +8,9 @@ ENV container docker
 
 RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo $TZ > /etc/timezone
 
+RUN echo 'Acquire::HTTP::Proxy "http://apt-cacher-ng.psf-salt.orb.local:3142";' >> /etc/apt/apt.conf.d/01proxy \
+ && echo 'Acquire::HTTPS::Proxy "false";' >> /etc/apt/apt.conf.d/01proxy
+
 RUN apt-get update -y && apt-get dist-upgrade -y
 
 # Install system dependencies, you may not need all of these

and saw the following result for time vagrant up salt-master:

Before:

real	7m35.815s
user	0m2.657s
sys	0m1.049s

After (after docker compose uping the cache container and running once to fill up the cache):

real	5m18.678s
user	0m2.630s
sys	0m1.027s

So the potential win is pretty clear given that the "Before" is basically best case when ports is behaving, but I have some concerns about how to do this more ergonomically. Currently needing to docker compose up and remember to do so is kind of a pain and isn't "built in". If you forget to the whole thing fails kinda miserably. Also it's relying on orbstack magic DNS to make the container discoverable... which isn't ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants