def write_snapshots(): require("settings", provided_by=[production, staging]) if env.settings == "production" and env.branch != "stable": _confirm( "You are trying to deploy the '%(branch)s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env ) # Fake out deployment target deployment_target = app_config.DEPLOYMENT_TARGET app_config.configure_targets(env.get("settings", None)) os.system("rm -rf .backups_gzip") os.system("rm -rf data/backups/.placeholder") data.gzip("data/backups", ".backups_gzip") s3cmd = "s3cmd -P --add-header=Cache-Control:max-age=5 --guess-mime-type --recursive --exclude-from gzip_types.txt sync %s/ %s" s3cmd_gzip = 's3cmd -P --add-header=Cache-Control:max-age=5 --add-header=Content-encoding:gzip --guess-mime-type --recursive --exclude "*" --include-from gzip_types.txt sync %s/ %s' for bucket in app_config.S3_BUCKETS: os.system(s3cmd % (".backups_gzip", "s3://%s/backups/" % (bucket))) os.system(s3cmd_gzip % (".backups_gzip", "s3://%s/backups/" % (bucket))) os.system("rm -rf .backups_gzip") os.system("rm -rf data/backups") os.system("mkdir -p data/backups") os.system("touch data/backups/.placeholder") # Un-fake-out deployment target app_config.configure_targets(deployment_target)
def write_snapshots(): require('settings', provided_by=[production, staging]) if (env.settings == 'production' and env.branch != 'stable'): _confirm("You are trying to deploy the '%(branch)s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env) # Fake out deployment target deployment_target = app_config.DEPLOYMENT_TARGET app_config.configure_targets(env.get('settings', None)) os.system('rm -rf .backups_gzip') os.system('rm -rf data/backups/.placeholder') data.gzip('data/backups', '.backups_gzip') s3cmd = 's3cmd -P --add-header=Cache-Control:max-age=5 --guess-mime-type --recursive --exclude-from gzip_types.txt sync %s/ %s' s3cmd_gzip = 's3cmd -P --add-header=Cache-Control:max-age=5 --add-header=Content-encoding:gzip --guess-mime-type --recursive --exclude "*" --include-from gzip_types.txt sync %s/ %s' for bucket in app_config.S3_BUCKETS: os.system(s3cmd % ('.backups_gzip', 's3://%s/%s/backups/' % (bucket, app_config.PROJECT_SLUG))) os.system(s3cmd_gzip % ('.backups_gzip', 's3://%s/%s/backups/' % (bucket, app_config.PROJECT_SLUG))) os.system('rm -rf .backups_gzip') os.system('rm -rf data/backups') os.system('mkdir -p data/backups') os.system('touch data/backups/.placeholder') # Un-fake-out deployment target app_config.configure_targets(deployment_target)
def _gzip(src="www", dst="gzip"): """ Gzips everything in www and puts it all in gzip """ data.gzip(src, dst) os.system("rm -rf %s/live-data" % dst) if os.environ.get("DEPLOYMENT_TARGET", None) not in ["production", "staging"]: os.system("rm -rf %s/sitemap.xml" % dst)
def _gzip(src='www', dst='gzip'): """ Gzips everything in www and puts it all in gzip """ data.gzip(src, dst) os.system('rm -rf %s/live-data' % dst) if os.environ.get('DEPLOYMENT_TARGET', None) not in ['production', 'staging']: os.system('rm -rf %s/sitemap.xml' % dst)