Skip to content

Commit

Permalink
Merge pull request #46 from clustervision/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
hicham-a committed Aug 11, 2016
2 parents bb5efdc + 018692f commit e99eab6
Show file tree
Hide file tree
Showing 40 changed files with 294 additions and 114 deletions.
2 changes: 1 addition & 1 deletion configuration/common_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function store_variable_backend {
return 1
else
# delete the line if it exists, and append the new value
[[ -w "$1" ]] && sed -i '/^'"$2"'=/d' "$1"
[[ -w "$1" ]] && sed -i --follow-symlinks '/^'"$2"'=/d' "$1"
line="${SH_RO_VAR+declare -r }${2}=${SYSTEM_VAR-\"}${3}${SYSTEM_VAR-\"}"
append_line "$1" "$line"
fi
Expand Down
2 changes: 1 addition & 1 deletion configuration/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function run_one_script {
[[ -r /etc/trinity.sh ]] && source /etc/trinity.sh
source \"$POST_CONFIG\"
[[ -r /etc/trinity.sh ]] && source /etc/trinity.sh
[[ -r \"$TRIX_SHADOW\" ]] && source \"$TRIX_SHADOW\"
[[ -r \"\$TRIX_SHADOW\" ]] && source \"\$TRIX_SHADOW\"
source \"$POST_SCRIPT\" "

ret=$?
Expand Down
4 changes: 4 additions & 0 deletions configuration/controller.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ POSTLIST=( \
openldap \
sssd \
bind \
mariadb \
slurm-pre \
slurm \
applications \
)


Expand Down
2 changes: 0 additions & 2 deletions configuration/controller/additional-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

# Setup for the additional package list

source "$POST_CONFIG"

systemctl enable haveged
flag_is_unset CHROOT_INSTALL && systemctl restart haveged || true

2 changes: 0 additions & 2 deletions configuration/controller/additional-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# of pulling them off of the internet, but again, there is no guarantee that the
# controller has connectivity *during install*. It may have it later on.

source "$POST_CONFIG"

ret=0

# Key files
Expand Down
9 changes: 9 additions & 0 deletions configuration/controller/applications.pkglist
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
infinipath-psm
numactl
librdmacm
libpciaccess
libibverbs
libfabric
libpcap
libtool-ltdl
libgfortran
36 changes: 36 additions & 0 deletions configuration/controller/applications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

#
# Script to add provided application modules to the system
# All modulefiles are located in separate directories usign the format
#
# POST_FILEDIR/GROUP/module/version/modulefile
#
# The script will copy all available modules to their appropriate location
#
# Modulefiles should assume that the application will be installed in:
#
# {{ prefix }}/applications/module/version
#
# This script will replace {{ prefix }} with the correct value
#

for GROUP in 'CV-standard' 'CV-advanced' 'local'; do

echo_info "Adding $GROUP module files to the system"

for MOD in ${POST_FILEDIR}/${GROUP}/*; do

[[ -e "$MOD" ]] || continue;

MODULE=$(basename "$MOD");
VERSION=$(ls "${POST_FILEDIR}/${GROUP}/${MODULE}");
echo_info "Adding ${MODULE}/${VERSION} to $GROUP";

cp -r "$MOD" "${TRIX_SHARED}/modulefiles/${GROUP}/"
sed -i -e "s,{{ prefix }},$TRIX_SHARED," "${TRIX_SHARED}/modulefiles/${GROUP}/${MODULE}/${VERSION}/modulefile"

done

done

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#%Module1.0
#
# @name: openmpi
# @version: 2.0.0


# Customize the output of `module help` command
# ---------------------------------------------
proc ModulesHelp { } {
puts stderr "\tAdds openmpi to your environment variables"
puts stderr "\t\t\$PATH, \$MANPATH"
}

# Customize the output of `module whatis` command
# -----------------------------------------------
module-whatis "loads the [module-info name] environment"

# Define internal modulefile variables (Tcl script use only)
# ----------------------------------------------------------
set name openmpi
set version 2.0.0
set prefix {{ prefix }}/applications/${name}/${version}

# Check if the path exists before modifying environment
# -----------------------------------------------------
if {![file exists $prefix]} {
puts stderr "\t[module-info name] Load Error: $prefix does not exist"
break
exit 1
}

# Update common variables in the environment
# ------------------------------------------
prepend-path PATH $prefix/bin
prepend-path LD_LIBRARY_PATH $prefix/lib
prepend-path LIBRARY_PATH $prefix/lib
prepend-path INCLUDE $prefix/include
prepend-path C_INCLUDE_PATH $prefix/include
prepend-path MANPATH $prefix/share/man

setenv OPAL_PREFIX $prefix

4 changes: 0 additions & 4 deletions configuration/controller/chrony.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@

# Chrony (time server) configuration

source "$POST_CONFIG"
source /etc/trinity.sh


display_var CHRONY_{UPSTREAM,SERVER} TRIX_CTRL{1,2}_HOSTNAME


Expand Down
3 changes: 0 additions & 3 deletions configuration/controller/drbd-master.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/bash


source "$POST_CONFIG"
source /etc/trinity.sh

function replace_template {
[ $# -gt 3 -o $# -lt 2 ] && echo "Wrong numger of argument in replace_template." && exit 1
if [ $# -eq 3 ]; then
Expand Down
4 changes: 0 additions & 4 deletions configuration/controller/environment-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

# Environment modules setup

source /etc/trinity.sh
source "$POST_CONFIG"


if flag_is_unset CHROOT_INSTALL ; then

echo_info 'Creating the shared modules directories'
Expand Down
3 changes: 0 additions & 3 deletions configuration/controller/firewalld.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

# Basic configuration of firewalld, without TUI

source "$POST_CONFIG"


# So we want firewalld. Enable and start it now, otherwise lots of commands will
# fail later.

Expand Down
5 changes: 0 additions & 5 deletions configuration/controller/hosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
# because of multiple interfaces?). We have to do it ourselves or nothing will
# resolve and lots o' stuff will break.

source "$POST_CONFIG"


#---------------------------------------

# Display the variables that we will need

display_var HA CTRL{1,2,}_{HOSTNAME,IP} HOSTNAME
Expand Down
3 changes: 0 additions & 3 deletions configuration/controller/local-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
# This is used for sites where there is no internet access, in which case all
# packages dependencies are needed, as well as for custom-built packages.

source /etc/trinity.sh
source "$POST_CONFIG"


echo_info 'Copying packages and setting up the local repositories'

Expand Down
28 changes: 24 additions & 4 deletions configuration/controller/luna-slave.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash
set -e

source "$POST_CONFIG"
source /etc/trinity.sh
source "$TRIX_SHADOW"

echo_info "Check config variables available."

echo "LUNA_MONGO_PASS=${LUNA_MONGO_PASS:?"Should be defined"}"
Expand Down Expand Up @@ -55,10 +51,19 @@ sed -e 's/^\(\W\+disable\W\+\=\W\)yes/\1no/g' -i /etc/xinetd.d/tftp
sed -e 's|^\(\W\+server_args\W\+\=\W-s\W\)/var/lib/tftpboot|\1/tftpboot|g' -i /etc/xinetd.d/tftp
[ -f /tftpboot/luna_undionly.kpxe ] || cp /usr/share/ipxe/undionly.kpxe /tftpboot/luna_undionly.kpxe

echo_info "Setup DNS."

/usr/bin/cat >>/etc/named.conf <<EOF
include "/etc/named.luna.zones";
EOF

/usr/bin/sed -i -e 's/\(.*listen-on port 53 { \).*\( };\)/\1any;\2/' /etc/named.conf

echo_info "Create ssh keys."

[ -f /root/.ssh/id_rsa ] || ssh-keygen -t rsa -f /root/.ssh/id_rsa -N ''

echo_info "Setup nginx."

if [ ! -f /etc/nginx/conf.d/nginx-luna.conf ]; then
# copy config files
Expand All @@ -68,6 +73,21 @@ if [ ! -f /etc/nginx/conf.d/nginx-luna.conf ]; then
cp ${POST_FILEDIR}/nginx-luna.conf /etc/nginx/conf.d/
fi

echo_info "Configure firewalld."

if /usr/bin/firewall-cmd --state >/dev/null ; then
/usr/bin/firewall-cmd --permanent --add-port=27017/tcp
/usr/bin/firewall-cmd --permanent --add-port=7050/tcp
/usr/bin/firewall-cmd --permanent --add-port=53/tcp
/usr/bin/firewall-cmd --permanent --add-port=53/udp
/usr/bin/firewall-cmd --permanent --add-port=69/udp
/usr/bin/firewall-cmd --permanent --add-port=67/udp
/usr/bin/firewall-cmd --reload
else
echo_warn "Firewalld is not running. Ports should be should be open manually later on."
fi


echo_info "Start mongo."

systemctl start mongod
Expand Down
8 changes: 3 additions & 5 deletions configuration/controller/luna.pkglist
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# git
yum-utils
mongodb-server
python-pymongo
mongodb
nginx
python-tornado
ipxe-bootimgs
tftp-server
tftp xinetd
dhcp wget
tftp
xinetd
dhcp
rb_libtorrent-python
net-snmp-python
python-hostlist
vim
25 changes: 18 additions & 7 deletions configuration/controller/luna.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/bash
set -e

source "$POST_CONFIG"
source /etc/trinity.sh

function replace_template {
[ $# -gt 3 -o $# -lt 2 ] && echo "Wrong numger of argument in replace_template." && exit 1
if [ $# -eq 3 ]; then
Expand All @@ -23,7 +20,8 @@ echo_info "Check config variables available."

echo "LUNA_FRONTEND=${LUNA_FRONTEND?"Should be defined"}"
echo "LUNA_NETWORK=${LUNA_NETWORK?"Should be defined"}"
echo "LUNA_NETWORK_NAME=${LUNA_NETWORK_NAME:-cluster}"
LUNA_NETWORK_NAME=${LUNA_NETWORK_NAME:-cluster}
echo "LUNA_NETWORK_NAME=${LUNA_NETWORK_NAME}"
echo "LUNA_PREFIX=${LUNA_PREFIX?"Should be defined"}"

LUNA_NETMASK=`ipcalc -s -m ${LUNA_NETWORK}/${LUNA_PREFIX} | sed 's/.*=//'`
Expand All @@ -48,7 +46,7 @@ setenforce 0
echo_info "Unpack luna."

pushd /
[ -d /luna ] || tar -xzvf ${POST_FILEDIR}/luna-*.tgz
[ -d /luna ] || git clone https://github.com/dchirikov/luna
popd


Expand Down Expand Up @@ -90,10 +88,17 @@ sed -e 's/^\(\W\+disable\W\+\=\W\)yes/\1no/g' -i /etc/xinetd.d/tftp
sed -e 's|^\(\W\+server_args\W\+\=\W-s\W\)/var/lib/tftpboot|\1/tftpboot|g' -i /etc/xinetd.d/tftp
[ -f /tftpboot/luna_undionly.kpxe ] || cp /usr/share/ipxe/undionly.kpxe /tftpboot/luna_undionly.kpxe

echo_info "Setup DNS."

/usr/bin/cat >>/etc/named.conf <<EOF
include "/etc/named.luna.zones";
EOF

echo_info "Create ssh keys."

[ -f /root/.ssh/id_rsa ] || ssh-keygen -t rsa -f /root/.ssh/id_rsa -N ''

echo_info "Setup nginx."

if [ ! -f /etc/nginx/conf.d/nginx-luna.conf ]; then
# copy config files
Expand All @@ -110,7 +115,6 @@ systemctl enable mongod

echo_info "Configure mongo auth."


#sed -i -e "s/^[# \t]\+replSet.*/replSet = luna/" /etc/mongod.conf
#systemctl restart mongod
#do_mongo_req "rs.initiate();"
Expand All @@ -130,7 +134,6 @@ db.createUser({user: "luna", pwd: "${_LUNA_MONGO_PASS}", roles: [{role: "dbOwner
EOF
cat << EOF > /etc/luna.conf
[MongoDB]
replicaset=luna
server=localhost
authdb=luna
user=luna
Expand All @@ -148,10 +151,18 @@ echo_info "Reload systemd config."

systemctl daemon-reload

echo_info "Initialize luna."

/usr/sbin/luna cluster init
/usr/sbin/luna cluster change --frontend_address ${LUNA_FRONTEND}
/usr/sbin/luna network add -n ${LUNA_NETWORK_NAME} -N ${LUNA_NETWORK} -P ${LUNA_PREFIX}

echo_info "Configure DNS and DHCP."

/usr/sbin/luna cluster makedhcp -N ${LUNA_NETWORK_NAME} -s ${LUNA_DHCP_RANGE_START} -e ${LUNA_DHCP_RANGE_END}
/usr/sbin/luna cluster makedns

echo_info "Start services."

for service in xinetd nginx dhcpd lweb ltorrent; do
systemctl enable $service
Expand Down
Binary file removed configuration/controller/luna/luna-f396d35.tgz
Binary file not shown.
3 changes: 0 additions & 3 deletions configuration/controller/mariadb-master.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash
set -e
source "$POST_CONFIG"
source /etc/trinity.sh
source "$TRIX_SHADOW"

function do_sql_req {
if [ -f ~/.my.cnf ]; then
Expand Down
4 changes: 0 additions & 4 deletions configuration/controller/mariadb.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash
set -e

source "$POST_CONFIG"

source /etc/trinity.sh


echo_info "Starting MariaDB server."

Expand Down
3 changes: 0 additions & 3 deletions configuration/controller/mongodb-ha.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash
set -e
source "$POST_CONFIG"
source /etc/trinity.sh
source "$TRIX_SHADOW"

echo_info "Check if variables are defined."

Expand Down

0 comments on commit e99eab6

Please sign in to comment.