syncwrap 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc ADDED
@@ -0,0 +1,2 @@
1
+ === 1.0.0 (2012-7-15)
2
+ * Initial release.
data/Manifest.txt ADDED
@@ -0,0 +1,28 @@
1
+ History.rdoc
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ etc/init.d/iyyov
6
+ etc/postgresql/9.1/main/environment
7
+ etc/postgresql/9.1/main/pg_ctl.conf
8
+ etc/postgresql/9.1/main/pg_hba.conf
9
+ etc/postgresql/9.1/main/pg_ident.conf
10
+ etc/postgresql/9.1/main/postgresql.conf
11
+ etc/postgresql/9.1/main/start.conf
12
+ etc/sysctl.d/61-postgresql-shm.conf
13
+ lib/syncwrap/base.rb
14
+ lib/syncwrap.rb
15
+ lib/syncwrap/common.rb
16
+ lib/syncwrap/distro.rb
17
+ lib/syncwrap/ec2.rb
18
+ lib/syncwrap/hashdot.rb
19
+ lib/syncwrap/iyyov.rb
20
+ lib/syncwrap/java.rb
21
+ lib/syncwrap/jruby.rb
22
+ lib/syncwrap/postgresql.rb
23
+ lib/syncwrap/remote_task.rb
24
+ lib/syncwrap/rhel.rb
25
+ lib/syncwrap/ubuntu.rb
26
+ lib/syncwrap/user_run.rb
27
+ test/test_syncwrap.rb
28
+ usr/local/bin/jgem
data/README.rdoc ADDED
@@ -0,0 +1,92 @@
1
+ = SyncWrap
2
+
3
+ * http://github.com/dekellum/syncwrap
4
+
5
+ == Description
6
+
7
+ A generalized and modular set of provisioning and deployment routines.
8
+ The Rake-centric Vlad and not-actually-Rake Capistrano both suffer
9
+ from lack of objects, e.g. the ability to customize and mix-in
10
+ behavior. SyncWrap offers an Object/Module system that can be used
11
+ with either. Known to work with Vlad/rake-remote_task but could also
12
+ be integrated with Capistrano, or others.
13
+
14
+ == Features
15
+
16
+ * Multi-line shell support in SyncWrap::Common#run,
17
+ SyncWrap::Common#sudo for more natural script embedding
18
+
19
+ * SyncWrap::Common::rput offers some useful rsync magic, like setting
20
+ the owner of placed remote files
21
+
22
+ * Platform differences are factored out into platform-specific modules
23
+
24
+ * SyncWrap::RemoteTask rake-remote_task adapter (see synopsis below)
25
+
26
+ * Gem install utilities. e.g. SyncWrap::JRuby#jruby_check_gem,
27
+ SyncWrap::JRuby#jruby_install_gem
28
+
29
+ == Provisions
30
+
31
+ Currently the following provisions are provided:
32
+
33
+ * Complete SyncWrap::Java, SyncWrap::Hashdot, SyncWrap::JRuby stack
34
+
35
+ * SyncWrap::PostgreSQL
36
+
37
+ * SyncWrap::Iyyov job scheduler and process monitor
38
+
39
+ * SyncWrap::UserRun for setup of a run user for deployed daemons, jobs
40
+ and var directories.
41
+
42
+ == Synopsis
43
+
44
+ For example, in your Rakefile with the SyncWrap::RemoteTask adapter:
45
+
46
+ class SyncWrapper
47
+
48
+ # Include these support modules for the tasks below, or include
49
+ # your own.
50
+
51
+ include SyncWrap::Java
52
+ include SyncWrap::Hashdot
53
+ include SyncWrap::JRuby
54
+ include SyncWrap::Ubuntu
55
+
56
+ include SyncWrap::RemoteTask
57
+
58
+ def initialize
59
+ super
60
+ self.common_prefix = '/usr/local'
61
+ end
62
+
63
+ def define_tasks
64
+ desc "Combined Java, Hashdot, JRuby Deployment"
65
+ remote_task :jruby_deploy do
66
+ java_install
67
+ hashdot_install
68
+ jruby_install
69
+ end
70
+ end
71
+
72
+ # Override any of the support methods as needed.
73
+
74
+ end
75
+
76
+ SyncWrapper.new.define_tasks
77
+
78
+ == License
79
+
80
+ Copyright (c) 2011-2012 David Kellum
81
+
82
+ Licensed under the Apache License, Version 2.0 (the "License"); you
83
+ may not use this file except in compliance with the License. You
84
+ may obtain a copy of the License at:
85
+
86
+ http://www.apache.org/licenses/LICENSE-2.0
87
+
88
+ Unless required by applicable law or agreed to in writing, software
89
+ distributed under the License is distributed on an "AS IS" BASIS,
90
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
91
+ implied. See the License for the specific language governing
92
+ permissions and limitations under the License.
data/Rakefile ADDED
@@ -0,0 +1,64 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+
6
+ require 'rjack-tarpit'
7
+
8
+ RJack::TarPit.new( 'syncwrap' ).define_tasks
9
+
10
+ require 'syncwrap/java'
11
+ require 'syncwrap/hashdot'
12
+ require 'syncwrap/jruby'
13
+ require 'syncwrap/iyyov'
14
+ require 'syncwrap/ubuntu'
15
+ require 'syncwrap/postgresql'
16
+ require 'syncwrap/remote_task'
17
+
18
+ class SyncWrapper
19
+ include SyncWrap::Java
20
+ include SyncWrap::Hashdot
21
+ include SyncWrap::JRuby
22
+ include SyncWrap::Iyyov
23
+ include SyncWrap::Ubuntu
24
+ include SyncWrap::PostgreSQL::Ubuntu
25
+
26
+ include SyncWrap::RemoteTask
27
+
28
+ def initialize
29
+ super
30
+
31
+ # SETUP: Install user@server instance goes here
32
+ set :domain, "localhost"
33
+
34
+ end
35
+
36
+ def define_tasks
37
+
38
+ desc "Combined Java, Hashdot, JRuby Deployment"
39
+ remote_task :jruby_deploy do
40
+ java_install
41
+ hashdot_install
42
+ jruby_install
43
+ end
44
+
45
+ desc "Deploy Iyyov Deamon"
46
+ remote_task :iyyov_deploy do
47
+ user_run_dir_setup
48
+ iyyov_install
49
+ end
50
+
51
+ desc "Deploy PostgreSQL"
52
+ remote_task :pg_deploy do
53
+ pg_install
54
+ pg_stop
55
+ pg_adjust_sysctl
56
+ pg_configure
57
+ pg_start
58
+ end
59
+
60
+ end
61
+
62
+ end
63
+
64
+ SyncWrapper.new.define_tasks
data/etc/init.d/iyyov ADDED
@@ -0,0 +1,98 @@
1
+ #!/bin/sh
2
+
3
+ ### BEGIN INIT INFO
4
+ # Provides: iyyov
5
+ # Required-Start: $remote_fs $syslog
6
+ # Required-Stop: $remote_fs $syslog
7
+ # Should-Start: $named
8
+ # Default-Start: 2 3 4 5
9
+ # Default-Stop:
10
+ # Short-Description: Iyyov jruby monitor
11
+ # Description: Iyyov jruby monitoring and job control daemon
12
+ ### END INIT INFO
13
+
14
+ set -e
15
+
16
+ . /lib/lsb/init-functions
17
+
18
+ # Gem home directory
19
+ # Set to match system "jgem environment path"
20
+ gem_home="/usr/local/lib/jruby/gems"
21
+
22
+ # (Exact) Gem version of iyyov to run
23
+ version="1.1.3"
24
+
25
+ # User to run the daemon as (should own rundir)
26
+ user="runr"
27
+
28
+ # Running directory (for jobs.rb config, log, and pid file)
29
+ rundir="/var/local/runr/iyyov"
30
+
31
+ prog="iyyov"
32
+ daemon="${gem_home}/gems/iyyov-${version}-java/init/${prog}"
33
+ config="${rundir}/jobs.rb"
34
+ pidfile="${rundir}/${prog}.pid"
35
+
36
+ RETVAL=0
37
+
38
+ start() {
39
+ [ -x "$daemon" ] || exit 5
40
+ [ -f "$config" ] || exit 6
41
+ [ -d "$rundir" ] || exit 7
42
+
43
+ log_daemon_msg "Starting Iyyov Daemon" "iyyov"
44
+ start-stop-daemon --start -d $rundir -c $user --exec $daemon -- $config
45
+ RETVAL=$?
46
+ log_end_msg $RETVAL
47
+ }
48
+
49
+ status() {
50
+ if [ -f "$pidfile" ]; then
51
+ pid=`cat $pidfile`
52
+ echo "Status $prog: running pid $pid"
53
+ else
54
+ echo "Status $prog: not running"
55
+ fi
56
+ }
57
+
58
+ reload() {
59
+ if [ -e "$pidfile" ]; then
60
+ touch $config
61
+ fi
62
+ }
63
+
64
+ stop() {
65
+ log_daemon_msg "Stopping iyyov daemon" "iyyov"
66
+ start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile
67
+ RETVAL=$?
68
+ log_end_msg $RETVAL
69
+ }
70
+
71
+ case "$1" in
72
+ start)
73
+ start
74
+ ;;
75
+ stop)
76
+ stop
77
+ ;;
78
+ status)
79
+ status
80
+ ;;
81
+ reload)
82
+ reload
83
+ ;;
84
+ restart)
85
+ stop
86
+ start
87
+ RETVAL=$?
88
+ ;;
89
+ condrestart)
90
+ [ -e $pidfile ] && restart
91
+ RETVAL=$?
92
+ ;;
93
+ *)
94
+ echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
95
+ RETVAL=1
96
+ esac
97
+
98
+ exit $RETVAL
@@ -0,0 +1,7 @@
1
+ # environment variables for postmaster process
2
+ # This file has the same syntax as postgresql.conf:
3
+ # VARIABLE = simple_value
4
+ # VARIABLE2 = 'any value!'
5
+ # I. e. you need to enclose any value which does not only consist of letters,
6
+ # numbers, and '-', '_', '.' in single quotes. Shell commands are not
7
+ # evaluated.
@@ -0,0 +1,5 @@
1
+ # Automatic pg_ctl configuration
2
+ # This configuration file contains cluster specific options to be passed to
3
+ # pg_ctl(1).
4
+
5
+ pg_ctl_options = ''
@@ -0,0 +1,96 @@
1
+ # PostgreSQL Client Authentication Configuration File
2
+ # ===================================================
3
+ #
4
+ # Refer to the "Client Authentication" section in the PostgreSQL
5
+ # documentation for a complete description of this file. A short
6
+ # synopsis follows.
7
+ #
8
+ # This file controls: which hosts are allowed to connect, how clients
9
+ # are authenticated, which PostgreSQL user names they can use, which
10
+ # databases they can access. Records take one of these forms:
11
+ #
12
+ # local DATABASE USER METHOD [OPTIONS]
13
+ # host DATABASE USER ADDRESS METHOD [OPTIONS]
14
+ # hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
15
+ # hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
16
+ #
17
+ # (The uppercase items must be replaced by actual values.)
18
+ #
19
+ # The first field is the connection type: "local" is a Unix-domain
20
+ # socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
21
+ # "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
22
+ # plain TCP/IP socket.
23
+ #
24
+ # DATABASE can be "all", "sameuser", "samerole", "replication", a
25
+ # database name, or a comma-separated list thereof. The "all"
26
+ # keyword does not match "replication". Access to replication
27
+ # must be enabled in a separate record (see example below).
28
+ #
29
+ # USER can be "all", a user name, a group name prefixed with "+", or a
30
+ # comma-separated list thereof. In both the DATABASE and USER fields
31
+ # you can also write a file name prefixed with "@" to include names
32
+ # from a separate file.
33
+ #
34
+ # ADDRESS specifies the set of hosts the record matches. It can be a
35
+ # host name, or it is made up of an IP address and a CIDR mask that is
36
+ # an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
37
+ # specifies the number of significant bits in the mask. A host name
38
+ # that starts with a dot (.) matches a suffix of the actual host name.
39
+ # Alternatively, you can write an IP address and netmask in separate
40
+ # columns to specify the set of hosts. Instead of a CIDR-address, you
41
+ # can write "samehost" to match any of the server's own IP addresses,
42
+ # or "samenet" to match any address in any subnet that the server is
43
+ # directly connected to.
44
+ #
45
+ # METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
46
+ # "krb5", "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
47
+ # "password" sends passwords in clear text; "md5" is preferred since
48
+ # it sends encrypted passwords.
49
+ #
50
+ # OPTIONS are a set of options for the authentication in the format
51
+ # NAME=VALUE. The available options depend on the different
52
+ # authentication methods -- refer to the "Client Authentication"
53
+ # section in the documentation for a list of which options are
54
+ # available for which authentication methods.
55
+ #
56
+ # Database and user names containing spaces, commas, quotes and other
57
+ # special characters must be quoted. Quoting one of the keywords
58
+ # "all", "sameuser", "samerole" or "replication" makes the name lose
59
+ # its special character, and just match a database or username with
60
+ # that name.
61
+ #
62
+ # This file is read on server startup and when the postmaster receives
63
+ # a SIGHUP signal. If you edit the file on a running system, you have
64
+ # to SIGHUP the postmaster for the changes to take effect. You can
65
+ # use "pg_ctl reload" to do that.
66
+
67
+ # Put your actual configuration here
68
+ # ----------------------------------
69
+ #
70
+ # If you want to allow non-local connections, you need to add more
71
+ # "host" records. In that case you will also need to make PostgreSQL
72
+ # listen on a non-local interface via the listen_addresses
73
+ # configuration parameter, or via the -i or -h command line switches.
74
+
75
+ # DO NOT DISABLE!
76
+ # If you change this first entry you will need to make sure that the
77
+ # database superuser can access the database using some other method.
78
+ # Noninteractive access to all databases is required during automatic
79
+ # maintenance (custom daily cronjobs, replication, and similar tasks).
80
+ #
81
+ # Database administrative login by Unix domain socket
82
+ local all postgres peer
83
+
84
+ # TYPE DATABASE USER ADDRESS METHOD
85
+
86
+ # "local" is for Unix domain socket connections only
87
+ local all all peer
88
+ # IPv4 local connections:
89
+ host all all 127.0.0.1/32 trust
90
+ # IPv6 local connections:
91
+ host all all ::1/128 trust
92
+ # Allow replication connections from localhost, by a user with the
93
+ # replication privilege.
94
+ #local replication postgres peer
95
+ #host replication postgres 127.0.0.1/32 md5
96
+ #host replication postgres ::1/128 md5
@@ -0,0 +1,42 @@
1
+ # PostgreSQL User Name Maps
2
+ # =========================
3
+ #
4
+ # Refer to the PostgreSQL documentation, chapter "Client
5
+ # Authentication" for a complete description. A short synopsis
6
+ # follows.
7
+ #
8
+ # This file controls PostgreSQL user name mapping. It maps external
9
+ # user names to their corresponding PostgreSQL user names. Records
10
+ # are of the form:
11
+ #
12
+ # MAPNAME SYSTEM-USERNAME PG-USERNAME
13
+ #
14
+ # (The uppercase quantities must be replaced by actual values.)
15
+ #
16
+ # MAPNAME is the (otherwise freely chosen) map name that was used in
17
+ # pg_hba.conf. SYSTEM-USERNAME is the detected user name of the
18
+ # client. PG-USERNAME is the requested PostgreSQL user name. The
19
+ # existence of a record specifies that SYSTEM-USERNAME may connect as
20
+ # PG-USERNAME.
21
+ #
22
+ # If SYSTEM-USERNAME starts with a slash (/), it will be treated as a
23
+ # regular expression. Optionally this can contain a capture (a
24
+ # parenthesized subexpression). The substring matching the capture
25
+ # will be substituted for \1 (backslash-one) if present in
26
+ # PG-USERNAME.
27
+ #
28
+ # Multiple maps may be specified in this file and used by pg_hba.conf.
29
+ #
30
+ # No map names are defined in the default configuration. If all
31
+ # system user names and PostgreSQL user names are the same, you don't
32
+ # need anything in this file.
33
+ #
34
+ # This file is read on server startup and when the postmaster receives
35
+ # a SIGHUP signal. If you edit the file on a running system, you have
36
+ # to SIGHUP the postmaster for the changes to take effect. You can
37
+ # use "pg_ctl reload" to do that.
38
+
39
+ # Put your actual configuration here
40
+ # ----------------------------------
41
+
42
+ # MAPNAME SYSTEM-USERNAME PG-USERNAME