Gitlab is now using as it's primary address. Please update your bookmarks. FAQ.

Commit e7689466 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

backup script and template for installation script

#! /bin/bash
rm -rdf $BACKUP_DIR
mkdir -p $BACKUP_DIR/tmp
cp $CATALINA_HOME/webapps/*.war "$BACKUP_DIR/tmp" 2>/dev/null
if [ -d "$CATALINA_HOME/webapps/map_images" ]
cd $CATALINA_HOME/webapps/
tar -zcf $BACKUP_DIR/tmp/map_images.tar.gz map_images
export PGPASSWORD="123qweasdzxc"
pg_dump -U map_viewer map_viewer | gzip > "$BACKUP_DIR/tmp/map_viewer_db.gz"
cd $BACKUP_DIR/tmp
tar -zcf $BACKUP_FILE *
chown backup $BACKUP_FILE
cd /
rm -rf $BACKUP_DIR/tmp
#install minerva
echo "deb precise main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb stable main" | tee /etc/apt/sources.list.d/repo-r3lab.list
sudo apt-key adv --keyserver hkp:// --recv-keys EEA14886
sudo apt-key adv --keyserver hkp:// --recv-keys 0xcb185f4e31872412
apt-get update
apt-get install -y mc apache2 php libapache2-mod-php7.0 minerva
#change tomcat memory limit to 4GB
sed -i 's/-Xmx128m/-Xmx4192m/g' /etc/default/tomcat7
#setup proxy in apache to go to tomcat7
sed -i '2i\ ProxyPass /minerva http://localhost:8080/minerva\n ProxyPass /map_images http://localhost:8080/map_images\n ProxyPassReverse /minerva http://localhost:8080/minerva\n ProxyPassReverse /map_images http://localhost:8080/map_images\n' /etc/apache2/sites-enabled/000-default.conf
a2enmod proxy
a2enmod proxy_http
service apache2 restart
#create SSL certificat
sudo mkdir /etc/apache2/ssl
sudo openssl genrsa -des3 -passout pass:x -out /etc/apache2/ssl/server.pass.key 2048
sudo openssl rsa -passin pass:x -in /etc/apache2/ssl/server.pass.key -out /etc/apache2/ssl/server.key
sudo rm /etc/apache2/ssl/server.pass.key
sudo openssl req -new -key /etc/apache2/ssl/server.key -out /etc/apache2/ssl/server.csr -subj "/C=LU/ST=Luxembourg/L=Esch-sur-Alzette/O=UL/OU=LCSB/"
sudo openssl x509 -req -days 365 -in /etc/apache2/ssl/server.csr -signkey /etc/apache2/ssl/server.key -out /etc/apache2/ssl/server.crt
#set the SSL certificate in apache2
sudo sed -i.bak -- 's/\/etc\/ssl\/certs\/ssl-cert-snakeoil\.pem/\/etc\/apache2\/ssl\/server.crt/g' /etc/apache2/sites-available/default-ssl.conf
sudo sed -i.bak -- 's/\/etc\/ssl\/private\/ssl-cert-snakeoil\.key/\/etc\/apache2\/ssl\/server.key/g' /etc/apache2/sites-available/default-ssl.conf
sudo a2ensite default-ssl
sudo a2enmod ssl
sudo sed -i.bak '/ProxyPass/d' /etc/apache2/sites-enabled/default-ssl.conf
sudo sed -i '3i\ ProxyPass / http://localhost/\n ProxyPassReverse / http://localhost/\n' /etc/apache2/sites-enabled/default-ssl.conf
sudo service apache2 restart
#turn on backups
ln minerva-scripts/ /etc/cron.daily/minerva
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