From 74bf5d0d351b0df8b5671e81d17f4474285537bb Mon Sep 17 00:00:00 2001 From: Antoine Catton <acatton@tiolive.com> Date: Wed, 21 Sep 2011 16:12:40 +0200 Subject: [PATCH] Restore mariadb behaviour. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed commit of the following: commit 6f1be126c3be5e97db14393240529c432d3fec6d Merge: f96fc3f b92834f Author: Åukasz Nowak <luke@nexedi.com> Date: Wed Sep 21 16:11:28 2011 +0200 Merge branch 'master' into mariadb-restoration commit f96fc3f64ae973a115d4d0111734c9a21845ee3c Author: Antoine Catton <acatton@tiolive.com> Date: Wed Sep 21 15:28:04 2011 +0200 Back to the original mariadb software release and mysql recipe with mariadb-failover improvements kepts except the failover. commit 94d490bf17859901d8d744b8690af264f4f011eb Author: Antoine Catton <acatton@tiolive.com> Date: Wed Sep 21 10:20:53 2011 +0200 Revert to commmit 027183d9890c2b9d85363333a6362fd2ff8b9181 commit 2fae9cf4cb7ba255f5342d34a8ccf7a1daf695df Author: Antoine Catton <acatton@tiolive.com> Date: Wed Sep 21 09:56:18 2011 +0200 Revert MySQL recipe to de0f3a950cd0ac6504468b29f319093d5b3399e6 commit 84ba123757ccd0fc1ed89395dc77d395018fdd07 Author: Antoine Catton <acatton@tiolive.com> Date: Wed Sep 21 09:53:56 2011 +0200 Rename mysql recipe in lamp-failover commit 2b1aa06c47a7b012c564ab507c93a334cc49d27b Author: Antoine Catton <acatton@tiolive.com> Date: Wed Sep 21 09:51:17 2011 +0200 Revert mariadb software release to 399a0d40bc6aeedec955214e64d1d234e2f50b6c commit a6475d6e991c58e77ca59f9f88c88a158b5be76f Author: Antoine Catton <acatton@tiolive.com> Date: Wed Sep 21 09:50:45 2011 +0200 Rename mariadb software release to lamp-failover. commit 027183d9890c2b9d85363333a6362fd2ff8b9181 Merge: bb5b78c de7cb09 Author: Åukasz Nowak <luke@nexedi.com> Date: Tue Sep 20 18:04:28 2011 +0200 Merge branch 'master' into mariadb-failover commit bb5b78c3c8bdab99c98938d9735696d60bbe8209 Merge: ca2b0f7 7cc1f01 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Sep 20 17:13:13 2011 +0200 Merge branches 'master' and 'mariadb-failover' into mariadb-failover commit ca2b0f77ae858d9151a18ea9f9f53bf4cd033695 Merge: ccd0c38 1e59da9 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Sep 20 16:45:06 2011 +0200 Merge branch 'mariadb-backup' into mariadb-failover Conflicts: setup.py slapos/recipe/mysql/__init__.py software/mariadb/instance.cfg software/mariadb/software.cfg commit 1e59da9dd0b08a1dd764cc11f831ff860ff46a87 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Sep 20 16:40:43 2011 +0200 Fix md5sum of instance.cfg commit 19515a4598f25b1643aaf41b310d061469db77f4 Merge: e754c1a 9000b20 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Sep 20 16:39:40 2011 +0200 Merge branch 'webdav' into mariadb-backup commit e754c1a051ea5c93bc9dba05d700c95b721d2808 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Sep 20 14:55:36 2011 +0200 Minor: fix the url commit 8ff5bcada5c6939972190af22ef57f9ed15d485a Author: Antoine Catton <acatton@tiolive.com> Date: Tue Sep 20 14:50:12 2011 +0200 Fix the url of instance.cfg of davstorage commit 9000b20d35ab12b59233b1736de5416e915c6ff1 Merge: 576e95e a0ed7be Author: Antoine Catton <acatton@tiolive.com> Date: Tue Sep 20 14:46:38 2011 +0200 Merge commit 'slapos-0.44' into webdav Conflicts: slapos/recipe/davstorage/__init__.py software/davstorage/software.cfg commit b98a73dd15c0853f80792cc183b30282724b3503 Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 8 17:57:58 2011 +0200 Minor: mistake in the parameter order commit c6d6e6a19cb252f196987d053bece2edbabe60f6 Merge: afdfa59 facf9df Author: Åukasz Nowak <luke@nexedi.com> Date: Tue Sep 20 10:34:27 2011 +0200 Merge branch 'master' into mariadb-backup commit afdfa59bcfa2d7fcf179fbbc7c64aed9373e8a17 Author: Åukasz Nowak <luke@nexedi.com> Date: Mon Sep 19 19:10:24 2011 +0200 Pin versions. commit 8338f226b3e7de16e990d34ea2c5cb0037089bdc Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 18:54:04 2011 +0200 Linking python with made in slapos libxml commit 492add6218d90427ad16f47064cd7de9f3a441ce Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 18:47:55 2011 +0200 Add software.cfg url of davstorage commit fc897da0ec2c18212e3838fa6775e43a1133088b Merge: e55a243 9be05e3 Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 18:27:00 2011 +0200 Merge branch 'master' into mariadb-backup Conflicts: slapos/recipe/mysql/__init__.py software/davstorage/software.cfg commit e55a243673fdd5bccb281b070f0e97832bba696d Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 14:41:57 2011 +0200 Minor: removed unused variable "returncode" commit 5a863d2e034782e2f58bbab01a0eb57d581a0b30 Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 14:40:00 2011 +0200 Use subprocess.check_call instead of checking return code of subprocess.call() commit 91fc5e8d4893eec41cc651ef2510c4feaab85eee Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 14:33:24 2011 +0200 Minor: removing useless commented code in davstorage software.cfg commit 753fc3084429aefe9381f2e0f438c4303cadf6e4 Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 14:27:48 2011 +0200 Minor: removing rebootstrap of the software release Another new python for mariadb is useless. commit 62b3d3959834921005e7b23f1588644448e6d4d5 Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 14:23:52 2011 +0200 Partially revert 3728936e6a1b2728bcdefc70298bb4adb69a777e in order to clean the git history. commit 05a458a71311298b2620cebb3122e6a8fe54c622 Merge: 87f61f7 a33be31 Author: Åukasz Nowak <luke@nexedi.com> Date: Mon Sep 19 13:35:17 2011 +0200 Merge branch 'master' into mariadb-backup commit 87f61f793058b9a2e5584b31691c47bc720bcca8 Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 13:28:33 2011 +0200 Minor: removing trailing spaces commit 7bf410ecb9e3f1966c579a327ed4d5df80193046 Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 13:08:53 2011 +0200 Minor: Adding import-script.sh I forgot to commit commit 7435626070c300c4e4e579c632ccf4700dc7aab8 Merge: 0510486 13d6e1d Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 19 11:55:33 2011 +0200 Merge branch 'master' into mariadb-backup Conflicts: slapos/recipe/mysql/__init__.py commit ccd0c3813c74806c55329f8387e955bbaf51005c Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 12 16:32:03 2011 +0200 Adding backup restoration to mariadb software release commit 24740e670cc4e7ab4ec43c4a029b064ec49dcb2c Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 8 17:57:58 2011 +0200 Minor: mistake in the parameter order commit 05104863cd426d4977ceaed6d2509764dd46b4bd Merge: 1b43ef4 4299234 Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 8 17:24:44 2011 +0200 Merge branch 'master' into mariadb-backup commit fdbe06fd2dbe910932a3ee533b9f18572d7e25fb Merge: 9f61de0 4299234 Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 8 17:16:59 2011 +0200 Merge branch 'master' into mariadb-failover commit 1b43ef420bc23be6cec791b690ad38b1468cbcc2 Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 8 15:56:35 2011 +0200 Trim the branch to just add davstorage backup commit 9f61de06d0da2c42281703409b55e94005125d3c Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 8 15:37:43 2011 +0200 Switch MySQL Backup to duplicity with webdav remote server commit 2fa9ae925a4629424bd728ec059ea59e9c2a63be Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 8 15:34:40 2011 +0200 Minor: fix the buildout of duplicity to work commit 51e512e5ecfc9e23823e8ba02f168eb34ac7fca4 Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 8 14:11:07 2011 +0200 Adding duplicity software release commit 576e95e058209a1a4e3ce009ac5fb326bb23fd1f Author: Antoine Catton <acatton@tiolive.com> Date: Tue Sep 6 09:32:05 2011 +0200 Add versions line to davstorage software release commit 094abfd41ba87f340c52dfd540f09b8f5b2fbb2c Merge: f59c5c5 150c49e Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 5 14:04:03 2011 +0200 Merge branch 'webdav' into mariadb-failover commit 150c49e3cd12e3b8f935c864ccc292c082049289 Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 5 13:15:40 2011 +0200 Working webdav storage commit 159054aec04f13ed0e5687a8466bd4803a8c1350 Author: Antoine Catton <acatton@tiolive.com> Date: Fri Sep 2 17:25:08 2011 +0200 Link with the right dbm commit 7bd8c5ad00c53a7830dd45093656907978d26c21 Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 1 09:35:31 2011 +0200 Enable dav-fs module on apache compilation commit e1a4051a8753459690dbd685aecc956a8677d1ad Author: Antoine Catton <acatton@tiolive.com> Date: Mon Sep 5 13:15:40 2011 +0200 Working webdav storage commit 20769516181933b3e3ec6dcfb6f36c5c4ad0bc11 Author: Antoine Catton <acatton@tiolive.com> Date: Fri Sep 2 17:25:08 2011 +0200 Link with the right dbm commit 7d959f9b8618ff7d1a8f91e04629795ef393cc9f Author: Antoine Catton <acatton@tiolive.com> Date: Thu Sep 1 09:35:31 2011 +0200 Enable dav-fs module on apache compilation commit 0c699697dc5bb8181242fc7b8523f53d78a860e5 Author: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Wed Aug 31 08:04:24 2011 +0200 version up : apache httpd 2.2.20 including a fix for CVE-2011-3192. commit cedcfb49724fc794ce83a420f10d2d4fec241d20 Author: Antoine Catton <acatton@tiolive.com> Date: Wed Aug 31 17:40:35 2011 +0200 Adding webdav option on apache compilation commit f59c5c549360ac8d5e16b3c510305502a41880f6 Author: Antoine Catton <acatton@tiolive.com> Date: Wed Aug 31 15:13:11 2011 +0200 Adding pull_backup_server on mariadb commit 3728936e6a1b2728bcdefc70298bb4adb69a777e Author: Antoine Catton <acatton@tiolive.com> Date: Wed Aug 31 15:12:35 2011 +0200 Switch mariadb to dropbear commit dbe4efeda490d8f201d39ba1d1f2cac2e69c38f3 Author: Antoine Catton <acatton@tiolive.com> Date: Wed Aug 31 15:03:09 2011 +0200 Linking dropbear with slapos zlib commit f6c9b477a9ba4fd67ccc0b19e2a1a8adfa767b11 Merge: bb80ae9 1a85f89 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 30 14:05:24 2011 +0200 Merging from pull-backup-server branch commit bb80ae9bd341cfdf2663f7cff85b2a2cffc2cb32 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 30 13:58:41 2011 +0200 Switch from OpenSSH client to Dropbear client commit d0cf9dfc9f34f7ab3bc747018bcb47f10afa8170 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 30 13:57:21 2011 +0200 Minor: Dropbear buildout fine tuning commit 5f50ae5c79cce438ee0eabbede9590c797156dad Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 30 09:08:41 2011 +0200 Add ipv6 patch for dropbear Took here : <https://lists.openwrt.org/pipermail/openwrt-devel/2009-May/004299.html> commit 80a2e24a8c6c54bd04d22b1b96710faa1c354bc2 Author: Antoine Catton <acatton@tiolive.com> Date: Mon Aug 29 17:54:36 2011 +0200 Updating the pull_backup_server buildout commit 8736902307cde71ae6f95e257b3e89fef7d721db Author: Antoine Catton <acatton@tiolive.com> Date: Mon Aug 29 17:51:19 2011 +0200 Replacing openssh buildout by dropbear one. Adding my own dropbear patch which was submitted to dropbear developpers. commit 1a85f89df53a6c770371935f24448d5c12c1f75c Author: Antoine Catton <acatton@tiolive.com> Date: Thu Aug 25 11:54:11 2011 +0200 Minor: use internal writeFile function instead open(..., 'w') commit cc1be9293072f9b95772dcc666cbbc2bf77b6bf2 Author: Antoine Catton <acatton@tiolive.com> Date: Thu Aug 25 09:40:57 2011 +0200 Adding rdiff_backup installation and configuration commit 38882163cb12d965ba0f1e3c87de9775ffe11ed0 Author: Antoine Catton <acatton@tiolive.com> Date: Wed Aug 24 09:48:07 2011 +0200 Minor: adding ssh compression commit eb5bff2affcc6a4b6e5d332a2c59c9663839c6a0 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 17:35:57 2011 +0200 Minor: fix adding ssh_config template commit 07fcca2381cb9167779aa18434b0d8e1514d6403 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 17:32:24 2011 +0200 Minor: fix of error due to ssh_conf to self.ssh_conf renaming commit c3f7c4944e960b463166e000422888bec13556a0 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 16:47:32 2011 +0200 Adding ssh_config file generation commit 4c6ebe52eab924eca18df4950a2bce6f10513971 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 16:43:52 2011 +0200 Minor: adding consistency to known_hosts file creation commit c814412504d1b9682c180e40507a861ec125ebb9 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 16:40:50 2011 +0200 Minor: put the parameter dict reading at the begining commit 956db5d669d25bfbb0f0675a1d06d1c05a4056ad Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 16:39:09 2011 +0200 Minor: save sshd_conf options commit 2535efd9dc003474b31480b529a1ecf2b057e2c0 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 15:11:15 2011 +0200 Minor: adding template for known_hosts file commit 02f865391d3a95cbe87f7461696dec339ffe32e2 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 12:58:55 2011 +0200 Add known_hosts file generation commit 411052f4452c273674a6e3d5497807e6f6041948 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 12:57:40 2011 +0200 Minor: strip the ssh key value. commit 669996d528a3177a601b60ad0767b8e5c6791455 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 12:56:35 2011 +0200 Minor: dirty fix to avoid "unused option" message commit 8dda614bcb389ae57398c020eafcdabf77354281 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 12:55:08 2011 +0200 Minor: save cron.d path commit ca95838a0512a9065fa08f51152791ca918fadb0 Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 11:18:55 2011 +0200 Minor: code condensation commit 1e251053ab1a3eb7acd2bf5af42c075f56a1fbdb Author: Antoine Catton <acatton@tiolive.com> Date: Tue Aug 23 10:38:46 2011 +0200 Pull Backup Server recipe first draft commit 9bf0841e55078e5f5d4ea822f05cbb0b2840f6d2 Author: Antoine Catton <acatton@tiolive.com> Date: Mon Aug 22 13:18:08 2011 +0200 Minor: code cleaning on mysql recipe commit 91a5ec43e7835acc283a88733b0edcc146013b5b Author: Antoine Catton <acatton@tiolive.com> Date: Fri Aug 19 15:47:01 2011 +0200 Minor: adding sshd_binary option to mariadb commit ba53f1ed65021273f0c5797830ec164963391249 Author: Antoine Catton <acatton@tiolive.com> Date: Fri Aug 19 15:12:44 2011 +0200 Adding openssh part to mariadb software release commit 4fa4540c300e62322ff0eddd0609a02ad5d20f26 Author: Antoine Catton <acatton@tiolive.com> Date: Fri Aug 19 15:11:47 2011 +0200 Adding openssh part commit 15c4b3203aabefde58dcfcf43fafb3174290a671 Author: Antoine Catton <acatton@tiolive.com> Date: Fri Aug 19 13:25:42 2011 +0200 Minor: clean up white spaces in mysql recipe --- component/bash/buildout.cfg | 8 +++ slapos/recipe/mysql/__init__.py | 81 +++++++++++------------------- slapos/recipe/mysql/catdatefile.py | 14 ++++++ software/mariadb/import-script.sh | 16 ------ software/mariadb/instance.cfg | 8 ++- software/mariadb/software.cfg | 9 ++-- 6 files changed, 58 insertions(+), 78 deletions(-) create mode 100644 component/bash/buildout.cfg create mode 100644 slapos/recipe/mysql/catdatefile.py delete mode 100644 software/mariadb/import-script.sh diff --git a/component/bash/buildout.cfg b/component/bash/buildout.cfg new file mode 100644 index 000000000..ce64a8f59 --- /dev/null +++ b/component/bash/buildout.cfg @@ -0,0 +1,8 @@ +[buildout] +parts = + bash + +[bash] +recipe = hexagonit.recipe.cmmi +url = ftp://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz +md5sum = 3fb927c7c33022f1c327f14a81c0d4b0 diff --git a/slapos/recipe/mysql/__init__.py b/slapos/recipe/mysql/__init__.py index 60f826b77..b3fe0cd5f 100644 --- a/slapos/recipe/mysql/__init__.py +++ b/slapos/recipe/mysql/__init__.py @@ -32,13 +32,17 @@ import sys import zc.buildout import ConfigParser import re -import urlparse class Recipe(BaseSlapRecipe): def getTemplateFilename(self, template_name): return pkg_resources.resource_filename(__name__, 'template/%s' % template_name) + def parseCmdArgument(self, arg): + if any([(i in arg) for i in ["'", ' ', "\\"]]): + return "'%s'" % re.sub(r"(\\|\')", r'\\\1', arg) + return arg + def _install(self): self.path_list = [] @@ -299,59 +303,30 @@ class Recipe(BaseSlapRecipe): # backup configuration backup_directory = self.createBackupDirectory('mysql') - full_backup = os.path.join(backup_directory, 'full') - incremental_backup = os.path.join(backup_directory, 'incremental') - self._createDirectory(full_backup) - self._createDirectory(incremental_backup) - innobackupex_argument_list = [self.options['perl_binary'], - self.options['innobackupex_binary'], - '--defaults-file=%s' % mysql_conf_path, - '--socket=%s' %mysql_conf['socket'].strip(), '--user=root'] - environment = dict(PATH='%s' % self.bin_directory) - innobackupex_incremental = zc.buildout.easy_install.scripts([( - 'innobackupex_incremental', 'slapos.recipe.librecipe.execute', 'executee')], - self.ws, sys.executable, self.bin_directory, arguments=[ - innobackupex_argument_list + ['--incremental'], - environment])[0] - self.path_list.append(innobackupex_incremental) - innobackupex_full = zc.buildout.easy_install.scripts([('innobackupex_full', - 'slapos.recipe.librecipe.execute', 'executee')], self.ws, - sys.executable, self.bin_directory, arguments=[ - innobackupex_argument_list, - environment])[0] - self.path_list.append(innobackupex_full) - backup_controller = zc.buildout.easy_install.scripts([ - ('innobackupex_controller', __name__ + '.innobackupex', 'controller')], - self.ws, sys.executable, self.bin_directory, - arguments=[innobackupex_incremental, innobackupex_full, full_backup, - incremental_backup])[0] - self.path_list.append(backup_controller) + tmp_backup_directory = self.createBackupDirectory('mysql_pending') + mysqldump_cmdline_list = [self.options['mysqldump_binary'], + mysql_conf['mysql_database'], + '-u', 'root', + '-S', mysql_conf['socket'].strip(), + '--single-transaction', '--opt', + ] + mysqldump_cmdline_str = ' '.join( + [self.parseCmdArgument(arg) for arg in mysqldump_cmdline_list] + ) + dump_filename = 'dump.sql.gz' + dump_file = os.path.join(backup_directory, dump_filename) + tmpdump_file = os.path.join(tmp_backup_directory, dump_filename) mysql_backup_cron = os.path.join(self.cron_d, 'mysql_backup') - open(mysql_backup_cron, 'w').write('0 0 * * * %r' % str(backup_controller)) + with open(mysql_backup_cron, 'w') as file_: + file_.write('0 0 * * * %(mysqldump)s | %(gzip)s > %(tmpdump)s' \ + '&& mv %(tmpdump)s %(dumpfile)s' % { + 'mysqldump': mysqldump_cmdline_str, + 'gzip': self.options['gzip_binary'], + 'tmpdump': self.parseCmdArgument(tmpdump_file), + 'dumpfile': self.parseCmdArgument(dump_file), + } + ) self.path_list.append(mysql_backup_cron) - mysql_conf.update(backup_directory=incremental_backup) + mysql_conf.update(backup_directory=backup_directory) # The return could be more explicit database, user ... - remote_url = self.installWebDAVBackup() - remote_backup_cron = os.path.join(self.cron_d, 'remote_backup') - with open(remote_backup_cron, 'w') as file_: - file_.write('1 0 * * * %s' % ' '.join([ - '%r' % str(self.options['duplicity_binary']), - '--no-encryption', - '%r' % str(backup_directory), '%r' % str(remote_url), - ])) return mysql_conf - - def installWebDAVBackup(self): - computer_partition = self.request( - self.options['davstorage-software-url'], - 'davstorage', - 'mysql_backup', - ) - url = re.sub('^http', 'webdav', computer_partition.getConnectionParameter('url')) - url = list(urlparse.urlparse(url)) - url[1] = '%(user)s:%(password)s@%(netloc)s' % { - 'user': computer_partition.getConnectionParameter('user'), - 'password': computer_partition.getConnectionParameter('password'), - 'netloc': url[1], - } - return urlparse.urlunparse(url) diff --git a/slapos/recipe/mysql/catdatefile.py b/slapos/recipe/mysql/catdatefile.py new file mode 100644 index 000000000..d3de298b2 --- /dev/null +++ b/slapos/recipe/mysql/catdatefile.py @@ -0,0 +1,14 @@ +import os +import sys +import time +def catdatefile(args): + directory = args[0] + try: + suffix = args[1] + except IndexError: + suffix = '.log' + f = open(os.path.join(directory, + time.strftime('%Y-%m-%d.%H:%M.%s') + suffix), 'aw') + for line in sys.stdin.read(): + f.write(line) + f.close() diff --git a/software/mariadb/import-script.sh b/software/mariadb/import-script.sh deleted file mode 100644 index 9f849a429..000000000 --- a/software/mariadb/import-script.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!%(bash_binary)s - -# Didn't we already restore the database ? -[ -f %(lock_file)r ] && exit 127 -touch %(lock_file)r - -dbname=db -# Wait for MySQL to be started -while ! %(mysql_binary)r --socket=%(mysql_socket)r -u root -e "use $dbname;" -do - sleep 5 -done - -# Restore dump -%(duplicity_binary)r restore --no-encryption %(parameter_remote_backup)r %(local_directory)r -zcat %(dump_name)r | %(mysql_binary)r --socket=%(mysql_socket)r -D $dbname -u root diff --git a/software/mariadb/instance.cfg b/software/mariadb/instance.cfg index b52b10b18..a2cce5f3f 100644 --- a/software/mariadb/instance.cfg +++ b/software/mariadb/instance.cfg @@ -8,15 +8,13 @@ develop-eggs-directory = ${buildout:develop-eggs-directory} [instance] recipe = ${instance-recipe:egg}:${instance-recipe:module} dcrond_binary = ${dcron:location}/sbin/crond -innobackupex_binary = ${xtrabackup:location}/bin/innobackupex logrotate_binary = ${logrotate:location}/usr/sbin/logrotate mysql_binary = ${mariadb:location}/bin/mysql mysql_install_binary = ${mariadb:location}/bin/mysql_install_db mysql_upgrade_binary = ${mariadb:location}/bin/mysql_upgrade mysqld_binary = ${mariadb:location}/libexec/mysqld +mysqldump_binary = ${mariadb:location}/bin/mysqldump openssl_binary = ${openssl:location}/bin/openssl -perl_binary = ${perl:location}/bin/perl -rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup stunnel_binary = ${stunnel:location}/bin/stunnel -duplicity_binary = ${buildout:bin-directory}/duplicity -davstorage-software-url = http://git.erp5.org/gitweb/slapos.git/blob/refs/tags/slapos-0.44:/software/davstorage/software.cfg +gzip_binary = ${gzip:location}/bin/gzip +rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup diff --git a/software/mariadb/software.cfg b/software/mariadb/software.cfg index d4a1544f6..71961f658 100644 --- a/software/mariadb/software.cfg +++ b/software/mariadb/software.cfg @@ -12,12 +12,10 @@ extends = ../../component/logrotate/buildout.cfg ../../component/stunnel/buildout.cfg ../../component/python-2.7/buildout.cfg - ../../component/perl/buildout.cfg - ../../component/xtrabackup/buildout.cfg ../../component/rdiff-backup/buildout.cfg ../../component/lxml-python/buildout.cfg + ../../component/gzip/buildout.cfg ../../stack/shacache-client.cfg - ../../component/duplicity/buildout.cfg # Use only quite well working sites. allow-hosts = @@ -39,6 +37,8 @@ parts = template libxslt eggs + gzip + rdiff-backup instance-recipe-egg # XXX: Workaround of SlapOS limitation @@ -70,9 +70,10 @@ eggs = # Default template for the instance. recipe = slapos.recipe.template url = ${:_profile_base_location_}/instance.cfg -md5sum = de50b4841247cc049686ca44cef1184b +md5sum = 98a9939c04a1a7c7ab6a6b2c1c6e595e output = ${buildout:directory}/template.cfg mode = 0644 +dollar = $ [versions] slapos.cookbook = 0.24 -- 2.30.9