File size: 2,802 Bytes
5285b72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
local docker_compose = {
  image: 'govsearch:latest',
  build: '.',
  entrypoint: ['/usr/bin/env'],
  environment: {
    TZ: 'UTC',
  },
};
local docker_compose_frontend = docker_compose {
  command: [
    'npx',
    'remix',
    'vite:dev',
    '--host',
    '0.0.0.0',
    '--port',
    '7861',
  ],
  ports: ['7861:7861'],
  depends_on: ['backend'],
};
local docker_compose_backend = docker_compose {
  command: [
    'uvicorn',
    'backend:app',
    '--host',
    '0.0.0.0',
    '--port',
    '7860',
    '--log-level',
    'debug',
    '--reload',
  ],
  environment+: {
    OPENAI_API_KEY: null,
  },
  ports: ['7860:7860'],
  depends_on: ['vespa'],
};
local docker_compose_vespa = {
  image: 'vespaengine/vespa:8.324.16',
  volumes: [
    'vespa:/opt/vespa/var',
  ],
  ports: [
    '4080:4080',
    '19071:19071',
    '19092:19092',
  ],
  // NOTE: https://github.com/vespa-engine/vespa/blob/master/vespabase/src/vespa.service.in
  ulimits: {
    nofile: { soft: 32768, hard: 262144 },
    nproc: { soft: 32768, hard: 409600 },
  },
};

local tsconfig_compiler_options = {
  allowJs: false,
  allowSyntheticDefaultImports: true,
  allowUnreachableCode: false,
  esModuleInterop: true,
  experimentalDecorators: false,
  forceConsistentCasingInFileNames: true,
  incremental: true,
  isolatedModules: true,
  noEmit: true,
  noFallthroughCasesInSwitch: true,
  noImplicitAny: true,
  noUncheckedIndexedAccess: true,
  resolveJsonModule: true,
  skipLibCheck: false,
  strict: true,
  strictNullChecks: true,
  target: 'ES2022',
};
local tsconfig = {
  compilerOptions: tsconfig_compiler_options {
    baseUrl: '.',
    jsx: 'react-jsx',
    module: 'ESNext',
    moduleResolution: 'Bundler',
    lib: ['DOM', 'DOM.Iterable', 'ES2022'],
    paths: {
      '~/*': ['./frontend/*'],
    },
  },
  include: [
    'env.d.ts',
    'frontend/**/*.ts',
    'frontend/**/*.tsx',
  ],
};
local tsconfig_scripts = {
  compilerOptions: tsconfig_compiler_options {
    baseUrl: '.',
    module: 'commonjs',
    moduleResolution: 'Node',
    lib: ['DOM', 'DOM.Iterable', 'ES2022'],
    paths: {
      '~/*': ['./scripts/*'],
    },
  },
  include: [
    'scripts/**/*.ts',
  ],
};

{
  'docker-compose.yml': std.manifestYamlDoc(
    {
      version: '3.4',
      services: {
        frontend: docker_compose_frontend,
        backend: docker_compose_backend,
        vespa: docker_compose_vespa,
      },
      volumes: {
        vespa: null,
      },
    },
    indent_array_in_object=true,
  ),
  'docker-compose.vespa.yml': std.manifestYamlDoc(
    {
      version: '3.4',
      services: {
        vespa: docker_compose_vespa,
      },
      volumes: {
        vespa: null,
      },
    },
    indent_array_in_object=true,
  ),
  'tsconfig.json': tsconfig,
  'tsconfig.scripts.json': tsconfig_scripts,
}