ports/158605: New port: databases/rubygem-rubyrep Multi-master replication for MySQL and PostgreSQL

Charlie & root at build02.osl2.modirum.com
Sun Jul 3 12:00:32 UTC 2011


>Number:         158605
>Category:       ports
>Synopsis:       New port: databases/rubygem-rubyrep Multi-master replication for MySQL and PostgreSQL
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 03 12:00:24 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Eirik Oeverby
>Release:        FreeBSD 8.2-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD build02.osl2.modirum.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011 root at mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64

>Description:
Multi-master replication and sync for MySQL and PostgreSQL.

>How-To-Repeat:
>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	rubygem-rubyrep
#	rubygem-rubyrep/Makefile
#	rubygem-rubyrep/distinfo
#	rubygem-rubyrep/files
#	rubygem-rubyrep/files/rubyrep.in
#	rubygem-rubyrep/pkg-descr
#
echo c - rubygem-rubyrep
mkdir -p rubygem-rubyrep > /dev/null 2>&1
echo x - rubygem-rubyrep/Makefile
sed 's/^X//' >rubygem-rubyrep/Makefile << '46ecf18c564e445d214043f5bead61e7'
X# New ports collection makefile for: pg
X# Date created: 28 Jan 2009
X# Whom: Wen Heping <wenheping at gmail.com>
X#
X# $FreeBSD: ports/databases/rubygem-pg/Makefile,v 1.9 2011/06/19 02:30:14 swills Exp $
X#
X
XPORTNAME=		rubyrep
XPORTVERSION=		1.2.0
XCATEGORIES=		databases rubygems
XMASTER_SITES=		RG
X
XMAINTAINER=		ltning at anduin.net
XCOMMENT=		Multi-master replication and sync for MySQL and PostgreSQL
X
XUSE_RUBY=		yes
XUSE_RUBYGEMS=		yes
XRUBYGEM_AUTOPLIST=	yes
X
XUSE_RC_SUBR=	rubyrep
X
XRUN_DEPENDS+=	flog>=0:${PORTSDIR}/sysutils/flog
X
XOPTIONS =	MYSQL "Enable MySQL support" off \
X		PGSQL "Enable PostgreSQL support" on
X
X.include <bsd.port.options.mk>
X
X.if defined(WITH_PGSQL)
XRUN_DEPENDS+=    rubygem-pg>=0:${PORTSDIR}/databases/rubygem-pg
X.endif
X
X.if defined(WITH_MYSQL)
XRUN_DEPENDS+=    ruby-mysql>=0:${PORTSDIR}/databases/ruby-mysql
X.endif
X
X.include <bsd.port.mk>
46ecf18c564e445d214043f5bead61e7
echo x - rubygem-rubyrep/distinfo
sed 's/^X//' >rubygem-rubyrep/distinfo << '3d55eea23ef1fbf902369e1d453c30d0'
XSHA256 (rubygem/rubyrep-1.2.0.gem) = 35348b04b3bc5babac1f8350caa9458ccfe33a16ec4bdbaa9eb9f94fee0c04d4
XSIZE (rubygem/rubyrep-1.2.0.gem) = 142848
3d55eea23ef1fbf902369e1d453c30d0
echo c - rubygem-rubyrep/files
mkdir -p rubygem-rubyrep/files > /dev/null 2>&1
echo x - rubygem-rubyrep/files/rubyrep.in
sed 's/^X//' >rubygem-rubyrep/files/rubyrep.in << '110723b6d54837e8284ff6db1d1cee9e'
X#!/bin/sh
X
X# PROVIDE: rubyrep
X# REQUIRE: NETWORKING SERVERS
X# KEYWORD: shutdown
X
X# Add the following line to /etc/rc.conf to enable `rubyrep':
X#rubyrep_enable="YES"
X# and be sure to configure (at least)
X# %%PREFIX%%/etc/rubyrep/rubyrep.conf
X#
X# To replicate more than one database, change
X#rubyrep_multi="NO"
X# to "YES". A rubyrep process will be started for each file with
X# .conf suffix in $rubyrep_config_dir.
X#
X# Additional options:
X#
X#rubyrep_stdout_log="/var/log/rubyrep.fifo"
X#rubyrep_stderr_log="/var/log/rubyrep_err.fifo"
X#rubyrep_fifo_logs="YES"
X# Specify log files for stdout and stderr. Defaults to using fifos;
X# actual log file will have the extension .log. Additional PID files 
X# will be created for each of the processes used to tap the fifos; 
X# these can be used in newsyslog.conf(5) to automate log rotation.
X#
X#rubyrep_config="%%PREFIX%%/etc/rubyrep.conf"
X# Specify full path to default rubyrep configuration file.
X# NOTE: Ignored if $rubyrep_multi is set to "YES"!
X#
X#rubyrep_config_dir="%%PREFIX%%/etc/rubyrep"
X# Specify directory containing config files for rubyrep. Used
X# by $rubyrep_multi, ignored if $rubyrep_multi="NO" (the default).
X#
X#rubyrep_command="replicate"
X# Specify the command to pass to rubyrep. Usually you'll want to
X# replicate (the default), but it is also possible to specify "proxy",
X# "scan" or "sync". Note: This option applies to all databases if
X# $rubyrep_multi="YES"!
X#
X#rubyrep_command_flags=""
X# Specify options to pass to the $rubyrep_command above. For other
X# operating modes than "replicate" this may be necessary, especially
X# if you want useful log output! Run
X#   %%prefix%%/bin/rubyrep <command> --help
X# for further information.
X
Xrubyrep_enable="${rubyrep_enable:-"NO"}"
Xrubyrep_multi="${rubyrep_multi:-"NO"}"
Xrubyrep_command="${rubyrep_command:-"replicate"}"
Xrubyrep_command_flags="${rubyrep_command_flags:-""}"
Xrubyrep_config="${rubyrep_config:-"%%PREFIX%%/etc/rubyrep.conf"}"
Xrubyrep_config_dir="${rubyrep_config_dir:-"%%PREFIX%%/etc/rubyrep"}"
Xrubyrep_user="${rubyrep_user:-"daemon"}"
Xrubyrep_stdout_log="${rubyrep_stdout_log:-"/var/log/rubyrep.fifo"}"
Xrubyrep_stderr_log="${rubyrep_stderr_log:-"/var/log/rubyrep_err.fifo"}"
Xrubyrep_fifo_logs="YES"
X
X. /etc/rc.subr
X
Xcheckfifo() {
X        # Check and create if necessary fifo special files for logging
X        for f in $stdout_log $stderr_log ; do
X                flog_fifo=$f
X                if [ ! -p "$flog_fifo" ] ; then
X                        mkfifo $flog_fifo ; chown ${rubyrep_user} $flog_fifo
X                fi
X        done
X}
X
Xpid_touch () {
X        touch $pidfile
X        chown $rubyrep_user $pidfile
X}
X
Xrubyrep_prestart() {
X        pid_touch
X	if [ "$rubyrep_fifo_logs"="YES" ] ; then
X	        umask 027
X		checkfifo
X	        for f in $stdout_log $stderr_log ; do
X	                flog_fifo=$f
X	                flog_args=" -t "
X	                if [ "$cfgname" ] ; then
X				local out_log="`dirname $f`/`basename -s .fifo.$cfgname $flog_fifo`.$cfgname.log"
X				local out_pid="/var/run/`basename -s .fifo.$cfgname $flog_fifo`.$cfgname.flog.pid"
X			else
X				local out_log="`dirname $f`/`basename -s .fifo $flog_fifo`.log"
X				local out_pid="/var/run/`basename -s .fifo $flog_fifo`.flog.pid"
X			fi
X
X	                echo "Enabling logging for $flog_fifo ($out_log, $out_pid)..."
X	                echo "%%PREFIX%%/bin/flog $flog_args $out_log < $flog_fifo &"
X	                %%PREFIX%%/bin/flog $flog_args $out_log < $flog_fifo &
X	                echo $! > $out_pid
X	        done
X	fi
X}
X
Xrubyrep_stop() {
X	if [ -f "$pidfile" ] ; then
X		kill -9 `cat $pidfile`
X		rm $pidfile
X	else
X		echo "PID file not found ($pidfile)"
X	fi
X}
X
Xrubyrep_poststop() {
X	if [ "$rubyrep_fifo_logs"="YES" ] ; then
X	        for f in $stdout_log $stderr_log ; do
X	                flog_fifo=$f
X	                if [ "$cfgname" ] ; then
X				local out_pid="/var/run/`basename -s .fifo.$cfgname $flog_fifo`.$cfgname.flog.pid"
X			else
X				local out_pid="/var/run/`basename -s .fifo $flog_fifo`.flog.pid"
X			fi
X	                kill $out_pid >/dev/null 2>/dev/null
X	                rm $out_pid >/dev/null 2>/dev/null
X	        done
X	fi
X}
X
Xrubyrep_init() {
X	if [ "$rubyrep_multi" = "NO" ] ; then
X		cmdline="%%PREFIX%%/bin/rubyrep generate $rubyrep_config"
X		if [ "$1" = "init" -a -f "$rubyrep_config" ] ; then
X			echo "Skipping file $rubyrep_config (already exists)."
X		else
X			echo "Generating template file $rubyrep_config"
X			$cmdline
X		fi
X	else
X		echo 'Command not available when $rubyrep_multi="YES"'.
X		exit
X	fi
X}
X
Xname="rubyrep"
Xrcvar=`set_rcvar`
X
X# read configuration and set defaults
Xload_rc_config $name
X
Xextra_commands="init"
Xinit_cmd="${name}_init"
X
Xcommand="/usr/sbin/daemon"
Xstart_precmd="${name}_prestart"
Xstop_cmd="${name}_stop"
Xstop_postcmd="${name}_poststop"
Xrubyrep_command_flags="$rubyrep_command_flags"
X
Xif [ "$rubyrep_multi" = "NO" ] ; then
X	stdout_log=${rubyrep_stdout_log}
X	stderr_log=${rubyrep_stderr_log}
X	log_args=">> ${stdout_log} 2>> ${stderr_log} "
X	cmdline="%%PREFIX%%/bin/rubyrep $rubyrep_command $rubyrep_command_flags -c $rubyrep_config"
X	pidfile="/var/run/$name.pid"
X	flags="-p ${pidfile} ${cmdline} ${log_args}"
X	run_rc_command "$1"
Xelif [ "$rubyrep_multi" = "YES" ] ; then
X	[ ! -d "$rubyrep_config_dir" ] && mkdir -p "$rubyrep_config_dir"
X	for i in `ls $rubyrep_config_dir/*.conf` ; do
X		rubyrep_config=$i
X		cfgname=$(basename -s .conf $i)
X		stdout_log=${rubyrep_stdout_log}.$cfgname
X		stderr_log=${rubyrep_stderr_log}.$cfgname
X		log_args=">> ${stdout_log} 2>> ${stderr_log} "
X		cmdline="%%PREFIX%%/bin/rubyrep $rubyrep_command $rubyrep_command_flags -c $rubyrep_config"
X		pidfile="/var/run/${name}_${cfgname}.pid"
X		flags="-p ${pidfile} ${cmdline} ${log_args}"
X		run_rc_command "$1"
X	done
Xfi
110723b6d54837e8284ff6db1d1cee9e
echo x - rubygem-rubyrep/pkg-descr
sed 's/^X//' >rubygem-rubyrep/pkg-descr << '86a2eb1fc929445e37be1c2eda5a248c'
XMission:
XDevelopment of an open-source solution for asynchronous, master-master
Xreplication of relational databases that is
X
X- ridiculously easy to use
X- database independent
X
XCurrently supports PostgreSQL and MySQL.
X
XWWW: http://www.rubyrep.org/
86a2eb1fc929445e37be1c2eda5a248c
exit

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list