使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Firebase App Hosting
plat_web
Firebase App Hosting 简化了动态 Web 应用的开发和部署,提供 GitHub 集成以及与 Authentication、Cloud Firestore 和 Firebase AI Logic 等其他 Firebase 产品的集成。App Hosting 内置了对 Next.js 和 Angular 的预配置支持,并对各种热门 Web 框架提供了更广泛的支持。
开始
主要功能
GitHub 集成 |
只需一个 Git 提交即可发布应用的新版本。App Hosting 可在您每次推送到特定分支时自动部署。
|
由 Google Cloud 提供支持 |
App Hosting 使用 Google Cloud 服务条款,并将您的应用部署到您信任的 Google Cloud 产品。应用由 Cloud Build 构建,在 Cloud Run 上提供并在 Cloud CDN 中缓存。
Cloud Secret Manager 等集成服务可确保 API 密钥安全无虞。
|
大规模交付依托 AI 技术的功能 |
从使用 Gemini 的 AI 示例入手。
使用 Cloud Secret Manager 保护 API 端点的 API 密钥,并利用 App Hosting 的流式传输支持,在向应用中添加生成式 AI 功能时保持较快的初始加载速度。
|
Firebase 控制台集成 |
在 Firebase 控制台中监控您的 build 和发布版本,以便随时了解最新动态。从 Firebase 控制台访问日志和指标、添加自定义网域,以及手动触发发布。
|
工作原理
- 使用 Firebase 控制台或 Firebase CLI 在您的代码库中授权并安装 Firebase GitHub 应用。
- 仍在 Firebase 控制台或 Firebase CLI 中,创建一个 Firebase App Hosting 后端,并附带用于持续部署的代码库和正式分支。App Hosting 会为您的后端创建默认发布政策,以便在有更改推送到目标分支时立即向 100% 的流量发布。
- 当提交内容推送到您的正式分支后,Google Cloud Developer Connect 会向 Firebase App Hosting 发送事件。
- 为了响应此事件,Firebase App Hosting 会为连接到代码库的后端创建一个新 build。
- 首先,Firebase App Hosting 会为您的提交创建一个新的 Cloud Build build。在此作业中,Google Cloud Buildpack 会确定应用中使用的框架,以创建适合应用的容器和配置(包括环境变量、密钥、实例最小值或最大值、并发内存、CPU 和 VPC 配置)。如需了解详情,请参阅 App Hosting 构建过程。
- Cloud Build 作业完成后,您的容器会存储在专用于 Firebase App Hosting 的 Artifact Registry 代码库中。然后,Firebase App Hosting 会使用您的映像和配置将新的 Cloud Run 修订版本添加到 Cloud Run 服务。
- Cloud Run 修订版本完成并通过健康验证后,Firebase App Hosting 会修改其流量配置,将所有新请求指向新的 Cloud Run 修订版本。至此,该功能的发布已完成。
- 当请求发送到 Firebase App Hosting 上托管的网站时,启用了 Cloud CDN 的 Google Cloud 负载平衡器会处理该请求。未缓存的请求会发送到您的 Cloud Run 服务。
实现流程
|
设置 Firebase |
如果您还没有 Firebase 项目,请创建一个 Firebase 项目,并确保其已启用 Blaze 定价方案。
|
|
设置 App Hosting |
使用 Firebase 控制台或 Firebase CLI 创建 App Hosting 后端。这是您的应用的一系列受管理资源,包括与应用的 GitHub 代码库的连接。
|
|
管理和监控应用 |
创建完 App Hosting 后端后,您的应用将在其免费子网域上提供,您可以在 Firebase 控制台中查看有关发布的详细信息。您可以使用 Google Cloud 控制台查看和搜索日志。
|
|
开发应用 |
每次有提交内容推送到您的正式版分支时,App Hosting 都会自动启动新的发布。
|
后续步骤
- 开始部署应用。
- 尝试 App Hosting 中将托管应用与 Firebase Authentication 和 Google AI 功能集成的 Codelab:Next.js | Angular。}
- 详细了解 App Hosting 支持的各种社区支持框架。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-08。
[null,null,["最后更新时间 (UTC):2025-08-08。"],[],[],null,["Firebase App Hosting \nplat_web \n\nFirebase App Hosting streamlines the development and deployment of dynamic\nweb apps, offering GitHub integration and integration with other Firebase\nproducts like Authentication, Cloud Firestore, and Firebase AI Logic.\nApp Hosting has built-in, preconfigured support for Next.js and Angular\nas well as broader support for various popular web frameworks.\n\n[Get started](/docs/app-hosting/get-started)\n\nKey capabilities\n\n|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| GitHub integration | A git commit is all that's needed to roll out a new version of your app. App Hosting can automatically deploy every time you push to a specific branch. |\n| Backed by Google Cloud | App Hosting uses Google Cloud Terms of Service, and deploys your app to Google Cloud products you trust. Apps are built with Cloud Build, served on Cloud Run, and cached in Cloud CDN. Integrated services like Cloud Secret Manager keep your API keys safe. |\n| Ship AI-powered features at scale | Start with AI samples that use Gemini. Protect your API endpoint's API key with Cloud Secret Manager and leverage App Hosting's streaming support to maintain fast initial load times as you add generative AI features into your app. |\n| Firebase console integration | Monitor your builds and rollouts in the Firebase console so you always know what's going on. Access logs and metrics, add a custom domain, and manually trigger rollouts from the Firebase console. |\n\nHow does it work?\n\n1. Using the Firebase console or Firebase CLI, authorize and install the Firebase GitHub app on your repository.\n2. Still in the Firebase console or Firebase CLI, create a Firebase App Hosting backend, with a repository and live branch for continuous deployment. App Hosting creates a default rollout policy for your backend to roll out to 100% of traffic immediately when a change is pushed to the target branch.\n3. When a commit is pushed to your live branch, Google Cloud Developer Connect sends an event to Firebase App Hosting.\n4. Responding to this event, Firebase App Hosting creates a new build for the backend connected to the repository.\n 1. First, Firebase App Hosting creates a new Cloud Build build for your commit. In this job, [Google Cloud buildpacks](https://cloud.google.com/docs/buildpacks/overview) determine which framework is being used in your application to create a container and configuration (including environment variables, secrets, minimum or maximum instances, concurrency memory, CPU, and VPC configuration) that suits your application. See [the App Hosting build process](/docs/app-hosting/build) For more information.\n 2. When the Cloud Build job is complete, your container is stored in an Artifact Registry repository dedicated to Firebase App Hosting. Firebase App Hosting then adds a new Cloud Run Revision to a Cloud Run service using your image and configuration.\n5. Once your Cloud Run Revision is complete and verified healthy, Firebase App Hosting modifies its traffic configuration to point all new requests to your new Cloud Run Revision. At this point, the rollout is complete.\n6. When a request is sent to a website hosted on Firebase App Hosting, the request is served by Google Cloud Load Balancer with Cloud CDN enabled. Uncached requests are sent to your Cloud Run service.\n\nImplementation path\n\n|---|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | Set up Firebase | If you don't already have one, create a Firebase project and make sure it has the Blaze pricing plan enabled. |\n| | Set up App Hosting | With the Firebase console or the Firebase CLI, create an App Hosting backend. This is the collection of managed resources for your app, including the connection to the GitHub repository for your app. |\n| | Manage and monitor your app | When you finish creating an App Hosting backend, your app is available on its free subdomain, and you can view details about the rollout in the Firebase console. You can use the [Google Cloud console](https://console.cloud.google.com/logs/query?project=_) to view and search through your logs. |\n| | Develop your app | App Hosting automatically starts a new rollout every time a commit is pushed to your live branch. |\n\nNext steps\n\n- [Get started](/docs/app-hosting/get-started) deploying apps.\n- Try an App Hosting codelab that integrates a hosted app with Firebase Authentication and Google AI features: [Next.js](https://firebase.google.com/codelabs/firebase-nextjs) \\| [Angular](https://firebase.google.com/codelabs/firebase-web).}\n- Learn more about the various [community-supported frameworks](https://firebaseopensource.com/platform/app_hosting) supported by App Hosting."]]