将你的 Astro 站点部署到 Clever Cloud
Clever Cloud 是一个欧洲云平台,提供自动化、可扩展的服务。
¥Clever Cloud is a European cloud platform that provides automated, scalable services.
项目配置
标题部分 项目配置¥Project Configuration
你可以在 Clever Cloud 上部署完全静态和按需渲染的 Astro 项目。无论你的 output
模式如何(预渲染或 on-demand),你都可以选择部署为使用构建后钩子运行的静态应用,或部署为 Node.js 应用,这需要在 package.json
中进行一些手动配置。
¥You can deploy both fully static and on-demand rendered Astro projects on Clever Cloud. Regardless of your output
mode (pre-rendered or on-demand), you can choose to deploy as a static application which runs using a post-build hook, or as a Node.js application, which requires some manual configuration in your package.json
.
脚本
标题部分 脚本¥Scripts
如果你正在运行按需 Node.js 应用,请更新你的 start
脚本以运行 Node 服务器。Clever Cloud 上的应用在端口 8080 上监听。
¥If you’re running an on-demand Node.js application, update your start
script to run the Node server. Applications on Clever Cloud listen on port 8080.
从控制台部署 Astro
标题部分 从控制台部署 Astro¥Deploy Astro from the Console
要将你的 Astro 项目部署到 Clever Cloud,你需要创建一个新的应用。应用向导将引导你完成必要的配置步骤。
¥To deploy your Astro project to Clever Cloud, you will need to create a new application. The application wizard will walk you through the necessary configuration steps.
-
From the lateral menubar, click Create > An application
-
Choose how to deploy:
- Create a brand new app: to deploy from a local repository with Git
or
- Select a GitHub repository: to deploy from GitHub
-
Select a Node.js application, or a static one.
-
Set up the minimal size for your instance and scalability options. Astro sites can typically be deployed using the Nano instance. Depending on your project’s specifications and dependencies, you may need to adjust accordingly as you watch the metrics from the Overview page.
-
Select a region to deploy your instance.
-
Skip connecting Add-ons to your Clever application unless you’re using a database or Keycloak.
-
Inject environment variables:
- For Node.js, no specific environment variable is needed to deploy Astro if you’re using npm. If you’re using yarn or pnpm, set the following environment variables:
- For a static application, add these variables:
-
Deploy! If you’re deploying from GitHub, your deployment should start automatically. If you’re using Git, copy the remote and push on the master branch.
官方资源
标题部分 官方资源¥Official Resources