Managing Environment variables ejabberd server - xmpp

Is there any way to manage multiple environment variables (dev/stage/production) from single ejabberd server.
Specifically different database for each environment. e.g
development
-----------
db : devdb
user : user
pass : pass
stage
-----
db : stagedb
user : user
pass : pass
production
----------
db : proddb
user : user
pass : pass
Ubuntu 16.04 Ejabberd 17.xx Database : mysql client :
react-native(android/ios)

If I understand correctly, you have configured in ejabberd several vhosts, and you want to use a different SQL database for each one. For defining each database in ejabberd.yml, you can use the host_config option, see https://docs.ejabberd.im/admin/configuration/#virtual-hosting

Related

DB2 Connection String in IBM iSeries/AS 400

I tried searching in the internet for the right connection string for this DB2. Just wanted to know if anyone is familiar with this. Below are the details of the database I want to connect to.
Driver : DB2 iSeries/AS 400
JDBC URL : jdbc:as400://eagle1.eaglegl.com/EAFEDPRDDF/
Host : eagle1.eaglegl.com/EAFEDPRDDF/
Username : *****
Password : *****
Thank you.
Your problem may perhaps be that you do not have a DB2 on i OLE DB driver installed.
Depending on which of the two 'standard' IBM i clients your organisation uses, have a look at either:
IBM i Access for Windows: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/rzaik/rzaikoledbprovider.htm
(you'll need to change version to the correct one for your system)
or:
IBM i Access Client Solutions :
http://www-01.ibm.com/support/docview.wss?uid=nas8N1022156
P.S. the 'as400' moniker is specifically for jdbc connections using the IBM i Java Toolbox.

wolkenkit: DATABASE access & backup

I just cloned wolkenkit-todomvc from repo. I tried to execute it with "wolkenkit start" then
docker exec -it todomvc-mongodb mongo admin
show dbs
and got
{
"operationTime" : Timestamp(1514838628, 1),
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }",
"code" : 13,
"codeName" : "Unauthorized"
}
My questions are
What is the user and password for access these container's database?
how do I access Mongodb and Postgres data from docker container?. such as
db.todos.find()
SELECT * FROM todos
To execute wolkenkit-todomvc you first need to install wolkenkit. The concrete steps depend on your platform. Refer to installing wolkenkit on macOS, installing wolkenkit on Linux, or installing wolkenkit on Windows.
Then run the application by running the following command, as described in the quick start:
$ wolkenkit start
If you want to access the database explicitly, as I assume from reading your question, e.g. to create a backup, you need to use the wolkenkit user. The password is the so-called "shared key", which is shown when running wolkenkit start. If you want to, you can also set the shared key manually, otherwise it is created randomly.
Please note that there are two databases, as you can see from the architecture of wolkenkit, one using PostgreSQL to store the events, one using MongoDB to store the denormalized lists. In the events database, there is only one large table for all the events. This is the raw data. If you are interested in the interpreted views, take a look at the MongoDB.
If you want to create a backup, backup the event store, as this is the single source of truth. The read database can be rebuilt from the event store, but not vice-versa.
Hope this helps.
PS: Please note that I am one of the authors of wolkenkit.

PostgreSQL + IntelliJ : FATAL : role xxx doesn't exist

I am able to connect with psql and do what I want, not in IntelliJ.
PostgreSQL version : postgres (PostgreSQL) 9.6.1
IntelliJ version : 2016.3.1
IntelliJ configuration :
URL : jdbc:postgresql://localhost:5432/sample
User : sample
Pwd : sample
Test connection : Successful
So, I connect (red square appears) and then try a simple query :
select 1;
And I got the error :
FATAL : role 'xxx' doesn't exist`
Why IntelliJ doesn't use the role specified in my configuration and want to use my personal login ?? Whatever I use as role, still got the same error.
Note: If I add my system username as role it works, but I would prefer to avoid that.
Adding the LOGIN role attribute fix the problem :
ALTER ROLE sample LOGIN
The documenation states :
Only roles that have the LOGIN attribute can be used as the initial
role name for a database connection
However, I could connect in CLI and do what I want, as I could "connect" in IntelliJ but not do query, without this attribute. More details about this behaviour are welcome.

Error 13 when trying to authenticate to MongoDB

I'm trying to connect to MongoDB through JDBC. The connection string is like below,
mongodb://localhost:27017/games?authSource=admin
However I'm getting the following trace:
{ "ok" : 0.0, "errmsg" : "not authorized on admin to execute command { listDatabases: 1 }", "code" : 13 }
My intention is not listing all the databases, but the user has to authenticate against admin database and can read/write on games database. What mistake I'm making here?
I want user X to authenticate against admin DB but read just games DB so not sure why it asks for listDatabase privilege.
First, I assume you are using the MongoDB Java Driver, which is actually not JDBC.
It would be helpful for you to share:
How you created your user
The Java code that you are executing
The version of mongo-java-driver and MongoDB that you are using
But based on the error, it appears that you are successfully authenticating. I strongly suspect that you are either directly calling listDatabases() or listDatabaseNames().
The other thing that does not look quite right is the fact that you are specifying authSource=admin in your MongoClientURI. But that issue should have given you an Autentication Failed error. You should be either leaving the authSource off of the connection string or specify authSource=games.
Based on what you described, when you created your user, you should have created the user in the games database (users will actually be stored in the admin database, but you would be authenticating against the games database).

Moving ejabberd default DB to MySQL shows authentication failure

I am trying to setup an ejabberd server on my Amazon EC2 Ubuntu instance.
With the default DB Provided by ejabberd, I can easily setup my connection. But I need to replace the mnesia DB with MySQL. I found some tutorials over the internet. From those tutorial I found out a solution. I will explain it as step by step.
I am using ejabberd 2.1.11. I made the following changes on ejabberd.cfg file
Commented the following line :
{auth_method, internal}
Uncommented this:
{auth_method, odbc}
Configured my MySQL DB
{odbc_server, {mysql, "localhost", "students", "root", ""}} // No Password set
Change mod_last to mod_last_odbc
Change mod_offline to mod_offline_odbc
Change mod_roster to mod_roster_odbc
Change mod_private to mod_private_odbc
Change mod_privacy to mod_privacy_odbc
Change mod_pubsub to mod_pubsub_odbc
Change mod_vcard to mod_vcard_odbc
Then I installed ejabberd-mysql driver from the following link
http://stefan-strigler.de/2009/01/14/ejabberd-mysql-drivers-for-debian-and-ubuntu/
After making all these changes I restarted my ejabberd server.
Then I tried to login to my ejabberd server. It shows me the login prompt.
After entering the credentials it takes a lot time and then displays authentication failed.
Any help on the topic is appreciated.
Let's dig into problem
Your setup is working that means your config file is fine. But then
Why does auth fails ?
What schema you have in your students database ?
If you have a proper schema installed then does the user present in ur db's users table?
Have you also updated conf/odbc.ini with proper mysql details.
Even if both the conditions meet then I'll advice you to set mysql password and try again.
Let me know if that helps or not.
Update :-
update your config with {loglevel, 5}
then hit the login and tail all the log files.
odbc.ini
1 [ejabberd]
2 Driver = MySQL
3 DATABASE = students
4 PWD =
5 SERVER = localhost
6 SOCKET = /tmp/mysql.sock
7 UID = root
One Major basic part that one can easily miss is that data which was previously stored in mnesia database will no longer will be available for your new configuration so again you have to create one admin user like this to access your admin account.
./ejabberdctl register admin "password"