-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
509 additions
and
101 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
--- | ||
title: Deploy your Astro Site to Clever Cloud | ||
description: How to deploy your Astro site to the web on Clever Cloud. | ||
type: deploy | ||
i18nReady: true | ||
--- | ||
import { Tabs, TabItem, Steps } from '@astrojs/starlight/components'; | ||
|
||
[Clever Cloud](https://clever-cloud.com) is a European cloud platform that provides automated, scalable services. | ||
|
||
## Project Configuration | ||
|
||
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](/en/basics/rendering-modes/)), you can choose to deploy as a **static application** which runs using a post-build hook, or as a **Node.js** application, which works out-of-the-box with your `package.json`. | ||
|
||
### Port and host | ||
|
||
Applications on Clever Cloud listen on port **8080**. If your project requires this configuration, set your port and host in Astro in one of two locations: | ||
|
||
1. In `package.json` scripts: | ||
|
||
```json title="package.json" "astro preview --host 0.0.0.0 --port 8080" | ||
"scripts": { | ||
"dev": "astro dev", | ||
"start": "astro dev", | ||
"build": "astro check && astro build", | ||
"preview": "astro preview --host 0.0.0.0 --port 8080", | ||
"astro": "astro" | ||
} | ||
``` | ||
|
||
2. In `astro.config.mjs`: | ||
|
||
```javascript title="astro.config.mjs" | ||
import { defineConfig } from 'astro/config'; | ||
|
||
export default defineConfig({ | ||
server: { | ||
port: 8080, | ||
host: true | ||
} | ||
}); | ||
``` | ||
|
||
|
||
## Deploy Astro from the Console | ||
|
||
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. | ||
|
||
<Steps> | ||
|
||
1. From the lateral menubar, click **Create** > **An application** | ||
2. 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 | ||
|
||
3. Select a **Node.js** application, or a **static** one. | ||
4. 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. | ||
5. Select a **region** to deploy your instance. | ||
6. Skip [connecting **Add-ons** to your Clever application](https://developers.clever-cloud.com/doc/addons/) unless you're using a database or Keycloak. | ||
7. 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: | ||
|
||
<Tabs> | ||
<TabItem label="pnpm"> | ||
```shell | ||
CC_NODE_BUILD_TOOL="custom" | ||
CC_PRE_BUILD_HOOK="npm install -g pnpm && pnpm install" | ||
CC_CUSTOM_BUILD_TOOL="pnpm run astro telemetry disable && pnpm build" | ||
CC_RUN_COMMAND="pnpm run preview" | ||
``` | ||
</TabItem> | ||
<TabItem label="yarn"> | ||
```shell | ||
CC_NODE_BUILD_TOOL="yarn" | ||
CC_PRE_BUILD_HOOK="yarn && yarn run astro telemetry disable && yarn build" | ||
CC_RUN_COMMAND="yarn run preview" | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
- For a **static** application, add these variables: | ||
|
||
<Tabs> | ||
<TabItem label="npm"> | ||
```shell | ||
CC_POST_BUILD_HOOK="npm run build" | ||
CC_PRE_BUILD_HOOK="npm install && npm run astro telemetry disable" | ||
CC_WEBROOT="/dist" | ||
``` | ||
</TabItem> | ||
<TabItem label="pnpm"> | ||
```shell | ||
CC_POST_BUILD_HOOK="pnpm build" | ||
CC_PRE_BUILD_HOOK="npm install -g pnpm && pnpm install && pnpm run astro telemetry disable" | ||
CC_WEBROOT="/dist" | ||
``` | ||
</TabItem> | ||
<TabItem label="yarn"> | ||
```shell | ||
CC_POST_BUILD_HOOK="yarn build" | ||
CC_PRE_BUILD_HOOK="yarn && yarn run astro telemetry disable" | ||
CC_WEBROOT="/dist" | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
|
||
8. **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. | ||
|
||
</Steps> | ||
|
||
:::tip[Other Branches] | ||
To deploy from branches other than `master`, use `git push clever <branch>:master`. | ||
|
||
For example, if you want to deploy your local `main` branch without renaming it, use `git push clever main:master`. | ||
::: | ||
|
||
|
||
## Official Resources | ||
- [Clever Cloud documentation for deploying a Node.js application](https://developers.clever-cloud.com/doc/applications/javascript/nodejs/) | ||
- [Clever Cloud documentation for deploying Astro as a static application](https://developers.clever-cloud.com/guides/astro/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.