【译】助你成功搭建云应用的12条方法

原文作者:Rafael Benevides 原文地址:https://dzone.com/articles/12-factors-to-cloud-success-rhd-blog

原文

Hey, developers! Do you care about using the best practices to apply your application to the cloud? If so then you should be using The 12-factor App, which is a methodology for building Software-as-a-Service. Today, I’d like to talk about the 12-factor App, which I had presented to a group at the Red Hat Summit last month.

Every developer that is moving their application to the cloud will face a different environment than what they are used to, their datacenter or own premise and that’s why they should care about the 12-factor methodology. This 12 step methodology was created by Heroku, which is a cloud provider who found a common solution to most of what their customers were experiencing and decided to release these solutions as a methodology. These 12 factors are intended to solve problems related to applications running in the cloud. If there was one key takeaway from my session it was not the idea to have the audience memorize these 12 factors but to have an understanding of why each one is important.

Codebase – Use version control, one codebase tracked in revision control for many deployments.


Dependencies – Use a package manager and don’t commit dependencies in the codebase repository.


Config – Store the config in Environment Variable, if you have to repackage your application, you’re doing it wrong.


Backing Services – A deploy of the twelve-factor app should be able to swap out a local MySQL database with one managed by a third party (such as Amazon RDS) without any changes to the app’s code.


Build, Release, Run – The twelve-factor app uses strict separation between the build, release, and run stages. Every release should always have a unique release ID and releases should allow rollback.


Processes – Execute the app as one or more stateless processes. The Twelve-factor processes are stateless and share-nothing.


Port Binding – Export services via port binding, The twelve-factor app is completely self-contained.


Concurrency – Scale out via the process model. Each process should be individually scaled, with Factor 6 (Stateless), it is easy to scale the services.


Disposability – Maximize robustness with fast startup and graceful shutdown, we can achieve this with containers.


Dev/Prod Parity – Keep development, staging, and production as similar as possible, the twelve-factor app is designed for continuous deployment by keeping the gap between development and production small.


Logs – Treat logs as event streams, a twelve-factor app never concerns itself with routing or storage of its output stream.


Admin Processes – run admin/management tasks as one-off processes.

The 12-factor App methodology is technology and language agnostic but satisfied by Containers, Microservices, and CI/CD Pipelines with a focus on DevOps. You can access more information on The 12-factor App here.

译文:

你好,开发者们!你是否想了解应用程序在云端的最佳应用体验?那么,你最好使用12-Factor App,将你的程序部署为Saas(Software-as-a-Service译:软件即服务)的云应用。今天,我想谈谈我上个月在Red Hat Summit上的关于12-Factor App的分享。

每一个正在将应用程序迁移到云端的开发人员都将面临一个与过去完全不同的环境,他们使用数据中心或自己的机房,这就是为什么他们应该关注12-Factor App的原因。这十二条是由Heroku这一个云提供商发布的一个通用的解决方案,大多数他们的客户决定放出这些解决方案作为一种方法论。这十二条特性旨在解决与云中运行的应用程序相关的问题。如果用一句话概括我的这个分享,并不是想法让大家记住这十二条特性,而是想让了解为什么每一个都是非常重要的。

  1. 基准代码 - 使用版本控制,一份基准代码,多份部署的版本控制。
  2. 依赖 – 使用包管理器且不要提交依赖关系到在代码库。
  3. 配置 – 将配置存储在环境变量中,如果你将其打包进你的应用中,你就大错特错了。
  4. 后端服务 — 一个12-Factor App部署应该支持切换到一个本地MySQL数据库,或由第三方管理(如Amazon RDS)的数据库,而无需对程序的代码进行任何更改。
  5. 构建、发布、运行 — 12-Factor App在构建、发布和运行阶段之间使用严格隔离。每个发行版都应该有唯一的发行ID,发行版应该支持回滚。
  6. 进程 — 将应用程序作为一个或多个无状态进程执行。12-Factor App的进程应该是无状态和无共享的。
  7. 端口绑定 — 通过端口绑定提供服务,一个符合这十二条特性的是完全自包含的。
  8. 并发性 — 通过过程模型扩展。每一个进程都应该按Factor 6(无状态)单独缩放,很容易扩展服务。
  9. 易处理 – 最大化快速启动和优雅终止可最大化健壮性,我们可以实现这个容器。
  10. 开发环境与线上环境等价 - 保持开发,分期,生产尽可能相似,12-Factor App是为了保持持续的开发和生产之间的差距小规模部署。
  11. 日志 — 将日志视为事件流,一个12-Factor App从不担心其输出流的路由或存储。
  12. 管理进程 - 后台管理任务当作一次性进程运行。

12-Factor App和技术或语言无关,但你可以在DevOps关注容器,微服务,CI / CD的管道相关的技术。更多关于12-Factor App的信息请点击这里.

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏云计算

助你成功搭建云应用的12条方法

你好,开发者们!你是否想了解应用程序在云端的最佳应用体验?那么,你最好使用12-Factor App,将你的程序部署为Saas(Software-as-a-Se...

19610
来自专栏编程

可移植的 C+标准库 Boost 发布 1.66.0,新增 HTTP 库

来自:开源中国社区 链接:oschina.net/news/91666/boost-1-66-0-released 可移植的 C++ 标准库 Boost 发布了...

2318
来自专栏轮子工厂

Wox一款国产开源的快捷启动器辅助工具神器

如果你也不喜欢电脑桌面上满是程序的快捷方式,如果你也喜欢博主这样干干净净的桌面,甚至喜欢高效的键盘操作,那么你需要一款好用的快速启动器软件。

461
来自专栏轮子工厂

有哪些实用且堪称神器的Chrome插件?吐血推荐!!!

相信很多人都在使用 Chrome 浏览器,其流畅的浏览体验得到了不少用户的偏爱,但流畅只是一方面, Chrome 最大的优势还是其支持众多强大好用的扩展程序(E...

1093
来自专栏zaking's

真正“搞”懂http协议01—背景故事

1053
来自专栏Rainbond开源「容器云平台」

​Kubernetes集群中的高性能网络策略

1003
来自专栏州的先生

如何搭建一个用于AI预测的Python环境

894
来自专栏月色的自留地

python scrapy 入门,10分钟完成一个爬虫

1906
来自专栏假装我会写代码

推荐一个超棒的收费图片插件 Slim Image Cropper

923
来自专栏phodal

UI测试:一个浏览器跑要8分钟,那么8个浏览器呢?

这两天我一直在修复、并补齐之前的 UI 自动化测试——我知道你们大多数人都不会在项目上写测试的。然后,我发现一个浏览器跑完所有的 UI 自动化测试要花 8 分钟...

1939

扫描关注云+社区