aboutsummaryrefslogtreecommitdiffstats
path: root/databases
diff options
context:
space:
mode:
authorswills <swills@FreeBSD.org>2011-07-31 21:26:05 +0800
committerswills <swills@FreeBSD.org>2011-07-31 21:26:05 +0800
commita42e11d2f572298d16921e6cbcf1ffd60bfddab4 (patch)
tree84661e2a7d85907c8c929623f538694515319521 /databases
parentf0f4a69ea128e79379a79e7648e936cebbe59735 (diff)
downloadfreebsd-ports-gnome-a42e11d2f572298d16921e6cbcf1ffd60bfddab4.tar.gz
freebsd-ports-gnome-a42e11d2f572298d16921e6cbcf1ffd60bfddab4.tar.zst
freebsd-ports-gnome-a42e11d2f572298d16921e6cbcf1ffd60bfddab4.zip
Mission:
Development of an open-source solution for asynchronous, master-master replication of relational databases that is - ridiculously easy to use - database independent Currently supports PostgreSQL and MySQL. WWW: http://www.rubyrep.org/ PR: ports/158605 Submitted by: Eirik Oeverby <ltning@anduin.net>
Diffstat (limited to 'databases')
-rw-r--r--databases/Makefile1
-rw-r--r--databases/rubygem-rubyrep/Makefile43
-rw-r--r--databases/rubygem-rubyrep/distinfo2
-rw-r--r--databases/rubygem-rubyrep/files/rubyrep.in175
-rw-r--r--databases/rubygem-rubyrep/pkg-descr10
5 files changed, 231 insertions, 0 deletions
diff --git a/databases/Makefile b/databases/Makefile
index bca50803cfe5..91cf3bdf6254 100644
--- a/databases/Makefile
+++ b/databases/Makefile
@@ -791,6 +791,7 @@
SUBDIR += rubygem-pg
SUBDIR += rubygem-postgres
SUBDIR += rubygem-rbase
+ SUBDIR += rubygem-rubyrep
SUBDIR += rubygem-sqlite3
SUBDIR += rubygem-sqlite3-ruby
SUBDIR += sharedance
diff --git a/databases/rubygem-rubyrep/Makefile b/databases/rubygem-rubyrep/Makefile
new file mode 100644
index 000000000000..60d892138ba5
--- /dev/null
+++ b/databases/rubygem-rubyrep/Makefile
@@ -0,0 +1,43 @@
+# New ports collection makefile for: rubygem-rubyrep
+# Date created: 2011-07-30
+# Whom: Steve Wills <swills@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= rubyrep
+PORTVERSION= 1.2.0
+CATEGORIES= databases rubygems
+MASTER_SITES= RG
+
+MAINTAINER= ltning@anduin.net
+COMMENT= Multi-master replication and sync for MySQL and PostgreSQL
+
+BUILD_DEPENDS= rubygem-activesupport>=${PORTVERSION}:${PORTSDIR}/devel/rubygem-activesupport \
+ rubygem-activerecord>=${PORTVERSION}:${PORTSDIR}/databases/rubygem-activerecord
+RUN_DEPENDS+= flog>=0:${PORTSDIR}/sysutils/flog \
+ rubygem-activesupport>=${PORTVERSION}:${PORTSDIR}/devel/rubygem-activesupport \
+ rubygem-activerecord>=${PORTVERSION}:${PORTSDIR}/databases/rubygem-activerecord
+
+USE_RUBY= yes
+USE_RUBYGEMS= yes
+RUBYGEM_AUTOPLIST= yes
+
+USE_RC_SUBR= rubyrep
+
+OPTIONS = MYSQL "Enable MySQL support" off \
+ PGSQL "Enable PostgreSQL support" on
+
+PLIST_FILES= bin/rubyrep
+
+.include <bsd.port.options.mk>
+
+.if defined(WITH_PGSQL)
+RUN_DEPENDS+= rubygem-pg>=0:${PORTSDIR}/databases/rubygem-pg
+.endif
+
+.if defined(WITH_MYSQL)
+RUN_DEPENDS+= ruby-mysql>=0:${PORTSDIR}/databases/ruby-mysql
+.endif
+
+.include <bsd.port.mk>
diff --git a/databases/rubygem-rubyrep/distinfo b/databases/rubygem-rubyrep/distinfo
new file mode 100644
index 000000000000..fc12be03e417
--- /dev/null
+++ b/databases/rubygem-rubyrep/distinfo
@@ -0,0 +1,2 @@
+SHA256 (rubygem/rubyrep-1.2.0.gem) = 35348b04b3bc5babac1f8350caa9458ccfe33a16ec4bdbaa9eb9f94fee0c04d4
+SIZE (rubygem/rubyrep-1.2.0.gem) = 142848
diff --git a/databases/rubygem-rubyrep/files/rubyrep.in b/databases/rubygem-rubyrep/files/rubyrep.in
new file mode 100644
index 000000000000..7e55e62960d2
--- /dev/null
+++ b/databases/rubygem-rubyrep/files/rubyrep.in
@@ -0,0 +1,175 @@
+#!/bin/sh
+
+# PROVIDE: rubyrep
+# REQUIRE: NETWORKING SERVERS
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable `rubyrep':
+#rubyrep_enable="YES"
+# and be sure to configure (at least)
+# %%PREFIX%%/etc/rubyrep/rubyrep.conf
+#
+# To replicate more than one database, change
+#rubyrep_multi="NO"
+# to "YES". A rubyrep process will be started for each file with
+# .conf suffix in $rubyrep_config_dir.
+#
+# Additional options:
+#
+#rubyrep_stdout_log="/var/log/rubyrep.fifo"
+#rubyrep_stderr_log="/var/log/rubyrep_err.fifo"
+#rubyrep_fifo_logs="YES"
+# Specify log files for stdout and stderr. Defaults to using fifos;
+# actual log file will have the extension .log. Additional PID files
+# will be created for each of the processes used to tap the fifos;
+# these can be used in newsyslog.conf(5) to automate log rotation.
+#
+#rubyrep_config="%%PREFIX%%/etc/rubyrep.conf"
+# Specify full path to default rubyrep configuration file.
+# NOTE: Ignored if $rubyrep_multi is set to "YES"!
+#
+#rubyrep_config_dir="%%PREFIX%%/etc/rubyrep"
+# Specify directory containing config files for rubyrep. Used
+# by $rubyrep_multi, ignored if $rubyrep_multi="NO" (the default).
+#
+#rubyrep_command="replicate"
+# Specify the command to pass to rubyrep. Usually you'll want to
+# replicate (the default), but it is also possible to specify "proxy",
+# "scan" or "sync". Note: This option applies to all databases if
+# $rubyrep_multi="YES"!
+#
+#rubyrep_command_flags=""
+# Specify options to pass to the $rubyrep_command above. For other
+# operating modes than "replicate" this may be necessary, especially
+# if you want useful log output! Run
+# %%prefix%%/bin/rubyrep <command> --help
+# for further information.
+
+rubyrep_enable="${rubyrep_enable:-"NO"}"
+rubyrep_multi="${rubyrep_multi:-"NO"}"
+rubyrep_command="${rubyrep_command:-"replicate"}"
+rubyrep_command_flags="${rubyrep_command_flags:-""}"
+rubyrep_config="${rubyrep_config:-"%%PREFIX%%/etc/rubyrep.conf"}"
+rubyrep_config_dir="${rubyrep_config_dir:-"%%PREFIX%%/etc/rubyrep"}"
+rubyrep_user="${rubyrep_user:-"daemon"}"
+rubyrep_stdout_log="${rubyrep_stdout_log:-"/var/log/rubyrep.fifo"}"
+rubyrep_stderr_log="${rubyrep_stderr_log:-"/var/log/rubyrep_err.fifo"}"
+rubyrep_fifo_logs="YES"
+
+. /etc/rc.subr
+
+checkfifo() {
+ # Check and create if necessary fifo special files for logging
+ for f in $stdout_log $stderr_log ; do
+ flog_fifo=$f
+ if [ ! -p "$flog_fifo" ] ; then
+ mkfifo $flog_fifo ; chown ${rubyrep_user} $flog_fifo
+ fi
+ done
+}
+
+pid_touch () {
+ touch $pidfile
+ chown $rubyrep_user $pidfile
+}
+
+rubyrep_prestart() {
+ pid_touch
+ if [ "$rubyrep_fifo_logs"="YES" ] ; then
+ umask 027
+ checkfifo
+ for f in $stdout_log $stderr_log ; do
+ flog_fifo=$f
+ flog_args=" -t "
+ if [ "$cfgname" ] ; then
+ local out_log="`dirname $f`/`basename -s .fifo.$cfgname $flog_fifo`.$cfgname.log"
+ local out_pid="/var/run/`basename -s .fifo.$cfgname $flog_fifo`.$cfgname.flog.pid"
+ else
+ local out_log="`dirname $f`/`basename -s .fifo $flog_fifo`.log"
+ local out_pid="/var/run/`basename -s .fifo $flog_fifo`.flog.pid"
+ fi
+
+ echo "Enabling logging for $flog_fifo ($out_log, $out_pid)..."
+ echo "%%PREFIX%%/bin/flog $flog_args $out_log < $flog_fifo &"
+ %%PREFIX%%/bin/flog $flog_args $out_log < $flog_fifo &
+ echo $! > $out_pid
+ done
+ fi
+}
+
+rubyrep_stop() {
+ if [ -f "$pidfile" ] ; then
+ kill -9 `cat $pidfile`
+ rm $pidfile
+ else
+ echo "PID file not found ($pidfile)"
+ fi
+}
+
+rubyrep_poststop() {
+ if [ "$rubyrep_fifo_logs"="YES" ] ; then
+ for f in $stdout_log $stderr_log ; do
+ flog_fifo=$f
+ if [ "$cfgname" ] ; then
+ local out_pid="/var/run/`basename -s .fifo.$cfgname $flog_fifo`.$cfgname.flog.pid"
+ else
+ local out_pid="/var/run/`basename -s .fifo $flog_fifo`.flog.pid"
+ fi
+ kill $out_pid >/dev/null 2>/dev/null
+ rm $out_pid >/dev/null 2>/dev/null
+ done
+ fi
+}
+
+rubyrep_init() {
+ if [ "$rubyrep_multi" = "NO" ] ; then
+ cmdline="%%PREFIX%%/bin/rubyrep generate $rubyrep_config"
+ if [ "$1" = "init" -a -f "$rubyrep_config" ] ; then
+ echo "Skipping file $rubyrep_config (already exists)."
+ else
+ echo "Generating template file $rubyrep_config"
+ $cmdline
+ fi
+ else
+ echo 'Command not available when $rubyrep_multi="YES"'.
+ exit
+ fi
+}
+
+name="rubyrep"
+rcvar=`set_rcvar`
+
+# read configuration and set defaults
+load_rc_config $name
+
+extra_commands="init"
+init_cmd="${name}_init"
+
+command="/usr/sbin/daemon"
+start_precmd="${name}_prestart"
+stop_cmd="${name}_stop"
+stop_postcmd="${name}_poststop"
+rubyrep_command_flags="$rubyrep_command_flags"
+
+if [ "$rubyrep_multi" = "NO" ] ; then
+ stdout_log=${rubyrep_stdout_log}
+ stderr_log=${rubyrep_stderr_log}
+ log_args=">> ${stdout_log} 2>> ${stderr_log} "
+ cmdline="%%PREFIX%%/bin/rubyrep $rubyrep_command $rubyrep_command_flags -c $rubyrep_config"
+ pidfile="/var/run/$name.pid"
+ flags="-p ${pidfile} ${cmdline} ${log_args}"
+ run_rc_command "$1"
+elif [ "$rubyrep_multi" = "YES" ] ; then
+ [ ! -d "$rubyrep_config_dir" ] && mkdir -p "$rubyrep_config_dir"
+ for i in `ls $rubyrep_config_dir/*.conf` ; do
+ rubyrep_config=$i
+ cfgname=$(basename -s .conf $i)
+ stdout_log=${rubyrep_stdout_log}.$cfgname
+ stderr_log=${rubyrep_stderr_log}.$cfgname
+ log_args=">> ${stdout_log} 2>> ${stderr_log} "
+ cmdline="%%PREFIX%%/bin/rubyrep $rubyrep_command $rubyrep_command_flags -c $rubyrep_config"
+ pidfile="/var/run/${name}_${cfgname}.pid"
+ flags="-p ${pidfile} ${cmdline} ${log_args}"
+ run_rc_command "$1"
+ done
+fi
diff --git a/databases/rubygem-rubyrep/pkg-descr b/databases/rubygem-rubyrep/pkg-descr
new file mode 100644
index 000000000000..043e275d8f53
--- /dev/null
+++ b/databases/rubygem-rubyrep/pkg-descr
@@ -0,0 +1,10 @@
+Mission:
+Development of an open-source solution for asynchronous, master-master
+replication of relational databases that is
+
+- ridiculously easy to use
+- database independent
+
+Currently supports PostgreSQL and MySQL.
+
+WWW: http://www.rubyrep.org/