Rails8

杰瑞发布于2024-10-05

Deploying modern web apps – with all the provisions needed to be fast and secure while easily updateable – has become so hard that many developers don’t dare do it without a PaaS (platform-as-a-service). But that’s ridiculous.
部署现代web应用程序(具有快速、安全和易于更新所需的所有规定)变得如此困难,以至于许多开发人员在没有PaaS(平台即服务)的情况下不敢这样做。但这太荒谬了。
Nobody should have to pay orders of magnitude more for basic computing just to make deployment friendly and usable. That’s a job for open source, and Rails is ready to solve it.
任何人都不应该为了使部署友好和可用而为基本计算支付更多数量级的费用。这是开源的工作,Rails已经准备好解决这个问题。
That was the premise of my keynote here at Rails World, and it’s the mission for Rails 8. So we are thrilled to release the first beta release of this new version in celebration with Rails World here in Toronto.
这是我在Rails World发表主题演讲的前提,也是Rails 8的使命。因此,我们很高兴在多伦多与Rails World一起发布这个新版本的第一个测试版。
Despite being a beta release, the vast majority of everything that’s included has already been thoroughly battle-tested. Rails is uniquely blessed to have huge applications like Shopify and GitHub, along with plenty of other apps of all sizes, run right on the bleeding edge of the framework to ensure that issues are caught early.
尽管是测试版,但其中包含的绝大多数内容都已经过彻底的战斗测试。Rails有幸拥有Shopify和GitHub等大型应用程序,以及许多其他各种规模的应用程序,它们都在框架的最前沿运行,以确保及早发现问题。
Furthermore, all the new deployment tools, as well as Solid Cache and Solid Queue, have been driving our cloud exit at 37signals for over 18 months in applications like Basecamp and HEY.
此外,所有新的部署工具,以及Solid Cache和Solid Queue,在Basecamp和HEY等应用程序中推动我们的云退出37signals超过18个月。
Still, there’s always going to be some issues with new stuff, and we’d be grateful if you’d help us find it by upgrading your applications to Rails 8 ahead of the final release. Let’s make this release as SOLID as can be!
尽管如此,新东西总是会有一些问题,如果您能在最终版本之前将您的应用程序升级到Rails 8,帮助我们找到问题,我们将不胜感激。让我们尽可能地使这个版本稳定!
Here're all the major new bits in box.
这是盒子里所有主要的新东西。
Rails 8 is dropping just a few months after Rails 7.2, but on top of all these incredible new tools presented above, also includes a wealth of fixes and improvements. Rails has never been firing harder on all cylinders than what we’re doing at the moment.
Rails 8在Rails 7.2发布几个月后就开始下降,但除了上面介绍的所有这些令人难以置信的新工具外,还包括大量的修复和改进。Rails从未像我们现在所做的那样,在所有方面都更加努力。
It’s an incredible time to be involved with the framework and an excellent moment to hop on our train for the first time. Whether you’re into #NOBUILD or #NOPAAS or simply attracted to the mission of compressing complexity in general, you’ll be right at home with a community of passionate builders who value beautiful code as much as they do productivity.
这是一个参与框架的绝佳时刻,也是第一次登上我们的火车的绝佳时刻。无论你是喜欢#NOBUILD还是#NOPAAS,或者只是被压缩复杂性的使命所吸引,你都会和一个充满激情的构建者社区在一起,他们既重视漂亮的代码,也重视生产力。
Enter:
Kamal 2 + Thruster.
Rails 8 comes preconfigured with Kamal 2 for deploying your application anywhere. Whether to a cloud VM or your own hardware. Kamal takes a fresh Linux box and turns it into an application or accessory server with just a single “kamal setup” command.
Rails 8预先配置了Kamal 2,可以在任何地方部署您的应用程序。无论是云虚拟机还是您自己的硬件。Kamal使用一个新的Linux盒子,只需一个“Kamal setup”命令即可将其转换为应用程序或辅助服务器。
All it needs is the IP addresses for a set of servers with your SSH key deposited, and you’ll be ready to go into production in under two minutes.
它所需要的只是一组服务器的IP地址,其中存储了SSH密钥,您将在两分钟内准备好投入生产。
Kamal can do this so easily because Rails already comes with a highly efficient and tuned Dockerfile for turning your application into a production-ready container image out of the box.
Kamal可以很容易地做到这一点,因为Rails已经提供了一个高效且经过调优的Dockerfile,可以将您的应用程序开箱即用地转换为生产就绪的容器映像。
All you need to bring is your own container registry account, like Docker Hub or GitHub, for storing the images.
您只需携带自己的容器注册表帐户,如Docker Hub或GitHub,用于存储映像。
In Rails 8, this Dockerfile has been upgraded to include a new proxy called Thruster, which sits in front of the Puma web server to provide X-Sendfile acceleration, asset caching, and asset compression.
在Rails 8中,此Dockerfile已升级为包含一个名为Thruster的新代理,该代理位于Puma web服务器之前,提供X-Sendfile加速、资产缓存和资产压缩。
This means there’s no need to put an Nginx or any other web server in front. The default Rails container is ready to accept traffic from the internet immediately.
这意味着不需要在前面放置Nginx或任何其他web服务器。默认的Rails容器已准备好立即接受来自互联网的流量。
Kamal 2 also includes a proxy, this time a bespoke unit called Kamal Proxy to replace the generic Traefik option it used at launch.
Kamal 2还包括一个代理,这次是一个名为Kamal proxy的定制单元,以取代它在发布时使用的通用Traefik选项。
This proxy provides super fast zero-downtime deploys, automated SSL certificates via Let’s Encrypt, and support for multiple applications on a single server without any complicated configuration.
此代理提供超快速的零停机部署,通过Let's Encrypt自动SSL证书,并支持单个服务器上的多个应用程序,而无需任何复杂的配置。
Together with a revised strategy for handling secrets (featuring built-in integration for 1password, Bitwarden, and LastPass) and a new aliases feature to get commands like “kamal console” to start a remote Rails console session, it provides a complete package for handling not just the deployment but the operation of your application in production.
再加上处理机密的修订策略(具有1password、Bitwarden和LastPass的内置集成)和新的别名功能,以获取“kamal console”等命令来启动远程Rails控制台会话,它提供了一个完整的包,不仅可以处理部署,还可以处理生产中应用程序的操作。
Kamal 2 was lead by Donal McBreen and Kamal Proxy + Thruster was created by Kevin McConnell, both from 37signals.
Kamal 2由Donal McBreen领导,Kamal Proxy+Thruster由Kevin McConnell创建,两者均来自37signals。
Solid:
A Solid Reduction of Dependencies.
大幅减少依赖。
Part of making Rails easier to deploy is to cut down on the number of accessory services required to get going. In the past, Rails needed either MySQL or PostgreSQL as well as Redis to take full advantage of all its features, like jobs, caching, and WebSockets. Now all of it can be done with SQLite thanks to a trifecta of new database-backed adapters named Solid Cable, Solid Cache, and Solid Queue.
使Rails更易于部署的一部分是减少启动所需的辅助服务的数量。在过去,Rails需要MySQL或PostgreSQL以及Redis来充分利用其所有功能,如作业、缓存和WebSockets。现在,得益于名为Solid Cable、Solid Cache和Solid Queue的三个新的数据库支持适配器,所有这些都可以通过SQLite完成。
These adapters are all created from the same premise: Disks have gotten fast enough that we don’t need RAM for as many tasks. This allows us to reap the simplification benefits of SSD and NVMe drives being orders of magnitude faster than good-old spinning rust.
这些适配器都是基于同一个前提创建的:磁盘已经变得足够快,我们不需要RAM来完成那么多任务。这使我们能够获得SSD和NVMe驱动器的简化优势,其速度比旧的旋转生锈快几个数量级。
Solid Cable:
solid cable.
实心电缆。
Solid Cable replaces the need for Redis to act as the pubsub server to relay WebSocket messages from the application to clients connected to different processes. It uses fast polling, but it’s still almost as quick as Redis, when run through the same server on SQLite.
Solid Cable取代了Redis作为pubsub服务器将WebSocket消息从应用程序中继到连接到不同进程的客户端的需要。它使用快速轮询,但当在SQLite上的同一服务器上运行时,它仍然几乎和Redis一样快。