Skip to content

Commit d86c78d

Browse files
chriscrosstalkclaude
authored andcommitted
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>
1 parent 15aa1f3 commit d86c78d

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

admin/.env.example

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@ DB_PORT=3306
99
DB_USER=root
1010
DB_DATABASE=nomad
1111
DB_PASSWORD=password
12-
DB_SSL=false
12+
DB_SSL=false
13+
REDIS_HOST=localhost
14+
REDIS_PORT=6379
15+
# Storage path for NOMAD content (ZIM files, maps, etc.)
16+
# On Windows dev, use an absolute path like: C:/nomad-storage
17+
# On Linux production, use: /opt/project-nomad/storage
18+
NOMAD_STORAGE_PATH=/opt/project-nomad/storage

admin/app/services/docker_service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ export class DockerService {
1919
public static KOLIBRI_SERVICE_NAME = 'nomad_kolibri'
2020

2121
constructor() {
22-
this.docker = new Docker({ socketPath: '/var/run/docker.sock' })
22+
// Support both Linux (production) and Windows (development with Docker Desktop)
23+
const isWindows = process.platform === 'win32'
24+
if (isWindows) {
25+
// Windows Docker Desktop uses named pipe
26+
this.docker = new Docker({ socketPath: '//./pipe/docker_engine' })
27+
} else {
28+
// Linux uses Unix socket
29+
this.docker = new Docker({ socketPath: '/var/run/docker.sock' })
30+
}
2331
}
2432

2533
async affectContainer(

admin/database/seeders/service_seeder.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import Service from '#models/service'
22
import { DockerService } from '#services/docker_service'
33
import { BaseSeeder } from '@adonisjs/lucid/seeders'
44
import { ModelAttributes } from '@adonisjs/lucid/types/model'
5+
import env from '#start/env'
56

67
export default class ServiceSeeder extends BaseSeeder {
7-
private static NOMAD_STORAGE_ABS_PATH = '/opt/project-nomad/storage'
8+
// Use environment variable with fallback to production default
9+
private static NOMAD_STORAGE_ABS_PATH = env.get('NOMAD_STORAGE_PATH', '/opt/project-nomad/storage')
810
private static DEFAULT_SERVICES: Omit<ModelAttributes<Service>, 'created_at' | 'updated_at' | 'metadata' | 'id'>[] = [
911
{
1012
service_name: DockerService.KIWIX_SERVICE_NAME,

0 commit comments

Comments
 (0)