I wonder if Thingsboard can work with MySQL?
I tried to modify the PostgreSQL DAO Configuration in thingsboard.yml file, but it doesnt work. The installation fail.
spring:
data:
jpa:
repositories:
enabled: "true"
jpa:
hibernate:
ddl-auto: "validate"
database-platform: "${SPRING_JPA_DATABASE_PLATFORM:org.hibernate.dialect.MySQLDialect}"
datasource:
driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.mysql.jdbc.Driver}"
url: "${SPRING_DATASOURCE_URL:jdbc:mysql://localhost/thingsboard}"
username: "${SPRING_DATASOURCE_USERNAME:root}"
password: "${SPRING_DATASOURCE_PASSWORD:pw}"
make changes in thingsboard.yml 'DAO Configuration' section (maybe you need to add mysql port also).
review schema.sql and system-data.sql scripts to support MySQL dialect.
this pull request : https://github.com/thingsboard/thingsboard/pull/904
can helps
${SPRING_DRIVER_CLASS_NAME:org.mysql.jdbc.Driver} mean answer = SPRING_DRIVER_CLASS_NAME!=null ? SPRING_DRIVER_CLASS_NAME : org.mysql.jdbc.Driver
MySQL is currently not supported. We use hierarchical queries (a feature of PostgreSQL) for some specific requests. Migration is possible but will require code changes.
Related
I want to set up my database.yml (or wherever else is more appropriate) to ignore the SSL certificate when trying to connect to the database. I know this is bad practice but it is only a temporary thing that I need.
To give an example of what I'm trying to do, I want to mimic this SQL connection command:
mysql --ssl=0 -h 10.10.10.10 -u admincreds -p
I have tried putting each of the following parameters in the last line (sslca, sslkey, and sslcert) in my database.yml configuration as such:
development:
<<: *default
host: 10.10.10.10
username: admincreds
password: password
database: database
sslca/sslkey/sslcert: false
But I'm still getting the SSL error I expect:
.rvm/gems/ruby-2.2.2/gems/mysql2-0.3.21/lib/mysql2/client.rb:70:in `connect': SSL connection error: error:00000001:lib(0):func(0):reason(1) (Mysql2::Error)
Is there a different parameter I can put in that can skip over or not use ssl in database.yml or elsewhere? I just need to run a simple script.
According to mysql2 documentation you should set,
secure_auth: false
when using yaml conf for ActiveRecord connection.
The documentation points out:
ssl_mode: disabled
Worked for me.
I have used the camunda spring boot startup project (1.3.0) to spin up my camunda engine with the rest api.
In my application.yml I am trying to get camunda to create the database objects for me in a certain schema.
The settings below create the db objects...
camunda.bpm:
database:
schema-update: create-drop
type: postgres
table-prefix: my_schema.
spring.datasource:
url: "jdbc:postgresql://localhost:5432/mydb"
username: myuser
password: myuser
driverClassName: org.postgresql.Driver
The problem though is that the tables get created in the public schema. What I want to do is add a table-prefix equal to "my_schema."
Am I using this setting incorrectly or is there something I am missing?
thanks
Use
camunda:
bpm:
admin-user:
id: ${CM_ADMIN_USR:admin}
password: ${CM_ADMIN_PWD:admin}
database:
schema-update: false
schema-name: camunda
table-prefix: camunda.
Refer :
https://github.com/camunda/camunda-docs-manual/blob/master/content/user-guide/spring-boot-integration/configuration.md
Thorben is right: currently, camunda spring boot uses the normal database setup. So if (I actually never checked this) table_prefix is not supported, you cannot use it with spring boot.
I created an issue for removal: https://github.com/camunda/camunda-bpm-spring-boot-starter/issues/177
I resolved this issue by providing schema name as a suffix with the datasource URL
like :
url: "jdbc:postgresql://localhost:5432/mydb?currentSchema=my_schema"
Thus the tables should be created under the specified schema.
Apparently when using the Octopus gem to do Postgres replication everything should be plug and play. However I can't seem to find what I'm doing wrong.
This is my config/shards.yml
octopus:
environments:
- development
replicated: true
development:
slave1:
adapter: postgresql
host: localhost
database: slaveapp_development
username: pguser
password: pgpass
The AR model Provider(I create the exact same tables in each app via Rake tasks) I'd like to sync/replicate to my slave:
class Provider < ActiveRecord::Base
has_many :products
replicated_model()
end
I boot both apps via Rails server and enter Masterapp's console and from there:
> Provider.using(:slave1).create({provider_params...})
#=> works! I get a new record in slave1's DB.
> Provider.using(:master).create({provider_params...})
#=> works partly. Creates record only in master's DB.
The problem is that when calling Provider.using(:master)... I'm expecting:
1 - Create record at master's DB.
2 - Replicate same record at slave1's DB. <--- This is NOT happening.
That is not the purpose of the Octopus gem.
It redirects the database requests, depending on whether it is a read or write operation. That way you can use your Rails models without thinking about the current database connection and if it fits the intended operation.
It does not copy the data to the slaves.
To perform the actual replication, i.e. the data transfer from the master to the slaves, you have to set it up yourself.
There are several options with PostgreSQL. If you are using a newer version (9.1+) you can use the integrated streaming replication in "hot standby" mode. There are tutorials on how to set it up, e.g.
http://www.rassoc.com/gregr/weblog/2013/02/16/zero-to-postgresql-streaming-replication-in-10-mins/
http://prongs.org/blog/postgresql-replication
If you are stuck with an older version of PostgreSQL have a look at the alternatives.
Try adding fully_replicated: false after replicated: true in your config.
I am deploying my first little app with MongoDB and Mongoid as a driver.
What is the right secure way to use MongoDB in production?
I mean in the development I have just started mongod and that's it - no username or password needed and that looks unsecure.
Also Mongoid sets default configurations
production:
host: <%= ENV['MONGOID_HOST'] %>
port: <%= ENV['MONGOID_PORT'] %>
username: <%= ENV['MONGOID_USERNAME'] %>
password: <%= ENV['MONGOID_PASSWORD'] %>
database: <%= ENV['MONGOID_DATABASE'] %>
How should I configure this options and entire MongoDB on my production server?
To create a production environment where you need to use a username and password to connect:
In the mongo console:
// Add an Admin User (to the admin db)
use admin
db.addUser("theadmin", "anadminpassword")
// Use your database
use supercool
// Add a user (to your database)
db.addUser("joe", "passwordForJoe")
// show all users:
db.system.users.find()
// add readonly user (kinda cool)
db.addUser("readonly", "passwordForJoe", true)
Now, all connections to your mongodb will require authentication -- http://www.mongodb.org/display/DOCS/Security+and+Authentication
Also: you can consider using your linux firewall to only allow 27017 from your web server(s).
MongoDB by default doesn't support authentication. This is by design and is expected to be handled by individual applications. But it is not too hard to enable authenticated access to MongoDB. I will describe the steps I took for my typical rails, mongoid, git, capistrano based setup.
First add a user to the admin database. Without which none of the below steps work.
use admin
db.addUser("heisenberg", "knock-knock")
Create a user to the db your application will use. In MongoDB authentication works on a per db level
use breaking_bad
db.addUser("gus", "fring")
Better yet, create a user for just read-only purposes for security and performance benefits
use breaking_bad
db.addUser("walter", "white", true)
Enable the auth flag for mongodb to respect all your authentication related hardwork. This can be done either through a --auth flag to the mongodb command. Or better uncomment this line in the /etc/mongodb.conf
auth = true #Uncomment me
Now restart your mongodb process to pickup the new changes.
service mongodb restart
Check if you are on the right track by ensuring that your CRUD application now fails! It lost access to read/write from your mongodb afterall. Now add the username: and password: attributes to your mongoid.yml under the default group.
production:
sessions:
default:
database: breaking_bad
hosts:
- albuquerque.com:27017
username: gus
password: fring
For bonus points, remove the mongoid.yml file from the git repository as this file now has security credentials
git rm mongoid.yml
Add capistrano tasks that copy the mongoid.yml file from your dev machine to your server and add appropriate symlinks. Run cap deploy after this
namespace :mongoid do
desc "Copy mongoid config"
task :copy do
upload "config/mongoid.yml", "#{shared_path}/mongoid.yml", :via => :scp
end
desc "Link the mongoid config in the release_path"
task :symlink do
run "test -f #{release_path}/config/mongoid.yml || ln -s #{shared_path}/mongoid.yml #{release_path}/config/mongoid.yml"
end
end
Use the bind_ip setting in your /etc/mongodb.conf to tell MongoDB to only accept connections from your webserver
Use iptables to setup firewall settings to further secure your setup. Or use it within a VPN.
Further reading:
http://docs.mongodb.org/manual/tutorial/control-access-to-mongodb-with-authentication/
http://docs.mongodb.org/manual/administration/security/
Attempting to use JRuby 1.2.0 and Rails 2.3.2 with an embedded Derby database. I've copied derbytools.jar and derby.jar to $RUBY_HOME/lib, yet rake db:migrate still gives:
The driver encountered an error:
cannot load Java class org.apache.derby.jdbc.ClientDriver
Aaaand... I played a hunch and figured it out. So, I'll post this here in case somebody else runs into the same problem I did.
Almost all the documentation I found online has the following database.yml configuration for Derby:
development:
adapter: jdbc
driver: org.apache.derby.jdbc.ClientDriver
url: jdbc:derby:[db];create=true
username: xxx
password: xxx
This probably works fine for a client/server setup, but for an embedded Derby setup, you need this:
development:
adapter: jdbc
driver: org.apache.derby.jdbc.EmbeddedDriver
url: jdbc:derby:[db];create=true
username: xxx
password: xxx
Note the 'EmbeddedDriver', and not 'ClientDriver'.
Going to answer, because I hate seeing that red block in my profile.
There's also a subtle bug in ActiveRecord-JDBC when you use embedded derby -- if you don't give it a username and a password, nothing works. I've tracked down the cause of this bug, and am working on submitting a patch, but if you run into the same problem I did, let me know, and I'll post the code here.
Strange it worked fine for me , on my ubuntu 9.04 box :
i m using only the standard ubuntu packages and my DB configuration is :
development:
adapter: jdbc
driver: org.apache.derby.jdbc.EmbeddedDriver
url: jdbc:derby:[myapp];create=true
The ClientDriver is in derbyclient.jar
Further to Don's answer, I was getting this error when using the ClientDriver without a username/password: The driver encountered an error: java.sql.SQLNonTransientConnectionException: Password length (0) is outside the range of 1 to 255.
Setting username/password in database.yml fixed the problem!