feat: Add Windows Docker Desktop support for local development

- Detect Windows platform and use named pipe (//./pipe/docker_engine)
  instead of Unix socket for Docker Desktop compatibility
- Add NOMAD_STORAGE_PATH environment variable for configurable
  storage paths across different platforms
- Update seeder to use environment variable with Linux default
- Document new environment variable in .env.example

This enables local development on Windows machines with Docker Desktop
while maintaining Linux production compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Chris Sherwood 2026-01-18 17:24:07 -08:00 committed by Jake Turner
parent 15aa1f3598
commit d86c78dba5
3 changed files with 19 additions and 3 deletions

View File

@ -9,4 +9,10 @@ DB_PORT=3306
DB_USER=root
DB_DATABASE=nomad
DB_PASSWORD=password
DB_SSL=false
DB_SSL=false
REDIS_HOST=localhost
REDIS_PORT=6379
# Storage path for NOMAD content (ZIM files, maps, etc.)
# On Windows dev, use an absolute path like: C:/nomad-storage
# On Linux production, use: /opt/project-nomad/storage
NOMAD_STORAGE_PATH=/opt/project-nomad/storage

View File

@ -19,7 +19,15 @@ export class DockerService {
public static KOLIBRI_SERVICE_NAME = 'nomad_kolibri'
constructor() {
this.docker = new Docker({ socketPath: '/var/run/docker.sock' })
// Support both Linux (production) and Windows (development with Docker Desktop)
const isWindows = process.platform === 'win32'
if (isWindows) {
// Windows Docker Desktop uses named pipe
this.docker = new Docker({ socketPath: '//./pipe/docker_engine' })
} else {
// Linux uses Unix socket
this.docker = new Docker({ socketPath: '/var/run/docker.sock' })
}
}
async affectContainer(

View File

@ -2,9 +2,11 @@ import Service from '#models/service'
import { DockerService } from '#services/docker_service'
import { BaseSeeder } from '@adonisjs/lucid/seeders'
import { ModelAttributes } from '@adonisjs/lucid/types/model'
import env from '#start/env'
export default class ServiceSeeder extends BaseSeeder {
private static NOMAD_STORAGE_ABS_PATH = '/opt/project-nomad/storage'
// Use environment variable with fallback to production default
private static NOMAD_STORAGE_ABS_PATH = env.get('NOMAD_STORAGE_PATH', '/opt/project-nomad/storage')
private static DEFAULT_SERVICES: Omit<ModelAttributes<Service>, 'created_at' | 'updated_at' | 'metadata' | 'id'>[] = [
{
service_name: DockerService.KIWIX_SERVICE_NAME,