Container Naming Migration and Service Refactoring

Summary

The process of transitioning the Sokrates Docker stack from legacy service names (Grimoire and Philosopher) to the current naming convention (Eidos and Hermes). This involved synchronized updates across NixOS configuration files, production and development Docker Compose manifests, and internal environment variable references.

Details

During the evolution of the Sokrates project, a significant refactoring was required to align the running container names with the updated project nomenclature. The legacy system utilized names such as sokrates-grimoire (now Eidos) and sokrates-philosopher or philosopher-king (now Hermes).

Configuration Management

The migration identified a discrepancy between the development environment and the production deployment on the NixOS appliances. While development files in eidos/docker-compose.prod.yml had been partially updated, the production configuration managed by NixOS remained on the old naming scheme.

The production Docker Compose file is located on the target appliance at /var/lib/sokrates/docker-compose.yml. This file is generated and managed via the NixOS configuration, specifically sourced from the repository path nixos/containers/docker-compose.yml. Because the NixOS systemd service only manages the lifecycle of the compose stack, a full NixOS rebuild and stack restart were necessary to propagate name changes to the actual Docker daemon.

Technical Dependencies and References

The renaming process required more than simple string replacement in YAML keys; it necessitated the update of internal service dependencies and environment variables:

  • Service Links: The philosopher-king (Hermes) service had explicit depends_on requirements for the grimoire (Eidos) service name.
  • Environment Variables: Internal references to sokrates-grimoire within the environment configuration of other containers had to be updated to ensure inter-service communication remained functional.
  • Image Mapping: During the transition, the containers continued to pull images from ghcr.io/sokrates-is/grimoire:latest. The migration strategy allowed for renaming the container_name and service keys within the compose file without requiring an immediate rebuild of the underlying container images, decoupling orchestration changes from image CI/CD.

Execution Steps

  1. Source Update: Modify nixos/containers/docker-compose.yml to rename services and containers.
  2. Internal Reference Fix: Update environment variables and depends_on blocks to match new service keys.
  3. Dev Alignment: Update the root development compose file and eidos/Dockerfile references to ensure parity between dev and prod.
  4. Deployment: Execute a NixOS rebuild to deploy the updated manifest to /var/lib/sokrates/.
  5. Service Restart: Restart the Docker Compose systemd service to recreate containers with the new identities.