Commit 13f2e6f7 authored by Rafael Monnerat's avatar Rafael Monnerat

obs/slapos: reorganise files and clean up.

parent 8f11bc50
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin
MAILTO=""
# Run "Installation/Destruction of Software Releases" and "Deploy/Start/Stop Partitions" once per minute
* * * * * root /opt/slapos/bin/slapos node software --maximal_delay=30 --verbose --logfile=/opt/slapos/log/slapos-node-software.log > /dev/null 2>&1
* * * * * root /opt/slapos/bin/slapos node instance --maximal_delay=20 --promise-timeout 20 --verbose --logfile=/opt/slapos/log/slapos-node-instance.log > /dev/null 2>&1
# Run "Destroy Partitions to be destroyed" once per hour
0 * * * * root /opt/slapos/bin/slapos node report --maximal_delay=3600 --verbose --logfile=/opt/slapos/log/slapos-node-report.log > /dev/null 2>&1
# Run "Check/add IPs and so on" once per hour
0 * * * * root /opt/slapos/bin/slapos node format >> /opt/slapos/log/slapos-node-format.log 2>&1
# Run "Booting" on every system start
@reboot root /opt/slapos/bin/slapos node boot >> /opt/slapos/log/slapos-node-format.log 2>&1
# Run "Collect" once a minute
* * * * * root /opt/slapos/bin/slapos node collect >> /opt/slapos/log/slapos-node-collect.log 2>&1
# Generated by SlapOS. Assumes that slapos is installed in default location.
/opt/slapos/log/slapos-node-software.log /opt/slapos/log/slapos-node-instance.log /opt/slapos/log/slapos-node-report.log {
nocompress
dateext
daily
rotate 14
missingok
notifempty
create 640 root root
sharedscripts
}
/opt/slapos/log/slapos-node-collect.log {
nocompress
dateext
daily
rotate 14
missingok
notifempty
create 640 root root
sharedscripts
}
/opt/slapos/log/slapos-node-format.log {
nocompress
dateext
daily
rotate 100
missingok
notifempty
create 640 root root
sharedscripts
}
/srv/slapgrid/*/.slapgrid/log/instance.log {
compress
dateext
daily
rotate 30
missingok
notifempty
sharedscripts
}
#!/bin/bash
VERSION=%VERSION%
RECIPE_VERSION=%RECIPE_VERSION%
BUILDOUT_URL=%BUILDOUT_URL%
VERSION=$1
RECIPE_VERSION=$3
BUILDOUT_URL=$2
TARGET_DIRECTORY=/opt/slapos
BUILD_ROOT_DIRECTORY="$(pwd)/build"
BUILD_DIRECTORY=$BUILD_ROOT_DIRECTORY$TARGET_DIRECTORY
BOOTSTRAP_URL='https://bootstrap.pypa.io/bootstrap-buildout.py'
#./configure --prefix=/opt/slapos/parts/<NAME>
......@@ -15,9 +14,7 @@ echo "Preparing source tarball (recipe version: $RECIPE_VERSION)"
echo " Build Directory: $BUILD_DIRECTORY "
echo " Buildroot Directory: $BUILD_ROOT_DIRECTORY "
mkdir -p $BUILD_DIRECTORY
mkdir $BUILD_DIRECTORY/extends-cache
mkdir $BUILD_DIRECTORY/download-cache
mkdir -p $BUILD_DIRECTORY/{extends-cache,download-cache}
set -e
......@@ -27,47 +24,34 @@ sed "s!\%BUILDOUT_URL\%!$BUILDOUT_URL!g;s/\%RECIPE_VERSION\%/$RECIPE_VERSION/g;
# Build first time to get download-cache and extends-cache ready
cd $BUILD_DIRECTORY
wget $BOOTSTRAP_URL --no-check-certificate -O bootstrap.py
(python -S bootstrap.py --buildout-version 2.5.1.post2 --setuptools-to-dir eggs -f http://www.nexedi.org/static/packages/source/ -f http://www.nexedi.org/static/packages/source/slapos.buildout/ && cat ./bin/buildout > /tmp/test && \
./bin/buildout) || (echo "Failed to run buildout, exiting." && exit 1)
cd $BUILD_ROOT_DIRECTORY/..
wget https://bootstrap.pypa.io/bootstrap-buildout.py --no-check-certificate -O bootstrap.py
(python -S bootstrap.py --buildout-version 2.5.1.post2 --setuptools-to-dir eggs -f http://www.nexedi.org/static/packages/source/ -f http://www.nexedi.org/static/packages/source/slapos.buildout/ && \
./bin/buildout) || (echo "Failed to run buildout, exiting.")
./bin/buildout || (echo "Failed to run buildout, exiting." && exit 1)
# remove all files from build keeping only caches
echo "Deleting unecessary files to reduce source tarball size"
# TODO: Figure out why there is no write permission even for
# the owner
chmod -R u+w $BUILD_DIRECTORY
# Buildout files
rm -rfv $BUILD_DIRECTORY/downloads
chmod -R u+w .
rm -fv $BUILD_DIRECTORY/bootstrap.py $BUILD_DIRECTORY/buildout.cfg \
$BUILD_DIRECTORY/.installed.cfg \
$BUILD_DIRECTORY/environment.*
cp -R eggs/slapos.rebootstrap* $BUILD_ROOT_DIRECTORY/..
rm -rfv $BUILD_DIRECTORY/parts/
rm -rfv $BUILD_DIRECTORY/eggs/
rm -rfv $BUILD_DIRECTORY/develop-eggs/
rm -rfv $BUILD_DIRECTORY/bin
rm -fv .installed.cfg environment.*
rm -rfv ./{downloads,parts,eggs,develop-eggs,bin,rebootstrap}
# Removing empty directories
find $BUILD_DIRECTORY -type d -empty -prune -exec rmdir '{}' ';'
# Prepare buildout
sed "s!\%BUILDOUT_URL\%!$BUILDOUT_URL!g;s/\%RECIPE_VERSION\%/$RECIPE_VERSION/g;s|\%PATCHES_DIRECTORY\%|$PATCHES_DIRECTORY|g;s|\%TARGET_DIRECTORY\%|$TARGET_DIRECTORY|g;s|\%BUILD_ROOT_DIRECTORY\%|$BUILD_ROOT_DIRECTORY|g;s|\%BUILD_DIRECTORY\%|$BUILD_DIRECTORY|g" $BUILD_ROOT_DIRECTORY/../buildout.cfg.in > $BUILD_DIRECTORY/buildout.cfg
find . -type d -empty -prune -exec rmdir '{}' ';'
cd $BUILD_DIRECTORY && \
wget $BOOTSTRAP_URL --no-check-certificate -O bootstrap.py && \
python -S bootstrap.py
python -S bootstrap.py --buildout-version 2.5.1.post2 --setuptools-to-dir eggs -f http://www.nexedi.org/static/packages/source/ -f http://www.nexedi.org/static/packages/source/slapos.buildout/
cp -R $BUILD_ROOT_DIRECTORY/../slapos.rebootstrap* eggs
# Removing Python byte-compiled files (as it will be done upon
# package installation) and static libraries
find $BUILD_DIRECTORY -regextype posix-extended -type f \
find . -regextype posix-extended -type f \
-iregex '.*/*\.(py[co]|[l]?a|exe|bat)$$' -exec rm -fv '{}' ';'
......@@ -3,20 +3,13 @@
# Edit for release
VERSION=1.3.15
# Edit for release
RECIPE_VERSION=1.0.20
RECIPE_VERSION=1.0.32
# Edit for release
RELEASE=4
GITHASH=81f31e29f0aeaef521fe827f43b767d82440bad7
RELEASE=7
CURRENT_DIRECTORY="$(pwd)"
# Define URL to compile
BUILDOUT_URL=http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-$RECIPE_VERSION:/component/slapos/buildout.cfg
OBS_DIRECTORY=$CURRENT_DIRECTORY/home:VIFIBnexedi/SlapOS-Node
# Development Section [Uncomment for use]
# Development Section
OBS_DIRECTORY=$CURRENT_DIRECTORY/home:VIFIBnexedi:branches:home:VIFIBnexedi/SlapOS-Node
BUILDOUT_URL=http://git.erp5.org/gitweb/slapos.git/blob_plain/$GITHASH:/component/slapos/buildout.cfg
VERSION_REGEX="s!\%BUILDOUT_URL\%!$BUILDOUT_URL!g;s/\%RECIPE_VERSION\%/$RECIPE_VERSION/g;s/\%VERSION\%/$VERSION/g;s/\%RELEASE\%/$RELEASE/g"
TEMPLATES_DIRECTORY=$CURRENT_DIRECTORY/templates
......@@ -32,15 +25,16 @@ function prepare_template_files
mkdir -p $CURRENT_DIRECTORY/$SLAPOS_DIRECTORY
cp -rf $CURRENT_DIRECTORY/$SLAPOS_ORGINAL_DIRECTORY/* $CURRENT_DIRECTORY/$SLAPOS_DIRECTORY
rm -rf $CURRENT_DIRECTORY/$SLAPOS_DIRECTORY/slapos/slapos_repository
cp -R slapos_repository $CURRENT_DIRECTORY/$SLAPOS_DIRECTORY/slapos/
sed $VERSION_REGEX $TEMPLATES_DIRECTORY/Makefile.in > $CURRENT_DIRECTORY/$SLAPOS_DIRECTORY/slapos/Makefile
sed $VERSION_REGEX $TEMPLATES_DIRECTORY/offline.sh.in > $CURRENT_DIRECTORY/$SLAPOS_DIRECTORY/slapos/offline.sh
}
function prepare_download_cache
{
cd $CURRENT_DIRECTORY/$SLAPOS_DIRECTORY/slapos/
rm -rf build/
bash offline.sh || (echo "Impossible to build SlapOS, exiting." && exit 1)
bash $CURRENT_DIRECTORY/prepare_download_cache.sh $VERSION $BUILDOUT_URL $RECIPE_VERSION || (echo "Impossible to build SlapOS, exiting." && exit 1)
# Go back to starting point
cd $CURRENT_DIRECTORY
}
......@@ -54,16 +48,15 @@ function prepare_deb_packaging
{
# Add entry to changelog
cd $TEMPLATES_DIRECTORY/debian
cd $CURRENT_DIRECTORY/debian
dch -pm -v $VERSION+$RECIPE_VERSION+$RELEASE --check-dirname-level=0 "New version of slapos ($VERSION+$RECIPE_VERSION+$RELEASE)"
# Add cron and logrotate files
cp $CURRENT_DIRECTORY/$SLAPOS_ORGINAL_DIRECTORY/template/slapos-node.cron.d $TEMPLATES_DIRECTORY/debian/cron.d
cp $CURRENT_DIRECTORY/$SLAPOS_ORGINAL_DIRECTORY/template/slapos-node.logrotate $TEMPLATES_DIRECTORY/debian/slapos-node.logrotate
cd $TEMPLATES_DIRECTORY
cp $CURRENT_DIRECTORY/$SLAPOS_ORGINAL_DIRECTORY/template/slapos-node.cron.d $CURRENT_DIRECTORY/debian/cron.d
cp $CURRENT_DIRECTORY/$SLAPOS_ORGINAL_DIRECTORY/template/slapos-node.logrotate $CURRENT_DIRECTORY/debian/slapos-node.logrotate
cd $CURRENT_DIRECTORY
tar -czf debian.tar.gz debian
cd $OBS_DIRECTORY
cp $TEMPLATES_DIRECTORY/debian.tar.gz .
cp $CURRENT_DIRECTORY/debian.tar.gz $OBS_DIRECTORY
}
function obs_upload
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment