DB change for Pritunl

Hi
I’m trying to redeploy my instance of pritunl VPN but can’t get new server to connect to new DB, getting error: No default database name defined or provided

More Info
I have a working setup with an Ubuntu VM in GCP connecting to a Mongo cloud DB. I was required to perform a DR test so I have re-deployed the server from backup and also re-deployed the DB from backup. I’ve then updated /etc/pritunl.conf to use the URI of the new DB but it will not work. the /var/log/pritunl.log contains

    raise ConfigurationError("No default database name defined or provided.")
pymongo.errors.ConfigurationError: No default database name defined or provided.

I’ve connected directly to the DB using the Mongo shell tools on the server so I know I have access. The server has even updated the old/live database (by mistake before i updated conf file ) as my existing system shows name of new server (not great but still works). I just can’t get new server to talk to new DB. pritunl.conf file has:
"mongodb_uri": "mongodb+srv://USER:PASSWORD@DB-CLUSTER.crtdx.mongodb.net/?retryWrites=true&w=majority",

Any suggestions anyone?
Mike

There should be a database name as the first path component in the URI mongodb+srv://USER:PASSWORD@DB-CLUSTER.crtdx.mongodb.net/pritunl?retryWrites=true&w=majority. Until the next release with the new pymongo 4.0 library you may also need to use the legacy URI that includes each host.

Hi
thanks for the response, so I got the legacy URI from Mongo cloud and updated the pritunl.conf file. it’s now pretty much the same as my live working system but with different DB-CLUSTER-NAME but it still get same error after restarting pritunl service. :frowning:

"mongodb_uri": "mongodb://USER:PASSWORD@DB-CLUSTER-NAME-shard-00-00.crtdx.mongodb.net:27017,DB-CLUSTER-NAME-shard-00-01.crtdx.mongodb.net:27017,DB-CLUSTER-NAME-shard-00-02.crtdx.mongodb.net:27017/?ssl=true&replicaSet=atlas-XXX-shard-0&authSource=admin&retryWrites=true&w=majority",

logs still show

  File "/usr/lib/pritunl/usr/lib/python3.9/site-packages/pymongo/mongo_client.py", line 2247, in get_default_database
    raise ConfigurationError("No default database name defined or provided.")
pymongo.errors.ConfigurationError: No default database name defined or provided.
[local][2024-08-13 21:10:21,618][INFO] Stopping server

any more advice?
Thanks

That URI is still missing the database name use mongodb://USER:PASSWORD@DB-CLUSTER-NAME-shard-00-00.crtdx.mongodb.net:27017,DB-CLUSTER-NAME-shard-00-01.crtdx.mongodb.net:27017,DB-CLUSTER-NAME-shard-00-02.crtdx.mongodb.net:27017/pritunl?ssl=true&replicaSet=atlas-XXX-shard-0&authSource=admin&retryWrites=true&w=majority