From 721806aef4f59b00f1b748d4aee9f43c3991177a Mon Sep 17 00:00:00 2001
From: Hamza Remmal <hamza@remmal.net>
Date: Sun, 23 Mar 2025 15:45:19 +0000
Subject: [PATCH] chore: add local registry as a service

---
 .devcontainer/config/registries.yaml |  8 ++++++++
 docker-compose.yaml                  | 12 +++++++++++-
 docs/dev_setup.md                    | 17 +++++++++++++----
 3 files changed, 32 insertions(+), 5 deletions(-)
 create mode 100644 .devcontainer/config/registries.yaml

diff --git a/.devcontainer/config/registries.yaml b/.devcontainer/config/registries.yaml
new file mode 100644
index 00000000..2e8876ab
--- /dev/null
+++ b/.devcontainer/config/registries.yaml
@@ -0,0 +1,8 @@
+mirrors:
+  autograde.io:
+    endpoint:
+      - "http://registry:5000"
+configs:
+  "autograde.io":
+    tls:
+      insecure_skip_verify: true
diff --git a/docker-compose.yaml b/docker-compose.yaml
index d0d2056b..4bdfa03e 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -1,4 +1,12 @@
 services:
+  registry:
+    image: registry:2
+    ports:
+      - "5001:5000"
+    volumes:
+      - registry-data:/var/lib/registry
+    networks:
+      autograde-network:
   moodle-db:
     container_name: moodle-db
     image: mysql:8.0.33
@@ -47,6 +55,7 @@ services:
     volumes:
       - kubernetes:/var/lib/rancher/k3s
       - kubernetes-config:/config
+      - ./.devcontainer/config/registries.yaml:/etc/rancher/k3s/registries.yaml:ro
     ports:
       - "6443:6443"  # Kubernetes API Server
     networks:
@@ -72,7 +81,7 @@ services:
       AUTOGRADE_JOB_NAMESPACE: default
       AUTOGRADE_JOB_IMAGE_PULL-POLICY: IFNOTPRESENT
       AUTOGRADE_JOB_TTL: 172800
-      AUTOGRADE_MANAGER_IMAGE: autograde/submission-manager:1.2.4
+      AUTOGRADE_MANAGER_IMAGE: autograde.io/autograde/submission-manager:local-dev
       AUTOGRADE_MANAGER_PULL-POLICY: IFNOTPRESENT
     volumes:
       - kubernetes-config:/config
@@ -82,6 +91,7 @@ services:
 volumes:
   moodle-db-data:
   moodle-data:
+  registry-data:
   kubernetes:
   kubernetes-agent:
   kubernetes-config:
diff --git a/docs/dev_setup.md b/docs/dev_setup.md
index ff494bbc..3509428f 100644
--- a/docs/dev_setup.md
+++ b/docs/dev_setup.md
@@ -34,13 +34,22 @@ This is done by adding the line `127.0.0.1     moodle` to [/etc/host](https://en
 make add-host
 ```
 
-### Step 3: Access The Services 
+### Step 3: Push the Submission's Manager to the registry
+
+The following configuration requires to push to a remote registry (locally deployed)
+each change that happens in the [](../autograde-submission-manager) project.
+
+```shell
+ docker buildx build --push -t localhost:5001/autograde/submission-manager:local-dev autograde-submission-manager/
+```
+
+### Step 4: Access The Services 
 
 The local instance of Moodle is accessible at http://moodle.
 
 The autograde service is reachable at http://localhost:8082/api/v1/ping.
 
-### Step 4: Moodle Installation
+### Step 5: Moodle Installation
 
 At this point, you should see the following webpage when accessing http://moodle:
 
@@ -49,13 +58,13 @@ At this point, you should see the following webpage when accessing http://moodle
 Go through the [installation step](https://docs.moodle.org/404/en/Installing_Moodle#Web_based_installer).
 You can enter whatever value you want for the required fields.
 
-### Step 5: Moodle Configuration
+### Step 6: Moodle Configuration
 
 Now that Moodle is installed, follow the instruction in [moodle_config.md](./moodle_config.md) to configure the Moodle instance.
 
 At this point, you should have a local instance of the Moodle autograde cluster configured and running. 
 
-### Step 6: To Go Further
+### Step 7: To Go Further
 
 Now that a local instance of the autograde cluster is set up,
 you can experiment with creating classes and auto-graded homeworks.
-- 
GitLab