Skip to content

Commit a1974b8

Browse files
committed
use DB_TYPE=postgres by default (DB_TYPE=none for no db at all)
Signed-off-by: Guy Margalit <[email protected]>
1 parent caddda5 commit a1974b8

File tree

26 files changed

+143
-65
lines changed

26 files changed

+143
-65
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ coverage/
55
logs/
66
*.log
77
storage/
8-
noobaa_storage/
98
heapdump-*
109
.vscode/
1110
*.IGNORE

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ config-local.js
1616

1717
## STORAGE
1818
/storage/
19-
/agent_storage*
20-
/noobaa_storage*
21-
/agent_conf*.json*
2219

2320
## DEVELOPER
2421
.vscode

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ test: tester
111111
@$(call run_mongo)
112112
@$(call run_blob_mock)
113113
@echo "\033[1;34mRunning tests\033[0m"
114-
$(CONTAINER_ENGINE) run $(CPUSET) --network noobaa-net --name noobaa_$(GIT_COMMIT)_$(NAME_POSTFIX) --env "SUPPRESS_LOGS=$(SUPPRESS_LOGS)" --env "MONGODB_URL=mongodb://noobaa:noobaa@coretest-mongo-$(GIT_COMMIT)-$(NAME_POSTFIX)" --env "BLOB_HOST=blob-mock-$(GIT_COMMIT)-$(NAME_POSTFIX)" $(TESTER_TAG)
114+
$(CONTAINER_ENGINE) run $(CPUSET) --network noobaa-net --name noobaa_$(GIT_COMMIT)_$(NAME_POSTFIX) --env "SUPPRESS_LOGS=$(SUPPRESS_LOGS)" --env "DB_TYPE=mongodb" --env "MONGODB_URL=mongodb://noobaa:noobaa@coretest-mongo-$(GIT_COMMIT)-$(NAME_POSTFIX)" --env "BLOB_HOST=blob-mock-$(GIT_COMMIT)-$(NAME_POSTFIX)" $(TESTER_TAG)
115115
@$(call stop_noobaa)
116116
@$(call stop_blob_mock)
117117
@$(call stop_mongo)
@@ -123,7 +123,7 @@ root-perm-test: tester
123123
@$(call create_docker_network)
124124
@$(call run_mongo)
125125
@echo "\033[1;34mRunning root permission tests\033[0m"
126-
$(CONTAINER_ENGINE) run $(CPUSET) --network noobaa-net --privileged --user root --name noobaa_$(GIT_COMMIT)_$(NAME_POSTFIX) --env "SUPPRESS_LOGS=$(SUPPRESS_LOGS)" --env "MONGODB_URL=mongodb://noobaa:noobaa@coretest-mongo-$(GIT_COMMIT)-$(NAME_POSTFIX)" $(TESTER_TAG) ./src/test/unit_tests/run_npm_test_on_test_container.sh -s sudo_index.js
126+
$(CONTAINER_ENGINE) run $(CPUSET) --network noobaa-net --privileged --user root --name noobaa_$(GIT_COMMIT)_$(NAME_POSTFIX) --env "SUPPRESS_LOGS=$(SUPPRESS_LOGS)" --env "DB_TYPE=mongodb" --env "MONGODB_URL=mongodb://noobaa:noobaa@coretest-mongo-$(GIT_COMMIT)-$(NAME_POSTFIX)" $(TESTER_TAG) ./src/test/unit_tests/run_npm_test_on_test_container.sh -s sudo_index.js
127127
@$(call stop_noobaa)
128128
@$(call stop_mongo)
129129
@$(call remove_docker_network)
@@ -135,7 +135,7 @@ run-single-test: tester
135135
@$(call run_mongo)
136136
@$(call run_blob_mock)
137137
@echo "\033[1;34mRunning tests\033[0m"
138-
$(CONTAINER_ENGINE) run $(CPUSET) --network noobaa-net --name noobaa_$(GIT_COMMIT)_$(NAME_POSTFIX) --env "SUPPRESS_LOGS=$(SUPPRESS_LOGS)" --env "MONGODB_URL=mongodb://noobaa:noobaa@coretest-mongo-$(GIT_COMMIT)-$(NAME_POSTFIX)" --env "BLOB_HOST=blob-mock-$(GIT_COMMIT)-$(NAME_POSTFIX)" $(TESTER_TAG) ./src/test/unit_tests/run_npm_test_on_test_container.sh -s $(testname)
138+
$(CONTAINER_ENGINE) run $(CPUSET) --network noobaa-net --name noobaa_$(GIT_COMMIT)_$(NAME_POSTFIX) --env "SUPPRESS_LOGS=$(SUPPRESS_LOGS)" --env "DB_TYPE=mongodb" --env "MONGODB_URL=mongodb://noobaa:noobaa@coretest-mongo-$(GIT_COMMIT)-$(NAME_POSTFIX)" --env "BLOB_HOST=blob-mock-$(GIT_COMMIT)-$(NAME_POSTFIX)" $(TESTER_TAG) ./src/test/unit_tests/run_npm_test_on_test_container.sh -s $(testname)
139139
@$(call stop_noobaa)
140140
@$(call stop_blob_mock)
141141
@$(call stop_mongo)

config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// we populate the exports object but prefer to keep name referencing
55
// with config.NAME so that it will be consistent with the code that imports it
66
// and will make searching easier.
7-
var config = exports;
7+
const config = exports;
88

99
const os = require('os');
1010
const fs = require('fs');
@@ -401,7 +401,7 @@ config.LONG_DB_QUERY_THRESHOLD = parseInt(process.env.LONG_DB_QUERY_THRESHOLD, 1
401401
Central Stats Collection & Diagnostics
402402
*/
403403

404-
var is_windows = (process.platform === "win32");
404+
const is_windows = (process.platform === 'win32');
405405

406406
if (!is_windows) {
407407
process.env.ProgramData = '/tmp';
@@ -535,7 +535,7 @@ config.WORM_ENABLED = false;
535535
// Should we allow the creation of buckets on internal storage
536536
config.ALLOW_BUCKET_CREATE_ON_INTERNAL = true;
537537

538-
config.DB_TYPE = process.env.DB_TYPE || 'mongodb';
538+
config.DB_TYPE = /** @type {nb.DBType} */ (process.env.DB_TYPE || 'postgres');
539539

540540
////////////////////////////////
541541
// NAMESPACE MONITOR //

docs/standalone.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ git clone https://github.com/noobaa/noobaa-core
2727
cd noobaa-core
2828
npm install
2929
npm run build
30-
npm run pkg # optional create a single-executable build/noobaa-core
30+
# optional package everything into a single-executable at build/noobaa-core
31+
npm run pkg
3132
```
3233

3334
### 3. Quick test
@@ -107,6 +108,7 @@ config.IO_CALC_SHA256_ENABLED = false;
107108
108109
config.MAX_OBJECT_PART_SIZE = 1024 * 1024 * 1024;
109110
config.IO_CHUNK_READ_CACHE_SIZE = 4 * 1024 * 1024 * 1024;
111+
110112
config.CHUNK_SPLIT_AVG_CHUNK = 256 * 1024 * 1024;
111113
config.CHUNK_SPLIT_DELTA_CHUNK = 0;
112114
@@ -118,7 +120,7 @@ config.CHUNK_CODER_CIPHER_TYPE = 'none';
118120
config.CHUNK_CODER_REPLICAS = 1;
119121
config.CHUNK_CODER_EC_DATA_FRAGS = 2;
120122
config.CHUNK_CODER_EC_PARITY_FRAGS = 2;
121-
config.CHUNK_CODER_EC_PARITY_TYPE = 'isa-c1';
123+
config.CHUNK_CODER_EC_PARITY_TYPE = 'cm256';
122124
config.CHUNK_CODER_EC_TOLERANCE_THRESHOLD = 2;
123125
config.CHUNK_CODER_EC_IS_DEFAULT = true;
124126
@@ -173,6 +175,12 @@ POSTGRES_HOST=ip \
173175

174176
## STORAGE
175177

178+
### Create a pool
179+
180+
```sh
181+
npm run api -- pool_api create_hosts_pool '{ "name":"backingstores", "is_managed": false, "host_count": 9999 }'
182+
```
183+
176184
### Start backingstores
177185

178186
```sh
@@ -193,7 +201,7 @@ npm run api -- node aggregate_nodes '{}'
193201
### Check local storage
194202

195203
```sh
196-
du -sh storage/backingstores
204+
du -sh storage/backingstores/*
197205
find storage/backingstores -name '*.data' -type f -ls
198206
```
199207

@@ -204,51 +212,51 @@ find storage/backingstores -name '*.data' -type f -ls
204212
### Get access and secret keys
205213

206214
```sh
207-
export AWS_ACCESS_KEY_ID=$(npm run api -- account read_account '{}' --json | jq -r '.access_keys[0].access_key')
208-
export AWS_SECRET_ACCESS_KEY=$(npm run api -- account read_account '{}' --json | jq -r '.access_keys[0].secret_key')
215+
export AWS_ACCESS_KEY_ID=$(npm run api -- account read_account '{}' --json | tail -1 | jq -r '.access_keys[0].access_key')
216+
export AWS_SECRET_ACCESS_KEY=$(npm run api -- account read_account '{}' --json | tail -1 | jq -r '.access_keys[0].secret_key')
209217
```
210218

211-
### Listing
219+
### Create bucket
212220

213221
```sh
214-
node src/tools/s3cat --endpoint http://localhost:6001
215-
node src/tools/s3cat --endpoint http://localhost:6001 --bucket first.bucket --ls
216-
aws --endpoint http://localhost:6001 s3 ls
217-
aws --endpoint http://localhost:6001 s3 ls s3://first.bucket
222+
aws --endpoint http://localhost:6001 s3 mb s3://testbucket
218223
```
219224

220-
### Create bucket
225+
### Listing
221226

222227
```sh
223-
aws --endpoint http://localhost:6001 s3 mb s3://lala
228+
node src/tools/s3cat --endpoint http://localhost:6001
229+
node src/tools/s3cat --endpoint http://localhost:6001 --bucket testbucket --ls
230+
aws --endpoint http://localhost:6001 s3 ls
231+
aws --endpoint http://localhost:6001 s3 ls s3://testbucket
224232
```
225233

226234
### Read/Write
227235

228236
```sh
229-
node src/tools/s3cat --endpoint http://localhost:6001 --sig s3 --bucket first.bucket --put ggg --size 4096
230-
node src/tools/s3cat --endpoint http://localhost:6001 --sig s3 --bucket first.bucket --get ggg
231-
dd if=/dev/zero bs=1M count=1024 | aws --endpoint http://localhost:6001 s3 cp - s3://first.bucket/ggg
232-
aws --endpoint http://localhost:6001 s3 cp s3://first.bucket/ggg - | xxd -a
233-
aws --endpoint http://localhost:6001 s3 rm s3://first.bucket/ggg
237+
node src/tools/s3cat --endpoint http://localhost:6001 --sig s3 --bucket testbucket --put testobject --size 4096
238+
node src/tools/s3cat --endpoint http://localhost:6001 --sig s3 --bucket testbucket --get testobject
239+
dd if=/dev/zero bs=1M count=1024 | aws --endpoint http://localhost:6001 s3 cp - s3://testbucket/testobject
240+
aws --endpoint http://localhost:6001 s3 cp s3://testbucket/testobject - | xxd -a
241+
aws --endpoint http://localhost:6001 s3 rm s3://testbucket/testobject
234242
```
235243

236244
## Multipart uploads
237245

238246
```sh
239-
node src/tools/s3cat --endpoint http://localhost:6001 --sig s3 --bucket first.bucket --upload ggg --size 4096 --part_size 1024 --concur 4
247+
node src/tools/s3cat --endpoint http://localhost:6001 --sig s3 --bucket testbucket --upload testobject --size 4096 --part_size 1024 --concur 4
240248
```
241249

242250
### Perf tools
243251

244252
```sh
245-
node src/tools/s3perf --endpoint http://localhost:6001 --sig s3 --bucket first.bucket --put s3perf/ --concur 4 --size 128 --size_units MB --time 5
246-
node src/tools/s3perf --endpoint http://localhost:6001 --sig s3 --bucket first.bucket --get s3perf/ --concur 4 --size 128 --size_units MB --time 5
253+
node src/tools/s3perf --endpoint http://localhost:6001 --sig s3 --bucket testbucket --put s3perf/ --concur 4 --size 128 --size_units MB --time 5
254+
node src/tools/s3perf --endpoint http://localhost:6001 --sig s3 --bucket testbucket --get s3perf/ --concur 4 --size 128 --size_units MB --time 5
247255
```
248256

249257
### Using sigv4 for streaming requires https endpoint 6443 (selfsigned)
250258

251259
```sh
252-
node src/tools/s3cat --endpoint https://localhost:6443 --selfsigned --bucket first.bucket --put ggg --size 4096
253-
node src/tools/s3cat --endpoint https://localhost:6443 --selfsigned --bucket first.bucket --upload ggg --size 4096 --part_size 1024 --concur 4
260+
node src/tools/s3cat --endpoint https://localhost:6443 --selfsigned --bucket testbucket --put testobject --size 4096
261+
node src/tools/s3cat --endpoint https://localhost:6443 --selfsigned --bucket testbucket --upload testobject --size 4096 --part_size 1024 --concur 4
254262
```

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"cmd": "node --unhandled-rejections=warn src/cmd",
3131
"api": "node --unhandled-rejections=warn src/cmd api",
3232
"nsfs": "node --unhandled-rejections=warn src/cmd nsfs",
33-
"nscache": "node --unhandled-rejections=warn src/cmd nscache",
3433
"backingstore": "node --unhandled-rejections=warn src/cmd/backingstore",
3534
"-----": "----------------------------------------------------------------",
3635
"web": "node --unhandled-rejections=warn src/server/web_server",
@@ -41,8 +40,8 @@
4140
"agent": "node --unhandled-rejections=warn src/agent/agent_cli",
4241
"agents": "node --unhandled-rejections=warn src/agent/agent_cli --scale 10",
4342
"------": "---------------------------------------------------------------",
44-
"db": "postgres -D storage/postgres",
45-
"db:init": "initdb -D storage/postgres -E UTF-8 --locale=C",
43+
"db": "postgres -D ./storage/postgres",
44+
"db:init": "initdb -D ./storage/postgres -E UTF-8 --locale=C",
4645
"db:create": "npm run db:createuser && npm run db:createdb",
4746
"db:createuser": "createuser postgres && psql postgres -c 'ALTER USER postgres CREATEDB'",
4847
"db:createdb": "createdb -U postgres nbcore",
@@ -54,7 +53,7 @@
5453
"clean:build": "rm -rf ./build",
5554
"clean:test": "rm -rf ./coverage ./logs",
5655
"clean:garbage": "find . -name .DS_Store -print -delete",
57-
"clean:storage": "rm -rf ./storage/* ./noobaa_storage* ./agent_conf*.json"
56+
"clean:storage": "rm -rf ./storage"
5857
},
5958
"config": {
6059
"covdir": "coverage"

src/cmd/api.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
'use strict';
33

44
require('../util/dotenv').load();
5+
require('aws-sdk/lib/maintenance_mode_message').suppress = true;
56

67
const dbg = require('../util/debug_module')(__filename);
78
if (!dbg.get_process_name()) dbg.set_process_name('nsfs');
@@ -51,6 +52,7 @@ function print_usage() {
5152

5253
async function main(argv = minimist(process.argv.slice(2))) {
5354
try {
55+
dbg.original_console();
5456
if (argv.help || argv.h) return print_usage();
5557
if (argv.debug) {
5658
const debug_level = Number(argv.debug) || 5;

src/cmd/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
// load envs first
55
require('../util/dotenv').load();
6+
require('aws-sdk/lib/maintenance_mode_message').suppress = true;
67

78
// set the console output to raw
89
const dbg = require('../util/debug_module')(__filename);

src/cmd/nsfs.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
'use strict';
33

44
require('../util/dotenv').load();
5+
require('aws-sdk/lib/maintenance_mode_message').suppress = true;
56

67
const dbg = require('../util/debug_module')(__filename);
78
if (!dbg.get_process_name()) dbg.set_process_name('nsfs');
89
dbg.original_console();
910

1011
const config = require('../../config');
11-
config.NSFS_VERSIONING_ENABLED = true;
1212

1313
const fs = require('fs');
1414
const util = require('util');
1515
const minimist = require('minimist');
1616

17+
require('../server/system_services/system_store').get_instance({ standalone: true });
18+
1719
const nb_native = require('../util/nb_native');
1820
const ObjectSDK = require('../sdk/object_sdk');
1921
const NamespaceFS = require('../sdk/namespace_fs');
@@ -75,6 +77,9 @@ function print_usage() {
7577

7678
async function main(argv = minimist(process.argv.slice(2))) {
7779
try {
80+
config.DB_TYPE = 'none';
81+
config.NSFS_VERSIONING_ENABLED = true;
82+
7883
if (argv.help || argv.h) return print_usage();
7984
if (argv.debug) {
8085
const debug_level = Number(argv.debug) || 5;

src/deploy/NVA_build/noobaa_core.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ spec:
142142
- mountPath: /log
143143
name: logdir
144144
env:
145+
- name: DB_TYPE
146+
value: mongodb
145147
- name: CONTAINER_PLATFORM
146148
value: KUBERNETES
147149
- name: ENDPOINT_FORKS_NUMBER
@@ -247,6 +249,8 @@ spec:
247249
- containerPort: 6001
248250
- containerPort: 6443
249251
env:
252+
- name: DB_TYPE
253+
value: mongodb
250254
- name: JWT_SECRET
251255
valueFrom:
252256
secretKeyRef:

0 commit comments

Comments
 (0)