IBM Cloud and Database for MongoDB - mongodb

I'd like to know how to get the string connection of my MongoDB database to use with Mongoose, I was looking for and there are old info, and when I though I found a good documentation, well, it doesn't work(this is the link), the command doesn't exist, this is the comand [ ibmcloud cdb deployment-connections example-mongo -u admin
** ] specifically ***CDB*
I hope someone can help me please.

You can get the connection string to Databases for MongoDB using the ibmcloud cdb plugin but must be installed first. You can install it using the command:
ibmcloud plugin install cloud-databases
Then you can start using the cdb plugin. After that, you can get your MongoDB connection strings with:
ibmcloud cdb cxn <name of mongo deployment>
For the CA cert you'll need to connect, the plugin will decode it for you with:
ibmcloud cdb cacert <name of mongo deployment>
You'll also be able to change the admin password as well.
Or, you can go to your IBM Cloud dashboard, click on your Databases for MongoDB database, select "Service credentials" on the left panel of your MongoDB management panel, and then create some service credentials. This service credential will give you a username, password, the CA cert (encoded), and connection strings, as well.

Related

Can't create user for ceph dashboard

I'm trying to create a user for ceph dashboard with admin role. Version is Nautilus 14.2.19 and deployed with manuel installation.
I've installed dashboard module, installed all dependencies and enabled it. My dashboard is reachable from the monitor ip and default port of 8443.
When I run te command:
ceph dashboard ac-user-create <user> <pw> administrator
I get the following error:
Please specify the file containing the password/secret with "-i" option.
After digging for information about this it says there must be a file in bcrypt format. Is there a default created file for this? Or if it's needed to create one how can I do it?
Nevermind, it seems you just need to create a text file and write your password in it.
When you run the command like this:
ceph dashboard ac-user-create <user> -i /file/location administrator
It creates the user and applies the password in an encrypted format.

Unable to create repository on IBM Cloud

I'm able to login successfully with : ibmcloud cr login
but when i try to create a repository in the registry, i have the following error :
docker push registry.eu-gb.bluemix.net/fdutreg/ksrepo
The push refers to repository [registry.eu-gb.bluemix.net/fdutreg/ksrepo]
428c97da766c: Preparing
unauthorized: The login credentials are not valid, or your IBM Cloud account is not active.
Any idea ?
Replace registry.eu-gb.bluemix.net by registry.eu-de.bluemix.net and now this is ok.
2 years later but probably someone could be experimenting the same issue. The thing is that you are not authenticate to the registry. You can authenticate with an API key using:
docker login -u iamapikey -p apikey registry_url
For the apikey field you can create an apikey in Manage > IAM > APIkeys > Create an IBM Cloud API key in ibm.cloud.com
It is important to know that Using --password via the CLI is insecure. Use --password-stdin. You can find alternatives in https://cloud.ibm.com/docs/Registry?topic=Registry-registry_access
Log your local Docker daemon into the IBM Cloud Container Registry.run the following command:
ibmcloud cr login

Mattermost "An existing user is already attached to your gitlab account"

We use Mattermost using the 'Production Docker' setup as described in Mattermost documentation. For authentication, we federate using GitHub:Enterprise.
To setup our Mattermost team, I imported the whole Slack history. This lead to the problem that everyone who did not yet log into Mattermost via GitHub:Enterprise was not able to login. Mattermost helpfully returned the error message
"An existing user is already attached to your gitlab account"
How can I fix this issue without having to setup a new Mattermost instance and force everyone to login once before importing the Slack data?
Prerequisites
In order for this to work, you need
GitHub:Enterprise Administrator permissions
On the Mattermost machine, either root permissions or an account that is allowed to control docker, and, if psql is not installed, a way to install the psql command-line tool.
Steps
ssh into the Mattermost vm/machine (where the mattermost docker containers are running).
Change to an account with docker permissions (root; or the account you setup during Mattermost installation; or ... )
Use docker ps and note the hash of the container mattermostdocker_db. We will assume it starts with 5c23.
Run docker inspect 5c23 | grep IPAddress. Note the IP address of the container. We will assume it is 172.17.0.2.
Ensure that the psql commandline tool is installed on the machine where mattermost/docker is running.
On debian: apt-get install postgresql-client
Connect to the mattermost db of postgresql running inside the docker container:
psql -h 172.17.0.2 -p 5432 -d mattermost -U postgres -W
The (default?) password seems to be postgres.
Verify that a user account with the correct email exists. Assume the email of the account that has the problem is 'john#example.com`
mattermost-# select email, authdata from users where email = 'john#example.com';
Connect to GitHub:Enterprise and open the admin console. We will assume the local github enterprise instance is at https://github.example.com.
Click on the rocket symbol, or
https://github.example.com/stafftools
Click on all users and find the user that cannot login. We assume the github username is john, which would correspond to https://github.example.com/john
Visit the stafftools user security page for that user.
https://github.example.com/stafftools/users/john/security
Click on the 'Search logs' link under the 'Audit logs' header. This will open a page with a query field. On this page, you will find the internal github user number for that user. Note this number. We will assume the number is 37.
Back in the psql console, update the user entry with the correct number:
update users set authservice = 'gitlab', authdata = '37' where email = 'john#example.com' ;
Exit the psql console with \q:
mattermost-# \q
Done. The user can now log into Mattermost with GitHub:Enterprise user authentication.
Notes
Don't forget to complete each statement in psql with a ;
It's gitlab, not github, even if you use GitHub:Enterprise
Tested with Mattermost 3.0, GitHub:Enterprise 2.6.2

IBM Bluemix : Bulk load data into MongoDB

I have created a MongoDB service in Bluemix and I can successfully access it in an app deployed on Bluemix. I can create data in the MongoDB instance programmatically through my app, but what I I want to do is load data into MongoDB from my laptop.
I am not able to ping the MongoDB web address from my laptop, so I can not connect it from a standalone java program.
What is the way ahead to bulk load data into MongoDB on Bluemix ?
You can not connect to this experimental service from outside of Bluemix.
mongodb: You can not connect to this experimental service from outside of Bluemix. If you want to use your standalone java program to interact with this service on Bluemix, consider pushing your standalone java program as another application to Bluemix.
cf push mystandaloneapp -p standalone.jar --no-route
Then, bind the same mongodb instance to this application. When you restage the application, it should get the credentials in the VCAP_SERVICES environment variable.
mongolab: Assuming you created the mongolab service, from your Bluemix Dashboard, find and click on your MongoLab instance. From there, launch the MongoLab Dashboard. Click on your deployment (IbmCloud_***). You should see instructions on how to connect to mongo from shell, as well as import/export commands.
mongoimport -h ds049570.mongolab.com:49570 -d IbmCloud_ee4rm8hq_ecl23uf8 -c <collection> -u <user> -p <password> --file <input file>
You should also be able to connect to this from your java program.
Finally, check out the MongoDB by Compose service, which is an IBM provided MongoDB service, with a dashboard.

Install Chef Server 11 with AWS RDS

Now AWS has postgresql service in RDS, So I tried to install Chef Server 11 with postgresql RDS instance by editing attributes in /opt/chef-server/embedded/cookbooks/chef-server/attributes/default.rb
default['chef_server']['postgresql']['vip'] = "rds instance endpoint"
and importing database with the following command
/opt/chef-server/embedded/bin/psql -h "rds instance endpoint" -p 5432 -U "user_name" "database_name" < /opt/chef-server/embedded/service/erchef/lib/chef_db-f086a97/priv/pgsql_schema.sql
But i am not able to achieve that. chef-server-ctl reconfigure gives an error
curl -sf http:// 127.0.0.1:8000 /_status returned 7
Please help me to configure chef server with RDS instance.
I think i am able to solve my problem. It is because of encrypted password in erchef config file. I edited
"/opt/chef-server/embedded/cookbooks/chef-server/templates/default/echef.config.rb"
for the same and it seems working perfectly fine now.
Thanks
The chef-server-rds cookbook on github can be used to install Chef Server 11 with AWS RDS.
Given an iam key and secret, it will provision the rds instance if it doesn't exist in the account, initialize the chef schema, and install the appropriate platform-specific chef-server Omnibus package and perform the initial configuration of Chef Server on an AWS elastic compute ubuntu instance.
Using postgres on Amazon RDS offloads DB resource use away from the chef-server host. It also enables various DB functions like scaling, backup, and restore to be done independently of the chef-server installations. Similar configurations can be written for other db service providers.