meteor-up
meteor-up copied to clipboard
how to create mongo authentication ?
Hi, I'm trying to create mongo authentication with mup js.
Mup version (mup 1.5.10):
Mup config
module.exports = {
servers: {
one: {
host: '192.168.0.220',
username: 'root',
password: 'root',
},
},
app: {
// TODO: change app name and path
name: 'myApp',
path: '../',
servers: {
one: {},
},
env: {
ROOT_URL: 'http://192.168.0.220:4120',
MONGO_URL:
'mongodb://root:[email protected]:27018/dbName?authSource=admin',
PORT: 4120,
},
docker: {
image: 'zodern/meteor:root',
prepareBundle: true,
useBuildKit: true,
},
deployCheckWaitTime: 120,
enableUploadProgressBar: true,
},
mongo: {
version: '5.0.5',
oplog: true,
port: 27015,
servers: {
one: {},
},
auth: {
database: 'admin',
username: 'root',
password: 'root',
},
},
}
After run :
mup setup --config=mup-local-mongo-auth.js
got error :
2 Validation Errors
- "mongo.auth" is an unknown property
- "mongo" It looks like app.env.MONGO_URL is for an external database. Remove the `mongo` object to use external databases.
Read the docs and view example configs at
http://meteor-up.com/docs
Started TaskList: Setup Docker
[192.168.0.220] - Setup Docker
[192.168.0.220] - Setup Docker: SUCCESS
Started TaskList: Setup Meteor
[192.168.0.220] - Setup Environment
[192.168.0.220] - Setup Environment: SUCCESS
Started TaskList: Setup Mongo
[192.168.0.220] - Setup Environment
[192.168.0.220] - Setup Environment: SUCCESS
[192.168.0.220] - Copying Mongo Config
[192.168.0.220] - Copying Mongo Config: SUCCESS
Started TaskList: Start Mongo
[192.168.0.220] - Start Mongo
[192.168.0.220] x Start Mongo: FAILED
------------------------------------STDERR------------------------------------
n":13},"isInternalClient":true}}}
{"t":{"$date":"2023-06-27T06:13:36.172+00:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2023-06-27T06:13:36.172+00:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"thread1","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2023-06-27T06:13:36.173+00:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2023-06-27T06:13:36.173+00:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2023-06-27T06:13:36.173+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
{"t":{"$date":"2023-06-27T06:13:36.173+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2023-06-27T06:13:36.173+00:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}
{"t":{"$date":"2023-06-27T06:13:36.173+00:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":1,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"mongodb"}}
{"t":{"$date":"2023-06-27T06:13:36.173+00:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.5","gitVersion":"d65fd89df3fc039b5c55933c0f71d647a54510ae","openSSLVersion":"OpenSSL 1.1.1f 31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2023-06-27T06:13:36.173+00:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}
{"t":{"$date":"2023-06-27T06:13:36.173+00:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/mongodb.conf","net":{"bindIp":"*"},"replication":{"replSet":"meteor"},"storage":{"dbPath":"/data/db"}}}}
{"t":{"$date":"2023-06-27T06:13:36.174+00:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/data/db","storageEngine":"wiredTiger"}}
{"t":{"$date":"2023-06-27T06:13:36.174+00:00"},"s":"I", "c":"STORAGE", "id":22297, "ctx":"initandlisten","msg":"Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem","tags":["startupWarnings"]}
{"t":{"$date":"2023-06-27T06:13:36.175+00:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=5413M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),builtin_extension_config=(zstd=(compression_level=6)),file_manager=(close_idle_time=600,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
{"t":{"$date":"2023-06-27T06:13:36.702+00:00"},"s":"F", "c":"STORAGE", "id":4671205, "ctx":"initandlisten","msg":"This version of MongoDB is too recent to start up on the existing data files. Try MongoDB 4.2 or earlier."}
{"t":{"$date":"2023-06-27T06:13:36.702+00:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":4671205,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":653}}
{"t":{"$date":"2023-06-27T06:13:36.702+00:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
------------------------------------STDOUT------------------------------------
Different start script
5.0.5: Pulling from library/mongo
Digest: sha256:079089900e9511a782a59a4276046835189720eb668088869d147d1145cebe14
Status: Image is up to date for mongo:5.0.5
docker.io/library/mongo:5.0.5
mongodb
2023-06-27T06:13:12.868+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
killing process with pid: 1
mongodb
Running mongo:5.0.5
1c0468370731cea6c1b904a9dc2d6e5c3f449447aba1b1a50fb4abdce4752fb5
Creating replica set
OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown
OCI runtime exec failed: exec failed: unable to start container process: error writing config to pipe: write init-p: broken pipe: unknown
OCI runtime exec failed: exec failed: unable to start container process: error writing config to pipe: write init-p: broken pipe: unknown
MongoDB shell version v5.0.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1
MongoDB shell version v5.0.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1
MongoDB shell version v5.0.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1
MongoDB shell version v5.0.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1
------------------------------------------------------------------------------
The mup mongo plugin does not have this feature. To implement it, first run mup setup. If your project is running, stop it (mup stop). Connect to your MongoDB and create a user. Then, connect to your machine using mup ssh and execute the following commands in sequence:
docker stop mongodbopenssl rand -base64 756 > /var/lib/mongodb/keyfilesudo chmod 400 /var/lib/mongodb/keyfilecd /opt/mongodb- Open the
./mongodb.conffile usingnanoand update it as follows:
# mongodb.conf
storage:
dbPath: /data/db
replication:
replSetName: meteor
security:
authorization: enabled
keyFile: /data/db/keyfile
docker start mongodbmongosh "mongodb://adminUser:[email protected]:27017/test?authSource=admin"
The above settings are valid for default definitions. If you change dbName, dataPath, you need to update it accordingly.