比较目录,有效地将更改同步到aws,并使cdn失效。

wood的Python项目详细描述


https://img.shields.io/pypi/status/wood.svghttps://img.shields.io/pypi/v/wood.svghttps://img.shields.io/pypi/pyversions/wood.svghttps://travis-ci.org/gebn/wood.svg?branch=masterhttps://coveralls.io/repos/github/gebn/wood/badge.svg?branch=master

Wood是一个表示目录树、计算比较的工具箱 以及影响s3、cloudfront和cloudflare中的这些变化。它 开始时是我个人网站的一组部署脚本,但后来 有些东西我吃得太多了,藏不住 另一个网站存储库。它不像,比如说,请求那样精致,但是应该 对任何希望将网站高效部署到aws的人都有用,和/或 使用cloudflare作为cdn。

值得注意的是,与aws cli工具或boto3不同,wood不依赖文件 时间戳,而不是使用md5校验和进行最小数量的更改 可能在S3它还有一个算法,用于将失效路径聚合到 使CloudFront Free层尽可能运行。同步器和无效器 以通用方式实现,允许轻松扩展到 根据需要提供服务。

功能

  • 树表示法
  • 树比较
    • S3中比较的动作
    • 根据需要使cloudfront和cloudflare中的路径无效

演示

importwood# low-level comparison of two local directoriescomparison=wood.compare('~/dir','~/.snapshot/hourly.1/dir')comparison.new()# files added since the snapshotcomparison.modified()# files modified since the snapshotcomparison.deleted()# files deleted since the snapshotimportpathlibimportboto3local_base=pathlib.Path('/path/to/web/root')bucket=boto3.resource('s3').Bucket('example.com')# create representations of the local and remote treesto_deploy=wood.root(local_base)deployed=wood.s3.objects_to_root(bucket.objects.all())# compare the two as if they were local directoriescomparison=wood.compare(to_deploy,deployed)# write all changes (additions, modifications, deletions) to the S3 bucketsyncer=wood.s3.Syncer(local_base,bucket)syncer.sync(comparison)# invalidate the minimum amount in CloudFront to ensure the changes are# visible, using prefix grouping where possiblecloudfront=boto3.client('cloudfront')invalidator=wood.cloudfront.Invalidator(cloudfront,'{distribution}','{reference}')invalidator.invalidate(comparison)# do the same for Cloudflare in the case of a second CDNinvalidator=wood.cloudflare.Invalidator(sess,email,key,zone,'https://example.com/')invalidator.invalidate(comparison)

为什么是“木头”?

因为它开始是一个树比较工具,然后从那里生长出来。是的 边缘也有点粗糙。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java通过Spring MVC web应用程序向客户端发送文本文件   java是否可以在运行时动态实例化DAO类?   调用VB。来自Java的net函数   java在Android中通过单击打开特定文件夹   java如何使用maven pom。xml标识非标准项目结构中的testng测试用例?   java为什么FOP在大文件上崩溃?   Architecture python+flask和spring boot+java   java Kafka工具根本没有启动Ubuntu 19.10   如何使用Eclipse运行Java USB API for Windows   java如何在Eclipse中查看J2EE预览服务器/容器的日志/控制台?   网页抓取是否可以使用Java crawler crawler4j暂停和恢复抓取?   java当我第二次按下按钮时,应用程序停止工作   带有偏移量和限制的java SQLite分页问题   java如何在OSX mavericks中将端口80转发到8080   java从泛型方法调用非泛型方法   java My代码未按预期工作。十进制输出不是它应该的样子   节点。java中的js加密(jasypt)和nodejs中的解密   java乘法表不工作数组索引超出范围   java将JDBC与Firebirdsql连接起来