mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-24 21:07:26 +08:00
Merge pull request #562 from jstaffans/master
Add Vagrant/Puppet setup for MySQL, PostgreSQL, Oracle and Cubrid. #548
This commit is contained in:
commit
d608e18db4
8
.gitignore
vendored
8
.gitignore
vendored
@ -8,3 +8,11 @@ test-output
|
||||
/.metadata
|
||||
.cache
|
||||
derby.log
|
||||
/querydsl-devops/.tmp
|
||||
/querydsl-devops/.librarian
|
||||
/querydsl-devops/.vagrant
|
||||
/querydsl-devops/Puppetfile.lock
|
||||
/querydsl-devops/modules
|
||||
/querydsl-devops/*.rpm.zip
|
||||
/querydsl-devops/**/*.semaphore
|
||||
/querydsl-devops/test-connection/.lein-repl-history
|
||||
|
||||
30
README.md
30
README.md
@ -28,8 +28,38 @@ Querydsl provides releases via public Maven repositories, but you can build the
|
||||
|
||||
For more information visit the project homepage at http://www.querydsl.com/.
|
||||
|
||||
**Vagrant/Puppet setup**
|
||||
|
||||
For running tests, a Vagrant/Puppet setup is provided. It is based on Ubuntu 12.04 and comes with the following databases:
|
||||
|
||||
* Oracle Express Edition 11g
|
||||
* PostgreSQL 9.1.10
|
||||
* MySQL 5.5.34
|
||||
* Cubrid 9.2
|
||||
|
||||
You will need to install [VirtualBox], [Puppet], [Vagrant], the [vagrant-vbguest] plugin and [librarian-puppet]. You will also need to
|
||||
download the Oracle XE 11g installer file (```oracle-xe-11.2.0-1.0.x86_64.rpm.zip```) manually and
|
||||
place it in the ```querydsl-devops``` directory.
|
||||
|
||||
To launch the virtual machine:
|
||||
|
||||
```
|
||||
$> cd querydsl-devops
|
||||
devops$> librarian-puppet install
|
||||
devops$> vagrant up
|
||||
```
|
||||
|
||||
All of the databases' default ports are forwarded to the host machine. See the Vagrantfile for details.
|
||||
|
||||
|
||||
**How to contribute**
|
||||
|
||||
GitHub pull requests are the way to contribute to Querydsl.
|
||||
|
||||
If you are unsure about the details of a contribution, ask on the Querydsl Google Group or create a ticket on GitHub.
|
||||
|
||||
[VirtualBox]: https://www.virtualbox.org/
|
||||
[Vagrant]: http://www.vagrantup.com/
|
||||
[Puppet]: http://puppetlabs.com/
|
||||
[vagrant-vbguest]: https://github.com/dotless-de/vagrant-vbguest
|
||||
[librarian-puppet]: http://librarian-puppet.com/
|
||||
|
||||
17
querydsl-devops/Puppetfile
Normal file
17
querydsl-devops/Puppetfile
Normal file
@ -0,0 +1,17 @@
|
||||
forge "http://forge.puppetlabs.com"
|
||||
|
||||
mod "puppetlabs/apt"
|
||||
mod "puppetlabs/stdlib"
|
||||
mod "puppetlabs/java"
|
||||
mod "puppetlabs/mysql"
|
||||
mod "puppetlabs/postgresql"
|
||||
|
||||
mod "mysqlscript",
|
||||
:git => "git://github.com/jstaffans/puppet-mysqlscript.git"
|
||||
|
||||
mod "oracle",
|
||||
:git => "git://github.com/jstaffans/puppet-oracle.git"
|
||||
|
||||
mod "cubrid",
|
||||
:git => "git://github.com/jstaffans/puppet-cubrid-demodb.git"
|
||||
|
||||
35
querydsl-devops/Vagrantfile
vendored
Normal file
35
querydsl-devops/Vagrantfile
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
config.vm.box = "precise64"
|
||||
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
||||
config.vm.hostname = "querydsl-server"
|
||||
|
||||
# Boot with a GUI so you can see the screen. Good for debugging startup issues.
|
||||
# config.vm.boot_mode = :gui
|
||||
|
||||
config.vm.network :forwarded_port, guest: 5432, host: 5432
|
||||
config.vm.network :forwarded_port, guest: 3306, host: 3306
|
||||
config.vm.network :forwarded_port, guest: 1521, host: 1521
|
||||
config.vm.network :forwarded_port, guest: 30000, host: 30000
|
||||
|
||||
config.vm.synced_folder ".", "/opt/querydsl"
|
||||
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
# Use VBoxManage to customize the VM
|
||||
vb.customize ["modifyvm", :id,
|
||||
"--memory", "1024",
|
||||
"--name", "querydsl-server",
|
||||
"--natdnshostresolver1", "on"]
|
||||
end
|
||||
|
||||
config.vbguest.auto_update = false
|
||||
|
||||
config.vm.provision :puppet, :module_path => "modules" do |puppet|
|
||||
puppet.manifests_path = "manifests"
|
||||
puppet.manifest_file = "site.pp"
|
||||
end
|
||||
|
||||
end
|
||||
60
querydsl-devops/manifests/site.pp
Normal file
60
querydsl-devops/manifests/site.pp
Normal file
@ -0,0 +1,60 @@
|
||||
exec {'apt-update':
|
||||
command => '/usr/bin/apt-get update',
|
||||
}
|
||||
|
||||
Exec['apt-update'] -> Package <| |>
|
||||
|
||||
node default {
|
||||
|
||||
include apt
|
||||
include stdlib
|
||||
include java
|
||||
|
||||
include oracle::server
|
||||
include oracle::swap
|
||||
|
||||
class { 'oracle::xe':
|
||||
package_file => '/opt/querydsl/oracle-xe-11.2.0-1.0.x86_64.rpm.zip',
|
||||
scripts_dir => '/opt/querydsl/sql-snippets',
|
||||
}
|
||||
|
||||
oracle::xe::script {'oracle.sql': }
|
||||
|
||||
user { "vagrant":
|
||||
groups => "dba",
|
||||
# So that we let Oracle installer create the group
|
||||
require => Service["oracle-xe"],
|
||||
}
|
||||
|
||||
class { 'mysql::server':
|
||||
root_password => 'querydsl',
|
||||
|
||||
override_options => {
|
||||
'mysqld' => {
|
||||
'bind_address' => '0.0.0.0',
|
||||
'skip-name-resolve' => true,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
class { 'mysqlscript':
|
||||
snippets_dir => '/opt/querydsl/sql-snippets',
|
||||
}
|
||||
|
||||
mysqlscript::run_script { 'mysql.sql': }
|
||||
|
||||
class { 'postgresql::server':
|
||||
/* Enable access from host machine when using Vagrant */
|
||||
listen_addresses => '*',
|
||||
ipv4acls => ['host all querydsl 0.0.0.0/0 md5'],
|
||||
postgres_password => 'querydsl',
|
||||
}
|
||||
|
||||
postgresql::server::db { 'querydsl':
|
||||
user => 'querydsl',
|
||||
password => 'querydsl'
|
||||
}
|
||||
|
||||
include cubrid
|
||||
|
||||
}
|
||||
9
querydsl-devops/sql-snippets/mysql.sql
Normal file
9
querydsl-devops/sql-snippets/mysql.sql
Normal file
@ -0,0 +1,9 @@
|
||||
CREATE DATABASE querydsl CHARACTER SET utf8 COLLATE utf8_swedish_ci;
|
||||
|
||||
# For access from within the Vagrant box
|
||||
CREATE USER 'querydsl'@'localhost' IDENTIFIED BY 'querydsl';
|
||||
GRANT ALL PRIVILEGES ON querydsl.* TO 'querydsl'@'localhost';
|
||||
|
||||
# Host access
|
||||
CREATE USER 'querydsl'@'%' IDENTIFIED BY 'querydsl';
|
||||
GRANT ALL PRIVILEGES ON querydsl.* TO 'querydsl'@'%';
|
||||
4
querydsl-devops/sql-snippets/oracle.sql
Normal file
4
querydsl-devops/sql-snippets/oracle.sql
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE USER querydsl IDENTIFIED BY querydsl;
|
||||
GRANT CREATE SESSION TO querydsl;
|
||||
GRANT CREATE TABLE TO querydsl;
|
||||
GRANT unlimited tablespace TO querydsl;
|
||||
15
querydsl-devops/test-connection/project.clj
Normal file
15
querydsl-devops/test-connection/project.clj
Normal file
@ -0,0 +1,15 @@
|
||||
; The Oracle JDBC driver is not available in any public Maven repository.
|
||||
; You can however download it and install it in your local Maven repository manually:
|
||||
;
|
||||
; mvn install:install-file -Durl=file:repo -Dfile=ojdbc6.jar -DgroupId=com.oracle \
|
||||
; -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
|
||||
;
|
||||
|
||||
(defproject test-connection "0.1.0-SNAPSHOT"
|
||||
:repositories {"cubrid-releases" "http://maven.cubrid.org/"}
|
||||
:dependencies [[org.clojure/clojure "1.5.1"]
|
||||
[org.clojure/java.jdbc "0.3.0-alpha4"]
|
||||
[com.oracle/ojdbc6 "11.2.0"]
|
||||
[postgresql/postgresql "9.1-901.jdbc4"]
|
||||
[mysql/mysql-connector-java "5.1.27"]
|
||||
[cubrid/cubrid-jdbc "9.2.0.0155"]])
|
||||
32
querydsl-devops/test-connection/src/test_connection/core.clj
Normal file
32
querydsl-devops/test-connection/src/test_connection/core.clj
Normal file
@ -0,0 +1,32 @@
|
||||
(ns test-connection.core
|
||||
(:require [clojure.java.jdbc :as j]
|
||||
[clojure.java.jdbc.sql :as s]))
|
||||
|
||||
(def oracle-db {:classname "oracle.jdbc.OracleDriver"
|
||||
:subprotocol "oracle"
|
||||
:subname "thin:@localhost:1521:XE"
|
||||
:user "querydsl"
|
||||
:password "querydsl"})
|
||||
|
||||
(def postgres-db {:classname "org.postgresql.Driver"
|
||||
:subprotocol "postgresql"
|
||||
:subname "//localhost:5432/querydsl"
|
||||
:user "querydsl"
|
||||
:password "querydsl"})
|
||||
|
||||
(def mysql-db {:classname "com.mysql.jdbc.Driver"
|
||||
:subprotocol "mysql"
|
||||
:subname "//localhost:3306/querydsl"
|
||||
:user "querydsl"
|
||||
:password "querydsl"})
|
||||
|
||||
(def cubrid-db {:classname "cubrid.jdbc.driver.CUBRIDDriver"
|
||||
:subprotocol "cubrid"
|
||||
:subname "localhost:30000:demodb:public::"})
|
||||
|
||||
(count (j/query oracle-db (s/select * :all_tables)))
|
||||
(count (j/query postgres-db (s/select * :pg_catalog.pg_tables)))
|
||||
(count (j/query mysql-db (s/select * :information_schema.tables)))
|
||||
(count (j/query cubrid-db (s/select * :athlete)))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user