IBMCloud - How can I connect to MongoDB? - mongoid

I'm trying to connect to MongoDB in a IBMCloud instance and I'm using MongoID. I ever use some configurations and try very things. I'm getting the error:
MONGODB | Error running ismaster on address:port: system lib
Here is my mongoid.yml that I'm trying to connect to mongoDB:
development:
clients:
default:
database: databasename
hosts:
- address:port
- address:port
options:
user: 'admin'
password: 'some-password'
auth_mech: :scram
auth_source: admin
connect: :replica_set
replica_set: replset
ssl: true
ssl_ca_cert: ./some-certificate.pem
ssl_verify: true
options:
log_level: :debug
What do I need to add to connect with the mongo database in IBMCloud?

"system lib" is coming from OpenSSL and indicates a problem with the CA certificate, such as the path not referring to an existing file. Note that in the configuration you specified a relative path which could cause problems.
I created https://jira.mongodb.org/browse/RUBY-1946 to add the exception class to the reported message which would clarify where the error is originating in the future.
Upgrade to the current version of Ruby driver (2.10.2 as of this writing) which provides more extensive diagnostics. Set driver log level to debug (https://docs.mongodb.com/mongoid/master/tutorials/mongoid-configuration/#logging). If you are having trouble identifying the problem then, post the
updated error and log messages here.

Related

PDO Driver not found when execute command

I am facing a problem with my database. Context: Web application referencing members, where it is possible to import members via an xls file repository, a processing is done to save it in database. I try to execute a command that is supposed to run in the background on the production environment, but on the development environment it must be executed manually, to perform the import of the files that have as states "to import". Problem during the execution, the command displays that there are driver problems with PDO, it can't find them.
Any idea where the problem could come from?
You will find here with the detailed errors, as well as the config.yml of the symfony 5 project
In AbstractMySQLDriver.php line 128:
An exception occurred in driver: could not find driver
In Exception.php line 18:
could not find driver
In PDOConnection.php line 40:
could not find driver
doctrine:
dbal:
driver: pdo_mysql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
types:
phone_number: Misd\PhoneNumberBundle\Doctrine\DBAL\Types\PhoneNumberType
server_version: "%doctrine_server_version%"
options:
1002: 'SET sql_mode=(SELECT REPLACE(##sql_mode, "ONLY_FULL_GROUP_BY", ""))'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
dql:
string_functions:
MONTH: DoctrineExtensions\Query\Mysql\Month
YEAR: DoctrineExtensions\Query\Mysql\Year
regexp: DoctrineExtensions\Query\Mysql\Regexp
replace: DoctrineExtensions\Query\Mysql\Replace
DATE_FORMAT: DoctrineExtensions\Query\Mysql\DateFormat
mappings:
gedmo_tree:
type: annotation
prefix: Gedmo\Tree\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
alias: GedmoTree # (optional) it will default to the name set for the mapping
is_bundle: false
Check if your DATABASE_URL host is correct on your .env file.
You should have something like DATABASE_URL=mysql://dbuser:dbpassword#127.0.0.1:3306/something
If it's correctly setup, check your local installation (usually with sudo apt-get install pdo-mysql)
Also check your php.ini file if extension=pdo_mysql is not commented.
I'm confused I found where my mistake came from. The configuration files were set up correctly but I hadn't run bash before running the command, so it didn't recognize the locally binded augments. Really sorry for this question ... very stupid
The problem here comes from you env file. Make sure you wrote the correct database information there:
DATABASE_URL="mysql://db_user:db_password#127.0.0.1:3306/db_name?serverVersion=5.7"
Also, make sure that you did create your database correctly and you can find here in your database.

cURL error 60: SSL: no alternative certificate subject name matches target host name. Inter-project communication

So I'm still in the process of updating a Drupal 7 site to 8 using drush and ddev.
After running the import, I get an error with upgrade_d7_file.
I've tried to install a certificate using this article:
https://www.ddev.com/ddev-local/ddev-local-trusted-https-certificates/
However still get the error, any ideas?
ddev exec drush migrate-import --all
ddev exec drush mmsg upgrade_d7_file
cURL error 60: SSL: no alternative certificate subject name matches target host name
'drupal7migration2.ddev.site'
(see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
(https://drupal7migration2.ddev.site//sites/default/files/Virtual%20Challenges%20%28Results%20and%2
0PBs%29%2020200709.xlsx)
When you want one DDEV-Local project to talk to another using https, curl on the client side has to trust the server side that you're talking to. There are two ways to do this:
(built-in, no changes needed): Use ddev-<projectname>-web (the container name) as the target hostname in the URL. For example in your case, use curl https://ddev-drupal7migration2-web. This hostname is already trusted among various ddev projects.
(requires docker-compose.*.yaml): If you want to use the real full FQDN of the target project (https://drupal7migration2.ddev.site in your case) then you'll need to add that as an external_link in the client project's .ddev. So add a file named .ddev/docker-compose.external_links.yaml in the client side (migration1?) project, with these contents:
version: '3.6'
services:
web:
external_links:
- "ddev-router:drupal7migration2.ddev.site"
That will tell Docker to route requests to "drupal7migration2.ddev.site" to the ddev-router, and your container and curl trust it (it has that name in its cert list).

Failed to connect to Database - Setting up GCP app engine

I'm trying to setup an instance on my phoenix app. I'm actually able to generate the app but I'm getting an error when trying to connect to the DB:
ERROR:
21:11:31.017 [error] Postgrex.Protocol (#PID<0.2223.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (/tmp/cloudsql/statcasters:us-central1:statcastersdb): no such file or directory - :enoent
I'm not sure what is wrong? The file seems to exist but it seems to say it doesn't:
prod.secret.exs:
config :statcasters, Statcasters.Repo,
username: "postgres",
password: System.get_env("DATABASE_PASSWORD"),
database: "statcasters_prod",
socket: "/tmp/cloudsql/statcasters:us-central1:statcastersdb",
pool_size: 20
I'm not sure what more information I can give? Does anybody know what I could be missing here?
There are 2 flavors of App Engine so please see the instructions linked here: https://cloud.google.com/sql/docs/postgres/connect-app-engine
The socket name appears to include a redundant "/tmp" prefix and should start with "/cloudsql/..." for App Engine standard.

Connecting Phoenix app to MS SQL Azure database

I am trying to connect a phoenix application to MS SQL. After looking around online I came across a couple of adapters called mssql_ecto & mssqlex.
I have added them to the project following the instructions in the readme, installed odbc and checked that the db is online but I am now getting the following error..
[error] Mssqlex.Protocol (#PID<0.13069.0>) failed to connect: ** (Mssqlex.Error) odbc_not_started
My app is configured as below..
config :my_app, MyApp.Repo,
adapter: MssqlEcto,
username: "<my_username>",
password: "<my_password>",
database: "test",
hostname: "<my_server>.database.windows.net",
pool_size: 10
My environment is as follows..
MacOS Sierra 10.12.5
Elixir version: 1.4.4
There is an issue in the mssql_ecto repo already, and I have tried the suggestions from there, but it still has not worked.
If anyone has managed to connect their phoenix/elixir application to MSSQL on macOS and could provide some instructions it would be greatly appreciated (even if it was done in a completely different way to my approach 😉 ).
Side note: Tried it in node with the same db and was able to connect to and query the db.
I've been working through the same issue this week, connecting to an Azure SQL Database, and this is what I've got working.
You are seeing the first of 2 main problems I ran into:
Erlang installed without ODBC
Mssqlex adapter is missing required configuration options
#1: Erlang installed without ODBC
If you've installed Elixir and Erlang using brew, or something like it, you are getting an installation of Erlang that does not include erlang-odbc. In order to remedy this, you will need to install Erlang from source.
I recommend that you install both Erlang and Elixir from source using the method documented here:
http://www.lambdacat.com/how-to-install-elixir-on-mac/
Just make sure that you remove the Kerl option, --without-odbc, before you build Erlang.
Now that you have Erlang installed correctly, the odbc_not_started error should go away... to be replaced by connection errors to the database.
#2: Mssqlex adapter is missing required configuration options
As of this moment, the mssqlex adapter does not support the following configuration options that Azure is looking for:
Encrypt
TrustServerCertificate
Connection Timeout
To get around this issue, I forked the mssqlex library and added those options in a branch. I am not committing to maintaining this so feel free to fork it yourself.
In order to use the modified mssqlex, replace the mix dependency with the github location and branch name:
{:mssqlex, git: "https://github.com/tvanhouten/mssqlex.git", branch: "azure-settings", override: true}
The override: true is important because mssql_ecto has a dependency on the mssqlex version in hex.
Now you can update your configuration:
config :my_app, MyApp.Repo,
adapter: MssqlEcto,
username: "<my_username>",
password: "<my_password>",
database: "test",
hostname: "<my_server>.database.windows.net",
pool_size: 10,
encrypt: "yes",
trust_server_certificate: "no",
connection_timeout: "30
Other "Gotchas" to Look Out For
Azure requires TCP connection:
In order to connect to an Azure SQL Database, you will need to make sure that the hostname: option starts with tcp:. So, all together, it will look like
hostname: "tcp:.database.windows.net"
Mssql_ecto does not support Ecto 2.2+:
If you're getting errors related to Ecto or Ecto.SubQuery, you probably need to make sure that you are using a version of Ecto that is supported by mssql_ecto. At this point in time, that means Ecto 2.1.x. Again, this requires a slight change to your mix dependencies:
{:ecto, ">= 2.1.0 and < 2.2.0"}
Dependency cache and lock issues:
If everything seems to be in order according to the above but it just doesn't seem like the new dependencies are being updated and compiled as expected, do the following:
Run mix deps.clean --all
Delete the mix.lock file from your root project directory
Run mix deps.get
Run mix deps.compile
That should do it!

AMQ119099: Unable to authenticate cluster user: ACTIVEMQ.CLUSTER.ADMIN.USER

When I was starting Wildfly 10 with full-ha profile, I was getting below error in the log file.
AMQ119099: Unable to authenticate cluster user: ACTIVEMQ.CLUSTER.ADMIN.USER
Even after this error, server was in running state.
I was getting this error because I have not changed the default password of subsystem messaging-activemq.
This error is gone after changing below line of domain.xml
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
to
<cluster password="${jboss.messaging.cluster.password:mypass}"/>
It's required to specify a password for the cluster of messaging-activemq subsystem. It can be set using the following system property when starting the wildfly server:
... -Djboss.messaging.cluster.password=Abcd1234

Resources