This repository has been archived by the owner on Sep 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
270 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
sed -i "s:sysconfdir = /etc:sysconfdir = $PREFIX/etc:g" Makefile | ||
sed -i "s:prefix = /usr/local:prefix = $PREFIX:g" Makefile | ||
|
||
make | ||
make install | ||
|
||
sed -i "s:/etc/disco/:$PREFIX/etc/disco/:g" \ | ||
$PREFIX/lib/python2.7/site-packages/disco/settings.py | ||
|
||
mkdir -p $PREFIX/var/disco | ||
cp $RECIPE_DIR/disco.bashrc $PREFIX/var/disco/.bashrc | ||
|
||
mkdir -p $PREFIX/etc/init.d | ||
cp $RECIPE_DIR/init.d $PREFIX/etc/init.d/disco | ||
cp $RECIPE_DIR/create-disco-user.sh $PREFIX/etc/disco/ | ||
|
||
sed -i "s:\$PREFIX:$PREFIX:g" \ | ||
$PREFIX/var/disco/.bashrc \ | ||
$PREFIX/etc/init.d/disco \ | ||
$PREFIX/etc/disco/create-disco-user.sh | ||
|
||
chmod +x $PREFIX/etc/init.d/disco \ | ||
$PREFIX/etc/disco/create-disco-user.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
RELSRV=$PREFIX/var/disco | ||
|
||
adduser --system --user-group --shell /bin/bash --home ${RELSRV} \ | ||
--no-create-home disco | ||
chown -R disco:disco ${RELSRV} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Created by Disco | ||
|
||
export PATH="$PREFIX/bin:$PATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
#!/bin/bash | ||
# | ||
# Disco This starts and stops the disco master node. | ||
# Runlevels 2, 3, 5 and start/kill 80 | ||
# | ||
# | ||
# chkconfig: 235 80 80 | ||
# | ||
# | ||
|
||
# Source function library. | ||
. /etc/init.d/functions | ||
|
||
BIN=$PREFIX/bin | ||
|
||
KEYGEN=/usr/bin/ssh-keygen | ||
KEYSCAN=/usr/bin/ssh-keyscan | ||
|
||
RSA_KEY=$PREFIX/var/disco/.ssh/id_rsa | ||
AUTHORIZED_KEYS=$PREFIX/var/disco/.ssh/authorized_keys | ||
|
||
SSHD_KEY=/etc/ssh/ssh_host_rsa_key.pub | ||
KNOWN_HOSTS=$PREFIX/var/disco/.ssh/known_hosts | ||
|
||
export PATH="$BIN:$PATH" | ||
|
||
[ -x ${BIN}/disco ] || exit 5 | ||
|
||
## Reuse the debian named logging functions | ||
log_success_msg() { | ||
echo -n $* | ||
echo_success | ||
echo | ||
} | ||
|
||
log_failure_msg() { | ||
echo -n $* | ||
echo_failure | ||
echo | ||
} | ||
|
||
log_daemon_msg() { | ||
echo -n $* | ||
echo_failure | ||
echo | ||
} | ||
|
||
# From sshd | ||
do_rsa_keygen() { | ||
if [ ! -s $RSA_KEY ]; then | ||
echo -n $"Generating SSH2 RSA host key: " | ||
rm -f $RSA_KEY | ||
if test ! -f $RSA_KEY && $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then | ||
chmod 600 $RSA_KEY | ||
chmod 644 $RSA_KEY.pub | ||
|
||
# Modify for Disco | ||
chown disco:disco $RSA_KEY | ||
chown disco:disco $RSA_KEY.pub | ||
|
||
# Setup Authorized key | ||
cp $RSA_KEY.pub $AUTHORIZED_KEYS | ||
chown disco:disco $AUTHORIZED_KEYS | ||
|
||
if [ -x /sbin/restorecon ]; then | ||
/sbin/restorecon $RSA_KEY.pub | ||
fi | ||
log_success_msg "" | ||
else | ||
log_failure_msg "" | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
do_known_hosts() { | ||
if [ ! -s $KNOWN_HOSTS ]; then | ||
echo -n $"Creating Known Hosts file: " | ||
# Setup known_hosts | ||
$KEYSCAN localhost > $KNOWN_HOSTS 2>/dev/null | ||
|
||
# Amazon requires hashed hostnames in KNOWN HOSTS | ||
$KEYGEN -H -f $KNOWN_HOSTS &>/dev/null | ||
rm $KNOWN_HOSTS.old | ||
|
||
chown disco:disco $KNOWN_HOSTS | ||
log_success_msg $"" | ||
fi | ||
} | ||
|
||
running() { | ||
runuser -s /bin/bash disco -c "${BIN}/disco status" | grep -q running | ||
errcode=$? | ||
return $errcode | ||
} | ||
|
||
start_server() { | ||
do_rsa_keygen | ||
do_known_hosts | ||
runuser -s /bin/bash disco -c "${BIN}/disco start" &>/dev/null | ||
errcode=$? | ||
return $errcode | ||
} | ||
|
||
stop_server() { | ||
runuser -s /bin/bash disco -c "${BIN}/disco stop" | ||
errcode=$? | ||
return $errcode | ||
} | ||
|
||
restart_server() { | ||
${BIN}/disco restart | ||
errcode=$? | ||
return $errcode | ||
} | ||
|
||
case "$1" in | ||
start) | ||
if running ; then | ||
log_success_msg "disco-master already running" | ||
exit 0 | ||
fi | ||
if start_server ; then | ||
log_success_msg "disco-master started" | ||
exit 0 | ||
else | ||
log_failure_msg "disco-master couldn't be started" | ||
exit 1 | ||
fi | ||
;; | ||
stop) | ||
if running ; then | ||
if stop_server ; then | ||
log_success_msg "Disco stopped" | ||
exit 0 | ||
else | ||
log_failure_msg "Couldn't stop Disco" | ||
exit 1 | ||
fi | ||
else | ||
log_daemon_msg "Disco is not running." | ||
exit 0 | ||
fi | ||
;; | ||
restart|force-reload) | ||
if restart_server ; then | ||
log_success_msg "Success" | ||
exit 0 | ||
else | ||
log_failure_msg "Failure" | ||
exit 1 | ||
fi | ||
;; | ||
status) | ||
if running ; then | ||
echo "disco-master running" | ||
exit 0 | ||
else | ||
echo "disco-master stopped" | ||
exit 3 | ||
fi | ||
;; | ||
*) | ||
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 | ||
exit 3 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package: | ||
name: disco | ||
version: 0.4.4 | ||
|
||
source: | ||
git_url: [email protected]:discoproject/disco.git | ||
git_tag: 0.4.4 | ||
patches: | ||
- prefix_erl.patch | ||
- no_listdir.patch | ||
|
||
requirements: | ||
build: | ||
- python | ||
- erlang | ||
run: | ||
- python | ||
- erlang | ||
|
||
about: | ||
home: http://discoproject.org/ | ||
license: BSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
diff --git bin/ddfscli.py bin/ddfscli.py | ||
index 3c3429a..1064af1 100755 | ||
--- bin/ddfscli.py | ||
+++ bin/ddfscli.py | ||
@@ -32,9 +32,6 @@ Run :command:`ddfs help` for information on using the command line utility. | ||
|
||
import fileinput, os, sys | ||
|
||
-if '.disco-home' in os.listdir('.'): | ||
- sys.path.append('lib') | ||
- | ||
from disco.cli import OptionParser, Program | ||
|
||
class DDFS(Program): | ||
diff --git bin/discocli.py bin/discocli.py | ||
index c191fe0..dd4e2fb 100755 | ||
--- bin/discocli.py | ||
+++ bin/discocli.py | ||
@@ -52,9 +52,6 @@ Would get the results for the last job with name containing ``WordCount``. | ||
|
||
import fileinput, os, sys | ||
|
||
-if '.disco-home' in os.listdir('.'): | ||
- sys.path.append('lib') | ||
- | ||
from disco.cli import OptionParser, Program | ||
|
||
class Disco(Program): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git lib/clx/server.py lib/clx/server.py | ||
index 6182301..1a78887 100644 | ||
--- lib/clx/server.py | ||
+++ lib/clx/server.py | ||
@@ -47,7 +47,11 @@ class Server(object): | ||
raise ServerError("%s already started" % self) | ||
if self.rotate_log: | ||
self.log_rotate() | ||
- process = subprocess.Popen(args or self.args, env=self.env, **kwargs) | ||
+ cmd = args or self.args | ||
+ if cmd and cmd[0] == 'erl': | ||
+ import sys | ||
+ cmd[0] = sys.prefix + '/lib/erlang/bin/erl' | ||
+ process = subprocess.Popen(cmd, env=self.env, **kwargs) | ||
if process.wait(): | ||
raise ServerError("Failed to start %s" % self) | ||
yield '%s started' % self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import disco |