Cleanup scripts

This commit is contained in:
Girish Ramakrishnan
2014-10-20 16:52:33 -07:00
parent 9f34ecdfa0
commit 9da9312086
4 changed files with 25 additions and 16 deletions
+10 -10
View File
@@ -10,7 +10,7 @@ echo "Box bootstrapping"
USER=yellowtent
SRCDIR=/home/$USER/box
BACKUP_DIR=/home/$USER/data
DATA_DIR=/home/$USER/data
# we get the appstore origin from the caller which is baked into the image
APP_SERVER_URL=$1
@@ -54,23 +54,23 @@ EOF
echo "==== Setup nginx ===="
cd $SRCDIR
mkdir -p $BACKUP_DIR/nginx/applications
cp nginx/nginx.conf $BACKUP_DIR/nginx/nginx.conf
cp nginx/mime.types $BACKUP_DIR/nginx/mime.types
cp nginx/certificates.conf $BACKUP_DIR/nginx/certificates.conf
touch $BACKUP_DIR/nginx/naked_domain.conf
mkdir -p $DATA_DIR/nginx/applications
cp nginx/nginx.conf $DATA_DIR/nginx/nginx.conf
cp nginx/mime.types $DATA_DIR/nginx/mime.types
cp nginx/certificates.conf $DATA_DIR/nginx/certificates.conf
touch $DATA_DIR/nginx/naked_domain.conf
FQDN=`hostname -f`
sed -e "s/##ADMIN_FQDN##/admin-$FQDN/" -e "s|##SRCDIR##|$SRCDIR|" nginx/admin.conf_template > $BACKUP_DIR/nginx/applications/admin.conf
sed -e "s/##ADMIN_FQDN##/admin-$FQDN/" -e "s|##SRCDIR##|$SRCDIR|" nginx/admin.conf_template > $DATA_DIR/nginx/applications/admin.conf
echo "==== Setup ssl certs ===="
# The nginx cert dir is excluded from backup in backup.sh
CERTIFICATE_DIR=$BACKUP_DIR/nginx/cert
CERTIFICATE_DIR=$DATA_DIR/nginx/cert
mkdir -p $CERTIFICATE_DIR
cd $CERTIFICATE_DIR
/bin/bash $SRCDIR/scripts/generate_certificate.sh US California 'San Francisco' CloudronInc Cloudron `hostname -f` cert@cloudron.io .
tar xf cert.tar
chown $USER:$USER -R $BACKUP_DIR
chown $USER:$USER -R $DATA_DIR
echo "=== Setup collectd and graphite ==="
$SRCDIR/scripts/bootstrap/setup_collectd.sh
@@ -87,7 +87,7 @@ cp $SRCDIR/supervisor/supervisord.conf /etc/supervisor/
echo "Writing box supervisor config..."
cat > /etc/supervisor/conf.d/nginx.conf <<EOF
[program:nginx]
command=nginx -c $BACKUP_DIR/nginx/nginx.conf -p /var/log/nginx/
command=nginx -c $DATA_DIR/nginx/nginx.conf -p /var/log/nginx/
autostart=true
autorestart=true
redirect_stderr=true
+5 -1
View File
@@ -2,6 +2,11 @@
set -e
USER=yellowtent
SRCDIR=/home/$USER/box
DATA_DIR=/home/$USER/data
COLLECTD_DIR="$DATA_DIR/collectd/"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
GRAPHITE_DIR="/home/yellowtent/data/graphite"
@@ -14,7 +19,6 @@ docker run -d --name="graphite" \
-v $GRAPHITE_DIR:/app/data girish/graphite:0.2
# collectd
COLLECTD_DIR="/home/yellowtent/data/collectd/"
mkdir -p $COLLECTD_DIR/collectd.conf.d
cp -r $SCRIPT_DIR/collectd/collectd.conf $COLLECTD_DIR/collectd.conf
rm -rf /etc/collectd
+6 -2
View File
@@ -2,9 +2,13 @@
set -e
CLOUDRON_CONF="/home/yellowtent/data/cloudron.conf"
USER=yellowtent
SRCDIR=/home/$USER/box
DATA_DIR=/home/$USER/data
HARAKA_DIR="$DATA_DIR/haraka"
CLOUDRON_CONF="$DATA_DIR/cloudron.conf"
DOMAIN_NAME=`hostname -f`
HARAKA_DIR="/home/yellowtent/data/haraka"
CONTAINER_ID=$(docker run -d --name="haraka" --cap-add="NET_ADMIN"\
-p 127.0.0.1:25:25 \
+4 -3
View File
@@ -2,10 +2,11 @@
set -v
USER_HOME=/home/yellowtent
APPDATA=$USER_HOME/data/appdata
SRCDIR=$USER_HOME/box
USER=yellowtent
USER_HOME="/home/$USER"
DATA_DIR="$USER_HOME/data"
APPDATA=$DATA_DIR/appdata
SRCDIR=$USER_HOME/box
APPSTORE_URL=$1
BOX_REVISION=$2