@aifabrix/builder 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aifabrix/builder",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "description": "AI Fabrix Local Fabric & Deployment SDK",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -13,7 +13,7 @@ services:
13
13
  POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
14
14
  POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
15
15
  ports:
16
- - "5432:5432"
16
+ - "127.0.0.1:5432:5432"
17
17
  volumes:
18
18
  - postgres_data:/var/lib/postgresql/data
19
19
  - ./init-scripts:/docker-entrypoint-initdb.d
@@ -32,7 +32,7 @@ services:
32
32
  container_name: aifabrix-redis
33
33
  command: ["redis-server", "--appendonly", "yes"]
34
34
  ports:
35
- - "6379:6379"
35
+ - "127.0.0.1:6379:6379"
36
36
  volumes:
37
37
  - redis_data:/data
38
38
  networks:
@@ -53,7 +53,7 @@ services:
53
53
  PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
54
54
  PGADMIN_CONFIG_SERVER_MODE: 'False'
55
55
  ports:
56
- - "5050:80"
56
+ - "127.0.0.1:5050:80"
57
57
  volumes:
58
58
  - pgadmin_data:/var/lib/pgadmin
59
59
  restart: unless-stopped
@@ -73,7 +73,7 @@ services:
73
73
  HTTP_PASSWORD: ${REDIS_COMMANDER_PASSWORD}
74
74
  REDIS_PASSWORD: ""
75
75
  ports:
76
- - "8081:8081"
76
+ - "127.0.0.1:8081:8081"
77
77
  restart: unless-stopped
78
78
  depends_on:
79
79
  redis:
@@ -34,6 +34,7 @@ services:
34
34
  db-init:
35
35
  image: pgvector/pgvector:pg15
36
36
  container_name: {{containerName}}-db-init
37
+ entrypoint: []
37
38
  env_file:
38
39
  - ${ADMIN_SECRETS_PATH}
39
40
  - {{envFile}}
@@ -51,10 +52,15 @@ services:
51
52
  {{/if}}
52
53
  networks:
53
54
  - {{networkName}}
54
- command: >
55
- sh -c "
55
+ volumes: []
56
+ tmpfs:
57
+ - /var/lib/postgresql/data
58
+ command:
59
+ - sh
60
+ - -c
61
+ - |
56
62
  export PGHOST=postgres PGPORT=5432 PGUSER=pgadmin &&
57
- export PGPASSWORD=\"${POSTGRES_PASSWORD}\" &&
63
+ export PGPASSWORD="${POSTGRES_PASSWORD}" &&
58
64
  echo 'Waiting for PostgreSQL to be ready...' &&
59
65
  counter=0 &&
60
66
  while [ ${counter:-0} -lt 30 ]; do
@@ -69,32 +75,41 @@ services:
69
75
  {{#if databases}}
70
76
  {{#each databases}}
71
77
  echo 'Creating {{name}} database and user...' &&
72
- if psql -d postgres -tAc \"SELECT 1 FROM pg_database WHERE datname = '{{name}}'\" 2>/dev/null | grep -q '^1$'; then
73
- echo 'Database \\\"{{name}}\\\" already exists, all ok.'
78
+ if psql -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname = '{{name}}'" 2>/dev/null | grep -q '^1$'; then
79
+ echo 'Database "{{name}}" already exists, all ok.'
74
80
  else
75
- (psql -d postgres -c \"CREATE DATABASE \\\"{{name}}\\\";\" || true) &&
76
- (psql -d postgres -c \"DROP USER IF EXISTS \\\"{{pgUserOld name}}\\\";\" || true) &&
77
- (psql -d postgres -c \"CREATE USER {{pgUser name}} WITH PASSWORD '${DB_{{@index}}_PASSWORD}';\" || true) &&
78
- psql -d postgres -c \"GRANT ALL PRIVILEGES ON DATABASE \\\"{{name}}\\\" TO {{pgUser name}};\" || true &&
79
- psql -d {{name}} -c \"ALTER SCHEMA public OWNER TO {{pgUser name}};\" || true &&
80
- psql -d {{name}} -c \"GRANT ALL ON SCHEMA public TO {{pgUser name}};\" || true
81
+ echo 'Creating database "{{name}}"...' &&
82
+ psql -d postgres -c "CREATE DATABASE \"{{name}}\";" &&
83
+ echo 'Dropping old user if exists...' &&
84
+ psql -d postgres -c "DROP USER IF EXISTS \"{{pgUserOld name}}\";" || true &&
85
+ echo 'Creating user "{{pgUserName name}}"...' &&
86
+ psql -d postgres -c 'CREATE USER "{{pgUserName name}}" WITH PASSWORD '\''${DB_{{@index}}_PASSWORD}'\'';' &&
87
+ echo 'Granting privileges...' &&
88
+ psql -d postgres -c "GRANT ALL PRIVILEGES ON DATABASE \"{{name}}\" TO \"{{pgUserName name}}\";" &&
89
+ psql -d {{name}} -c "ALTER SCHEMA public OWNER TO \"{{pgUserName name}}\";" &&
90
+ psql -d {{name}} -c "GRANT ALL ON SCHEMA public TO \"{{pgUserName name}}\";" &&
91
+ echo 'Database "{{name}}" created successfully!'
81
92
  fi &&
82
93
  {{/each}}
83
94
  {{else}}
84
95
  echo 'Creating {{app.key}} database and user...' &&
85
- if psql -d postgres -tAc \"SELECT 1 FROM pg_database WHERE datname = '{{app.key}}'\" 2>/dev/null | grep -q '^1$'; then
86
- echo 'Database \\\"{{app.key}}\\\" already exists, all ok.'
96
+ if psql -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname = '{{app.key}}'" 2>/dev/null | grep -q '^1$'; then
97
+ echo 'Database "{{app.key}}" already exists, all ok.'
87
98
  else
88
- (psql -d postgres -c \"CREATE DATABASE \\\"{{app.key}}\\\";\" || true) &&
89
- (psql -d postgres -c \"DROP USER IF EXISTS \\\"{{pgUserOld app.key}}\\\";\" || true) &&
90
- (psql -d postgres -c \"CREATE USER {{pgUser app.key}} WITH PASSWORD '${DB_0_PASSWORD:-${DB_PASSWORD}}';\" || true) &&
91
- psql -d postgres -c \"GRANT ALL PRIVILEGES ON DATABASE \\\"{{app.key}}\\\" TO {{pgUser app.key}};\" || true &&
92
- psql -d {{app.key}} -c \"ALTER SCHEMA public OWNER TO {{pgUser app.key}};\" || true &&
93
- psql -d {{app.key}} -c \"GRANT ALL ON SCHEMA public TO {{pgUser app.key}};\" || true
99
+ echo 'Creating database "{{app.key}}"...' &&
100
+ psql -d postgres -c "CREATE DATABASE \"{{app.key}}\";" &&
101
+ echo 'Dropping old user if exists...' &&
102
+ psql -d postgres -c "DROP USER IF EXISTS \"{{pgUserOld app.key}}\";" || true &&
103
+ echo 'Creating user "{{pgUserName app.key}}"...' &&
104
+ psql -d postgres -c 'CREATE USER "{{pgUserName app.key}}" WITH PASSWORD '\''${DB_0_PASSWORD:-${DB_PASSWORD}}'\'';' &&
105
+ echo 'Granting privileges...' &&
106
+ psql -d postgres -c "GRANT ALL PRIVILEGES ON DATABASE \"{{app.key}}\" TO \"{{pgUserName app.key}}\";" &&
107
+ psql -d {{app.key}} -c "ALTER SCHEMA public OWNER TO \"{{pgUserName app.key}}\";" &&
108
+ psql -d {{app.key}} -c "GRANT ALL ON SCHEMA public TO \"{{pgUserName app.key}}\";" &&
109
+ echo 'Database "{{app.key}}" created successfully!'
94
110
  fi &&
95
111
  {{/if}}
96
112
  echo 'Database initialization complete!'
97
- "
98
113
  restart: "no"
99
114
  {{/if}}
100
115
 
@@ -34,6 +34,7 @@ services:
34
34
  db-init:
35
35
  image: pgvector/pgvector:pg15
36
36
  container_name: {{containerName}}-db-init
37
+ entrypoint: []
37
38
  env_file:
38
39
  - ${ADMIN_SECRETS_PATH}
39
40
  - {{envFile}}
@@ -51,10 +52,15 @@ services:
51
52
  {{/if}}
52
53
  networks:
53
54
  - {{networkName}}
54
- command: >
55
- sh -c "
55
+ volumes: []
56
+ tmpfs:
57
+ - /var/lib/postgresql/data
58
+ command:
59
+ - sh
60
+ - -c
61
+ - |
56
62
  export PGHOST=postgres PGPORT=5432 PGUSER=pgadmin &&
57
- export PGPASSWORD=\"${POSTGRES_PASSWORD}\" &&
63
+ export PGPASSWORD="${POSTGRES_PASSWORD}" &&
58
64
  echo 'Waiting for PostgreSQL to be ready...' &&
59
65
  counter=0 &&
60
66
  while [ ${counter:-0} -lt 30 ]; do
@@ -69,32 +75,41 @@ services:
69
75
  {{#if databases}}
70
76
  {{#each databases}}
71
77
  echo 'Creating {{name}} database and user...' &&
72
- if psql -d postgres -tAc \"SELECT 1 FROM pg_database WHERE datname = '{{name}}'\" 2>/dev/null | grep -q '^1$'; then
73
- echo 'Database \\\"{{name}}\\\" already exists, all ok.'
78
+ if psql -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname = '{{name}}'" 2>/dev/null | grep -q '^1$'; then
79
+ echo 'Database "{{name}}" already exists, all ok.'
74
80
  else
75
- (psql -d postgres -c \"CREATE DATABASE \\\"{{name}}\\\";\" || true) &&
76
- (psql -d postgres -c \"DROP USER IF EXISTS \\\"{{pgUserOld name}}\\\";\" || true) &&
77
- (psql -d postgres -c \"CREATE USER {{pgUser name}} WITH PASSWORD '${DB_{{@index}}_PASSWORD}';\" || true) &&
78
- psql -d postgres -c \"GRANT ALL PRIVILEGES ON DATABASE \\\"{{name}}\\\" TO {{pgUser name}};\" || true &&
79
- psql -d {{name}} -c \"ALTER SCHEMA public OWNER TO {{pgUser name}};\" || true &&
80
- psql -d {{name}} -c \"GRANT ALL ON SCHEMA public TO {{pgUser name}};\" || true
81
+ echo 'Creating database "{{name}}"...' &&
82
+ psql -d postgres -c "CREATE DATABASE \"{{name}}\";" &&
83
+ echo 'Dropping old user if exists...' &&
84
+ psql -d postgres -c "DROP USER IF EXISTS \"{{pgUserOld name}}\";" || true &&
85
+ echo 'Creating user "{{pgUserName name}}"...' &&
86
+ psql -d postgres -c 'CREATE USER "{{pgUserName name}}" WITH PASSWORD '\''${DB_{{@index}}_PASSWORD}'\'';' &&
87
+ echo 'Granting privileges...' &&
88
+ psql -d postgres -c "GRANT ALL PRIVILEGES ON DATABASE \"{{name}}\" TO \"{{pgUserName name}}\";" &&
89
+ psql -d {{name}} -c "ALTER SCHEMA public OWNER TO \"{{pgUserName name}}\";" &&
90
+ psql -d {{name}} -c "GRANT ALL ON SCHEMA public TO \"{{pgUserName name}}\";" &&
91
+ echo 'Database "{{name}}" created successfully!'
81
92
  fi &&
82
93
  {{/each}}
83
94
  {{else}}
84
95
  echo 'Creating {{app.key}} database and user...' &&
85
- if psql -d postgres -tAc \"SELECT 1 FROM pg_database WHERE datname = '{{app.key}}'\" 2>/dev/null | grep -q '^1$'; then
86
- echo 'Database \\\"{{app.key}}\\\" already exists, all ok.'
96
+ if psql -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname = '{{app.key}}'" 2>/dev/null | grep -q '^1$'; then
97
+ echo 'Database "{{app.key}}" already exists, all ok.'
87
98
  else
88
- (psql -d postgres -c \"CREATE DATABASE \\\"{{app.key}}\\\";\" || true) &&
89
- (psql -d postgres -c \"DROP USER IF EXISTS \\\"{{pgUserOld app.key}}\\\";\" || true) &&
90
- (psql -d postgres -c \"CREATE USER {{pgUser app.key}} WITH PASSWORD '${DB_0_PASSWORD:-${DB_PASSWORD}}';\" || true) &&
91
- psql -d postgres -c \"GRANT ALL PRIVILEGES ON DATABASE \\\"{{app.key}}\\\" TO {{pgUser app.key}};\" || true &&
92
- psql -d {{app.key}} -c \"ALTER SCHEMA public OWNER TO {{pgUser app.key}};\" || true &&
93
- psql -d {{app.key}} -c \"GRANT ALL ON SCHEMA public TO {{pgUser app.key}};\" || true
99
+ echo 'Creating database "{{app.key}}"...' &&
100
+ psql -d postgres -c "CREATE DATABASE \"{{app.key}}\";" &&
101
+ echo 'Dropping old user if exists...' &&
102
+ psql -d postgres -c "DROP USER IF EXISTS \"{{pgUserOld app.key}}\";" || true &&
103
+ echo 'Creating user "{{pgUserName app.key}}"...' &&
104
+ psql -d postgres -c 'CREATE USER "{{pgUserName app.key}}" WITH PASSWORD '\''${DB_0_PASSWORD:-${DB_PASSWORD}}'\'';' &&
105
+ echo 'Granting privileges...' &&
106
+ psql -d postgres -c "GRANT ALL PRIVILEGES ON DATABASE \"{{app.key}}\" TO \"{{pgUserName app.key}}\";" &&
107
+ psql -d {{app.key}} -c "ALTER SCHEMA public OWNER TO \"{{pgUserName app.key}}\";" &&
108
+ psql -d {{app.key}} -c "GRANT ALL ON SCHEMA public TO \"{{pgUserName app.key}}\";" &&
109
+ echo 'Database "{{app.key}}" created successfully!'
94
110
  fi &&
95
111
  {{/if}}
96
112
  echo 'Database initialization complete!'
97
- "
98
113
  restart: "no"
99
114
  {{/if}}
100
115