Just came from an error on Symfony when trying to generate a new entity,
service doctrine is not found, [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "doctrine"
Further DB system is MongoDB and is configured in config.yml
doctrine_mongodb:
connections:
default:
server: mongodb://localhost:27017
options: {}
default_database: social
document_managers:
default:
auto_mapping: true
Related
First I created mongoDB database and made it live AWS. Then I'm creating mongoDB database to MongoDb BI connector locally.
And I created Configuration file which is mentioned below:
security:
enabled: true
defaultMechanism: default
defaultSource: admin
mongodb:
net:
uri: MongoUrl
auth:
username: MongoUser
password: MongoPass
net:
bindIp: localhost
port: 3307
ssl:
mode: "allowSSL"
PEMKeyFile: "/mongo.pem"
MongoDB BI connector
And my cubeJS env file is this:
CUBEJS_DEV_MODE=true
CUBEJS_DB_TYPE=mongobi
CUBEJS_API_SECRET=9c7a834d9be0cd2fb4e7b86a88a2bd1368ffbc614dcf8fa8f836933b00d00c6916fa83b074c66a2b26579266edc93e0e1990b1271f6214ee799dc08b05b6a097
CUBEJS_EXTERNAL_DEFAULT=true
CUBEJS_SCHEDULED_REFRESH_DEFAULT=true
CUBEJS_WEB_SOCKETS=true
CUBEJS_DB_HOST=localhost
CUBEJS_DB_NAME=MongoDbName
CUBEJS_DB_USER=mongoUserName
CUBEJS_DB_PASSWORD=MongoPassword
CUBEJS_DB_PORT=3307
CUBEJS_DEV_MODE=true
CUBEJS_REFRESH_WORKER=true
port=4242
CUBEJS_DB_SSL=true
#CUBEJS_DB_SSL_CA=<SSL_CA>
#CUBEJS_DB_SSL_CERT=<SSL_CERT>
#CUBEJS_DB_SSL_CIPHERS=<SSL_CIPHERS>
#CUBEJS_DB_SSL_PASSPHRASE=<SSL_PASSPHRASE>
CUBEJS_DB_SSL_REJECT_UNAUTHORIZED=false
and Error is showing this:
Access denied for user
C:\Users\dell 7470>"C:\Users\dell 7470\Desktop\sql\mysql-8.0.31-winx64\bin\mysql.exe" --enable-cleartext-plugin --protocol tcp --port 3307 --user=hikarsmarttag --ssl-key=C:\mongo.pem --ssl-cert=C:\certificate.pem -p
Enter password: *****************
ERROR 1045 (28000): Access denied for user 'hikarsmarttag'
Whenever I try to connect to BI tools MySQL-Client, The same Error is being thrown.
Access denied in mySQL-Client
How to correctly write to the config?
Information taken from here
https://altinity.com/blog/integrating-clickhouse-with-ldap-part-one
Operator
https://github.com/Altinity/clickhouse-operator
Unknown setting server: while parsing profile 'ldap' in users configuration file: while loading configuration file '/etc/clickhouse-server/users.xml'
settings:
# to allow scrape metrics via embedded prometheus protocol
prometheus/endpoint: /metrics
prometheus/port: 8888
prometheus/metrics: true
prometheus/events: true
prometheus/asynchronous_metrics: true
ldap_servers/ldap_test/host: host ldap
ldap_servers/ldap_test/port: 389
ldap_servers/ldap_test/bind_dn: DC=passport,DC=local
profiles:
ldap/server: ldap_test
Need help connecting to my Google SQL Postgres Database from Google App Engine. I've followed https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/google-app-engine.html but keep running into the following error:
2022-09-27 16:11:32 default[20220928t020816] [2022-09-27 16:11:32.307] debug: ⛔️ Server wasn't able to start properly.
2022-09-27 16:11:32 default[20220928t020816] [2022-09-27 16:11:32.309] error: connect ECONNREFUSED /cloudsql/project-id:us-central1:database-id/.s.PGSQL.5432
database.ts
export default ({ env }) => ({
connection: {
client: 'postgres',
connection: {
host: env('DATABASE_HOST', '127.0.0.1'),
port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'database-id'),
user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false),
},
},
});
app.yaml
runtime: nodejs16
instance_class: F1
env_variables:
ADMIN_JWT_SECRET: 'XXXXXXXXXXXXX'
API_TOKEN_SALT: 'XXXXXXXXXXXXX'
APP_KEYS: 'XXXXXXXXXXXXX'
DATABASE_HOST: '/cloudsql/project-id:us-central1:database-id'
DATABASE_PORT: '5432'
DATABASE_NAME: 'database-id'
DATABASE_USERNAME: 'postgres'
DATABASE_PASSWORD: 'XXXXXXXXXXXXX'
DATABASE_SSL: 'false'
HOST: '0.0.0.0'
JWT_SECRET: 'XXXXXXXXXXXXX'
NODE_ENV: 'production'
PORT: '1337'
beta_settings:
cloud_sql_instances: 'project-id:us-central1:database-id'
One of the causes of error: connect ECONNREFUSED and the most common one when connecting to Cloud SQL using Unix Sockets (as is the case here) is that your GCP project does not have the Cloud SQL Admin API enabled.
Enable the Cloud SQL Admin API and that should help resolve the connectivity issue.
Can a sails.js database connection be configured using a URI, or a URL which incorporates the credentials (host, user, password, and database) into one string? Or do they need to be individually assigned as their own key-value pairs in the configuration?
In development, I have configured my sails.js app to use environment variables for database credentials, as such:
in connections.js:
someSqlDatabase: {
host: process.env.dbHost,
user: process.env.dbUserName,
password: process.env.dbPassword,
database: process.env.db,
port: 5432,
ssl: true,
adapter: 'sails-postgresql'
This works for my connection to a heroku-postgresql resource that I've allocated to my project, and I am able to manually set "Config Vars" in my heroku instance, which I can use in the same way as environment variables in my local instance. By this I mean I can go to the heroku client page for the database resource, copy its credentials (host, database, user, and password) into the heroku app's configuration variables, individually.
The problem is that heroku periodically changes the credentials, and that my manually-copied configuration variables will become outdated, and require re-pasting whenever this happens. Obviously, this is not an ideal solution.
Heroku does automatically provide one configuration variable for the resource, called DATABASE_URL, which looks like:
"postgres://<user>:<password>#<host>:<port>/<database>"
which should be automatically updated, when the credentials change.
My problem is that I don't know how to configure a sails.js connection to use this url, in the place of individual "host", "user", "password", and "database" key/value pairs in the the connection config.
I've tried using a configuration that omits the individual keys and uses only "host", as such:
someSqlDatabase: {
host: process.env.DATABASE_URL,
ssl: true,
adapter: 'sails-postgresql'
}
But this connection fails. I've seen this kind of string called a URI, and I've tried the long-shot configuration:
someSqlDatabase: {
uri: proccess.env.DATABASE_URL
ssl: true,
adapter: 'sails-postgresql'
}
but this fails, as well. Is there a way to configure a sails-js connection with heroku postgresql database that will automatically use the latest credentials? (I am using sails v0.12.3)
I am not using PostgreSQL, but you could try/adapt this:
// before/outside module.exports
var url = require('url').parse(process.env.DATABASE_URL);
// within the config
someSqlDatabase: {
host: url.host,
user: url.auth.split(':')[0],
password: url.auth.split(':')[1],
database: url.pathname.substring(1),
port: url.port,
ssl: true,
adapter: 'sails-postgresql'
}
The following is probably the correct way to do this :
module.exports = {
...
default: {
ssl: true,
url: process.env.HEROKU_POSTGRESQL_SILVER_URL,
adapter: 'sails-postgresql'
},
...
}
inside config/env/production.js
I'm currently working on a project where I use mongodb as database, and I began with no security in my mongo configuration of the symfony config.yml.
This is what my config.yml looked like since the beginning of the project.
doctrine_mongodb:
connections:
default:
server: mongodb://localhost:27017
options: {}
default_database: louisv
document_managers:
default:
auto_mapping: true
With this parameters the project works very well.
But I want to add security to mongodb database. So I tried to follow documentation on mongodb to create users. I created an "admin" user for the admin database, and a "louisv" user for the louisv database (the admin database is the database existing by default, and louisv is mine).
Now I want to Symfony to use this new user. I changed my the option parameters from my conf.yml file and now this is what I have :
doctrine_mongodb:
connections:
default:
server: mongodb://localhost:27017
options:
username: louisv
password: password
default_database: louisv
document_managers:
default:
auto_mapping: true
Now when I try to enter my application in Symfony
Failed to connect to: localhost:27017: Authentication failed on database 'admin' with username 'louisv': auth fails
Which is weird cause my default_database is "louisv' and not 'admin'.
And if I change the credentials to admin's ones, I have another error:
localhost:27017: not authorized for query on louisv.User
Which seems quite good as it seems to search for users, but I can't do queries.
Instead of:
server: mongodb://localhost:27017
The following should do the trick:
server: mongodb://localhost:27017/louisv
Apparently, the Doctrine ODM bundle also has a "db" option now, so you now have the following options:
connections:
default:
server: mongodb://louisv:password#localhost:27017/louisv
or
connections:
default:
server: mongodb://localhost:27017
options:
username: louisv
password: password
db: louisv
The first option is preferred, as it allows for automatic re-authentication in case a connection drops.
See also:
https://github.com/doctrine/DoctrineMongoDBBundle/issues/154
In addition to #derick's answer, my configuration was still trying to connect to the "default" database - adding the default_database entry solved this.
connections:
default:
server: "mongodb://myuser:password#mydbserver:27017/mydb"
default_database: mydb
Remember to keep usernames and passwords in a "parameters" file separate from the config file if stored in source control :)