From 10177ad4b8d92196a130a5dddd943c049bde911c Mon Sep 17 00:00:00 2001 From: pierreozoux <pierre@ozoux.net> Date: Thu, 11 Feb 2016 10:02:31 +0000 Subject: [PATCH] Not used anymore --- hotfixes/2015-01-09-rename-repository.sh | 44 --------------- hotfixes/2015-01-12-merge-unit-files.sh | 54 ------------------ hotfixes/2015-01-12-remove-staticgit.sh | 28 ---------- .../2015-01-16-moves-backup-to-duplicity.sh | 29 ---------- hotfixes/2015-01-16-ultimate-DRY.sh | 55 ------------------ hotfixes/2015-02-20-release-0.4.sh | 26 --------- hotfixes/2015-04-26-upgrade-wordpress.sh | 11 ---- hotfixes/2015-11-22-upgrade-mysql.sh | 1 - scripts/create_vultr.sh | 56 ------------------- scripts/destroy_vultr.sh | 10 ---- scripts/install.sh | 36 ------------ scripts/start.sh | 41 -------------- scripts/stop.sh | 16 ------ 13 files changed, 407 deletions(-) delete mode 100644 hotfixes/2015-01-09-rename-repository.sh delete mode 100644 hotfixes/2015-01-12-merge-unit-files.sh delete mode 100644 hotfixes/2015-01-12-remove-staticgit.sh delete mode 100644 hotfixes/2015-01-16-moves-backup-to-duplicity.sh delete mode 100644 hotfixes/2015-01-16-ultimate-DRY.sh delete mode 100644 hotfixes/2015-02-20-release-0.4.sh delete mode 100644 hotfixes/2015-04-26-upgrade-wordpress.sh delete mode 100644 hotfixes/2015-11-22-upgrade-mysql.sh delete mode 100755 scripts/create_vultr.sh delete mode 100755 scripts/destroy_vultr.sh delete mode 100755 scripts/install.sh delete mode 100755 scripts/start.sh delete mode 100755 scripts/stop.sh diff --git a/hotfixes/2015-01-09-rename-repository.sh b/hotfixes/2015-01-09-rename-repository.sh deleted file mode 100644 index c39b9a4..0000000 --- a/hotfixes/2015-01-09-rename-repository.sh +++ /dev/null @@ -1,44 +0,0 @@ -START - -docker pull pierreozoux/haproxy -docker pull pierreozoux/confd -docker pull pierreozoux/email-forwarder -docker pull pierreozoux/nginx -docker pull pierreozoux/mysql -docker pull pierreozoux/wordpress -docker pull pierreozoux/known - -mv /data/indiehosters /data/indiehosters.old -git clone https://github.com/pierreozoux/IndiePaaS.git /data/indiehosters - -cp /data/indiehosters/unit-files/* /etc/systemd/system && systemctl daemon-reload - -systemctl disable postfix -systemctl disable haproxy-confd -systemctl enable email-forwarder -systemctl enable confd - -reboot - -STOP - -ROLLBACK START - -mv /data/indiehosters /data/indiehosters.new -mv /data/indiehosters.old /data/indiehosters -cp /data/indiehosters/unit-files/* /etc/systemd/system && systemctl daemon-reload - -systemctl enable postfix -systemctl enable haproxy-confd -systemctl disable email-forwarder -systemctl disable confd - -reboot -ROLLBACK STOP - -CLEAN START -rm /etc/systemd/system/postfix.service -rm /etc/systemd/system/haproxy-confd.service -rm -rf /data/indiehosters.old -CLEAN STOP - diff --git a/hotfixes/2015-01-12-merge-unit-files.sh b/hotfixes/2015-01-12-merge-unit-files.sh deleted file mode 100644 index edae716..0000000 --- a/hotfixes/2015-01-12-merge-unit-files.sh +++ /dev/null @@ -1,54 +0,0 @@ -domains=( domain1 domain2 ) - -# START -echo "APPLICATION=wordpress" > /tmp/wordpress_env -echo "VOLUME=/app/wp-content" >> /tmp/wordpress_env -echo "EMAIL=test@test.org" >> /tmp/wordpress_env -docker pull ibuildthecloud/systemd-docker - -for domain in "${domains[@]}" -do - cp /tmp/wordpress_env /data/domains/$domain/.env - systemctl stop wordpress@$domain - systemctl disable wordpress@$domain - mv /data/domains/$domain/wordpress/wp-content /data/domains/$domain/wordpress/data -done - -cd /data/indiehosters -git pull -cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload -docker pull pierreozoux/wordpress - -for domain in "${domains[@]}" -do - systemctl start lamp@$domain - systemctl enable lamp@$domain -done - -docker pull pierreozoux/known - -# put the right email in each folder - -# STOP - -# ROLLBACK START -cd /data/indiehosters -git checkout 2c71084d502c05be220dd2de00acfd0c333bc7ff -cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload -cd dockerfiles/services/wordpress/ -docker build -t pierreozoux/wordpress . - -for domain in "${domains[@]}" -do - mv /data/domains/$domain/wordpress/data /data/domains/$domain/wordpress/wp-content - systemctl start wordpress@$domain - systemctl enable wordpress@$domain -done -# ROLLBACK STOP - -# CLEAN START -rm /etc/systemd/system/static-* -rm /etc/systemd/system/wordpress* -rm /etc/systemd/system/known* -rm /etc/systemd/system/mysql-importer@.service -# CLEAN STOP diff --git a/hotfixes/2015-01-12-remove-staticgit.sh b/hotfixes/2015-01-12-remove-staticgit.sh deleted file mode 100644 index 2220415..0000000 --- a/hotfixes/2015-01-12-remove-staticgit.sh +++ /dev/null @@ -1,28 +0,0 @@ -domains=( domain1 domain2 ) - -# START -for domain in "${domains[@]}" -do - cp -R /data/runtime/domains/$domain/static-git /data/domains/$domain/static - systemctl stop static-git@$domain - systemctl start static@$domain - systemctl list-units | grep $domain | grep failed -done -# STOP - -# ROLLBACK START -for domain in "${domains[@]}" -do - systemctl stop static@$domain - systemctl start static-git@$domain -done -# ROLLBACK STOP - -# CLEAN START -for domain in "${domains[@]}" -do - systemctl disable static-git@$domain - systemctl enable static@$domain - rm -rf /data/domains/$domain/static-git -done -# CLEAN STOP diff --git a/hotfixes/2015-01-16-moves-backup-to-duplicity.sh b/hotfixes/2015-01-16-moves-backup-to-duplicity.sh deleted file mode 100644 index 56d4cfa..0000000 --- a/hotfixes/2015-01-16-moves-backup-to-duplicity.sh +++ /dev/null @@ -1,29 +0,0 @@ -# START -docker pull pierreozoux/duplicity - -gpg --gen-key -gpg --list-keys - -echo ENCRYPT_KEY="" >> /etc/environment -echo BACKUP_DESTINATION="backup@backup" >> /etc/environment - -cd /data/indiehosters -git pull -cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload - -for domain in "${domains[@]}" -do - systemctl start backup@$domain - systemctl status backup@$domain -done - -# STOP - -# CLEAN START -rm -rf /data/import -rm /data/BACKUP_DESTINATION -su backup -cd -mkdir old_backups -mv ./* old_backups -# CLEAN STOP diff --git a/hotfixes/2015-01-16-ultimate-DRY.sh b/hotfixes/2015-01-16-ultimate-DRY.sh deleted file mode 100644 index dc87a55..0000000 --- a/hotfixes/2015-01-16-ultimate-DRY.sh +++ /dev/null @@ -1,55 +0,0 @@ -static_domains=( domain1 domain2 ) -wordpress_domains=( domain1 domain2 ) - -# START -cd /data/indiehosters -git pull -cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload -docker pull pierreozoux/wordpress - -for domain in "${static_domains[@]}" -do - folder=/data/domains/${domain} - echo "EMAIL=test@test.org" > ${folder}/.env - echo "APPLICATION=nginx" >> ${folder}/.env - echo DOCKER_ARGUMENTS="-v ${folder}/static/www-content:/app" >> ${folder}/.env - systemctl restart static@$domain - systemctl status static@$domain - systemctl status web@$domain -done - -for domain in "${wordpress_domains[@]}" -do - folder=/data/domains/${domain} - echo "EMAIL=test@test.org" > ${folder}/.env - echo "APPLICATION=wordpress" >> ${folder}/.env - echo DOCKER_ARGUMENTS="--link mysql-${domain}:db \ --v /data/domains/${domain}/wordpress/data:/app/wp-content \ --v /data/domains/${domain}/wordpress/.htaccess:/app/.htaccess \ ---env-file /data/domains/${domain}/wordpress/.env" >> ${folder}/.env - systemctl restart lamp@$domain - systemctl status lamp@$domain - systemctl status web@$domain -done - -# STOP - -# ROLLBACK START -cd /data/indiehosters -git checkout 65d6486005e3d96e3ad9d5ab17f99d8910cc5e70 -cp /data/indiehosters/unit-files/* /etc/systemd/system && sudo systemctl daemon-reload -cd dockerfiles/services/wordpress/ -docker build -t pierreozoux/wordpress . - -for domain in "${wordpress_domains[@]}" -do - systemctl restart lamp@$domain -done -for domain in "${static_domains[@]}" -do - systemctl restart static@$domain -done -# ROLLBACK STOP - -# CLEAN START -# CLEAN STOP diff --git a/hotfixes/2015-02-20-release-0.4.sh b/hotfixes/2015-02-20-release-0.4.sh deleted file mode 100644 index 52108b4..0000000 --- a/hotfixes/2015-02-20-release-0.4.sh +++ /dev/null @@ -1,26 +0,0 @@ -START - -cd /data/indiehosters -git pull - -docker pull pierreozoux/rsyslog -docker pull pierreozoux/haproxy -docker pull pierreozoux/confd -docker pull pierreozoux/postfix -docker pull pierreozoux/nginx -docker pull pierreozoux/mysql -docker pull pierreozoux/wordpress -docker pull pierreozoux/known -docker pull pierreozoux/piwik -docker pull pierreozoux/owncloud - -systemctl enable rsyslog -systemctl start rsyslog -systemctl enable postfix -systemctl disable email-forwarder - -cp /data/indiehosters/unit-files/* /etc/systemd/system - -reboot - -STOP diff --git a/hotfixes/2015-04-26-upgrade-wordpress.sh b/hotfixes/2015-04-26-upgrade-wordpress.sh deleted file mode 100644 index 748230f..0000000 --- a/hotfixes/2015-04-26-upgrade-wordpress.sh +++ /dev/null @@ -1,11 +0,0 @@ -docker pull indiepaas/wordpress - -cd /data/domains -for domain in `ls .` -do - if cat $domain/.env|grep APPLICATION=wordpress - then - systemctl restart web@$domain - /opt/bin/docker-enter $domain wp --allow-root core update-db --path=/app - fi -done diff --git a/hotfixes/2015-11-22-upgrade-mysql.sh b/hotfixes/2015-11-22-upgrade-mysql.sh deleted file mode 100644 index c01d761..0000000 --- a/hotfixes/2015-11-22-upgrade-mysql.sh +++ /dev/null @@ -1 +0,0 @@ -systemctl list-units | grep failed | grep b-u | xargs systemctl status | grep -a2 'SHOW VARIABLES' | grep .service | cut -d'@' -f2 | cut -d'.' -f1,2 | sed "s/\.//g" | sed "s/-//g" | sed "s/$/_db_1/" | xargs -I % docker exec % bash -c 'mysql_upgrade -uroot -p$MYSQL_ROOT_PASSWORD' diff --git a/scripts/create_vultr.sh b/scripts/create_vultr.sh deleted file mode 100755 index 2fd9c5d..0000000 --- a/scripts/create_vultr.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -function valid_ip() -{ - local ip=$1 - local stat=1 - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - OIFS=$IFS - IFS='.' - ip=($ip) - IFS=$OIFS - [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \ - && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -LABEL=$1 -echo Label: $LABEL -echo API key: $VULTR_API_KEY - -VPSPLANID=${2:-29} - -SSHKEYID=`curl -s https://api.vultr.com/v1/sshkey/list\?api_key\=$VULTR_API_KEY | cut -d\" -f2` -echo Got your ssh key ID $SSHKEYID: - -SUBID=`curl -s -d "DCID=9&VPSPLANID=$VPSPLANID&OSID=179&label=$LABEL&SSHKEYID=$SSHKEYID" https://api.vultr.com/v1/server/create\?api_key\=$VULTR_API_KEY | cut -d\" -f4` -echo Got your SUB ID $SUBID: - -while : -do - IP=`curl -s https://api.vultr.com/v1/server/list_ipv4\?api_key\=$VULTR_API_KEY\&SUBID\=$SUBID | cut -d\" -f6` - if valid_ip $IP; then - break - else - echo "waiting to get an IP..." - sleep 5 - fi -done - -echo Writing $LABEL to /etc/hosts file, needs your root password: -sudo -- sh -c "echo $IP $LABEL \#$SUBID >> /etc/hosts" - -while : -do - ssh -o "StrictHostKeyChecking no" -o "BatchMode yes" root@$LABEL exit - if [ $? == 0 ]; - then - break - else - echo "waiting to be able to ssh..." - sleep 5 - fi -done - diff --git a/scripts/destroy_vultr.sh b/scripts/destroy_vultr.sh deleted file mode 100755 index 77808aa..0000000 --- a/scripts/destroy_vultr.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -eux - -LABEL=$1 -SUBID=`cat /etc/hosts | grep $LABEL | cut -d# -f2` - -echo Writing $LABEL to /etc/hosts file, needs your root password: -sudo sed -i "/$LABEL/ d" /etc/hosts - -curl -d SUBID=$SUBID https://api.vultr.com/v1/server/destroy\?api_key\=$VULTR_API_KEY - diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100755 index 84f53ca..0000000 --- a/scripts/install.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -eux - -/usr/bin/coreos-cloudinit --from-file=/var/lib/coreos-user_data - -docker pull indiepaas/haproxy -docker pull indiepaas/confd -docker pull indiepaas/duplicity -docker pull ibuildthecloud/systemd-docker - -# Create Directory structure -mkdir -p /data/domains -mkdir -p /data/runtime/haproxy/approved-certs -git clone https://github.com/indiepaas/IndiePaaS.git /data/indiehosters - -# Install unit-files -cp /data/indiehosters/unit-files/* /etc/systemd/system && systemctl daemon-reload - -systemctl enable confd -systemctl start confd -systemctl enable haproxy.path -systemctl start haproxy.path - -source /etc/environment -# Put the backup server in known_hosts files using RSA algo -# https://github.com/paramiko/paramiko/issues/243 -ssh -o "StrictHostKeyChecking no" -o "BatchMode yes" -o "HostKeyAlgorithms=ssh-rsa" $BACKUP_DESTINATION exit - -# Import backup encryption key -gpg --import /root/key.pub -TRUSTVAR=`gpg --fingerprint root | grep Key|cut -d= -f2|sed 's/ //g'` -TRUST_VALUE=':6:' -echo $TRUSTVAR$TRUST_VALUE | gpg --import-ownertrust - -curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose -chmod +x /opt/bin/docker-compose -update_engine_client -update diff --git a/scripts/start.sh b/scripts/start.sh deleted file mode 100755 index 87252d1..0000000 --- a/scripts/start.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -eux - -ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.. - -# check if there are already running servers -if [ "$(cat /etc/hosts | grep -q '.test' ; echo $?)" -eq 0 ]; then - echo "It looks like some servers are still running." - echo "please run ./script.stop.sh first if you want to create new servers." - exit 1 -fi - -# Create backup for tests - -$ROOT_DIR/scripts/create_vultr.sh backup.test - -scp $ROOT_DIR/configs/backup.config root@backup.test:/var/lib/coreos-user_data -ssh root@backup.test /usr/bin/coreos-cloudinit --from-file=/var/lib/coreos-user_data -BACKUP_IP=`cat /etc/hosts | grep backup.test | cut -d" " -f1` - -# Create server for tests - -$ROOT_DIR/scripts/create_vultr.sh server.test 30 -cat $ROOT_DIR/configs/server.config | sed s/##BACKUP_IP##/$BACKUP_IP/g > /tmp/server.config -scp /tmp/server.config root@server.test:/var/lib/coreos-user_data -scp $ROOT_DIR/scripts/install.sh root@server.test:/tmp/install.sh -ssh root@server.test /tmp/install.sh -IP=`cat /etc/hosts | grep server.test | cut -d" " -f1` - -# Adds ip to /etc/hosts file - -echo "We'll now modify your /etc/hosts to add the test application name" -applications=( `cat $ROOT_DIR/SUPPORTED_APPLICATIONS` ) -for application in "${applications[@]}" -do - echo Writing $application.test to /etc/hosts file, needs your root password: - sudo -- sh -c "echo $IP $application.test >> /etc/hosts" -done - -# cleaning -rm /tmp/server.config - diff --git a/scripts/stop.sh b/scripts/stop.sh deleted file mode 100755 index 11fc628..0000000 --- a/scripts/stop.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -eux - -ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.. - -$ROOT_DIR/scripts/destroy_vultr.sh backup.test -ssh-keygen -f ~/.ssh/known_hosts -R backup.test -$ROOT_DIR/scripts/destroy_vultr.sh server.test -ssh-keygen -f ~/.ssh/known_hosts -R server.test - -applications=( `cat $ROOT_DIR/SUPPORTED_APPLICATIONS` ) - -for application in "${applications[@]}" -do - sudo sed -i "/$application.test/ d" /etc/hosts -done - -- GitLab