-
-
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.
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
- Loading branch information
1 parent
8b47a03
commit b07494e
Showing
1 changed file
with
164 additions
and
0 deletions.
There are no files selected for viewing
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,164 @@ | ||
--- | ||
title: Astro 사이트를 Zerops에 배포 | ||
description: Zerops를 사용하여 Astro 사이트를 웹에 배포하는 방법. | ||
type: deploy | ||
i18nReady: true | ||
--- | ||
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro' | ||
import { Steps } from '@astrojs/starlight/components'; | ||
|
||
[Zerops](https://zerops.io/)는 SSR Astro 사이트를 배포하는 데 사용할 수 있는 개발 우선 클라우드 플랫폼입니다. | ||
|
||
이 가이드는 Node.js 어댑터를 사용하여 Astro 프로젝트를 Zerops에 배포하는 과정을 안내합니다. | ||
|
||
## 전제조건 | ||
|
||
- **[`@astrojs/node` SSR 어댑터](/ko/guides/integrations-guide/node/)를 사용하는 Astro 프로젝트** | ||
- **Zerops 계정** - 아직 계정이 없다면 무료로 [Zerops 계정을 생성](https://zerops.io/)할 수 있습니다. | ||
|
||
:::tip[템플릿으로 시작] | ||
[Zerops x Astro - Node.js 예시 앱](https://github.com/zeropsio/recipe-astro-nodejs)을 [Zerops 대시보드](https://app.zerops.io/dashboard/projects)로 직접 가져와 한 번의 클릭으로 배포할 수 있습니다! | ||
|
||
```yaml | ||
project: | ||
name: astro | ||
services: | ||
- hostname: astronode | ||
type: nodejs@20 | ||
buildFromGit: https://github.com/zeropsio/recipe-astro-nodejs | ||
ports: | ||
- port: 4321 | ||
httpSupport: true | ||
enableSubdomainAccess: true | ||
minContainers: 1 | ||
``` | ||
::: | ||
## Zerops Node.js 프로젝트 생성 | ||
[Zerops `project add` 마법사](https://app.zerops.io/dashboard/project-add)를 통해 또는 `.yaml`을 사용하여 Astro 사이트를 가져와 Astro 사이트를 위한 Node.js 서비스를 만들 수 있습니다. | ||
|
||
다음 YAML 구조는 `hellothere`라는 Node.js v20 서비스를 사용하여 `my-astro-sites`라는 프로젝트를 설정합니다. 하나의 Zerops 프로젝트에는 여러 Astro 앱이 포함될 수 있습니다. | ||
|
||
```yaml | ||
project: | ||
name: my-astro-sites | ||
services: | ||
- hostname: hellothere | ||
type: nodejs@20 | ||
ports: | ||
- port: 4321 | ||
httpSupport: true | ||
minContainers: 1 | ||
``` | ||
|
||
|
||
## Zerops에 앱 빌드 및 배포 | ||
|
||
이제 Zerops에서 Node.js 서비스를 준비했으므로 프로젝트 루트에 `zerops.yml` 파일을 생성하여 Zerops에서 파이프라인 빌드 및 배포를 트리거해야 합니다. | ||
|
||
다음 예시에서는 호스트 이름이 `hellothere`인 예시 프로젝트에 필요한 빌드 및 실행 작업을 구성하는 방법을 보여줍니다. | ||
|
||
<PackageManagerTabs> | ||
<Fragment slot="npm"> | ||
```yaml title="zerops.yml" | ||
zerops: | ||
- setup: hellothere | ||
build: | ||
base: nodejs@20 | ||
buildCommands: | ||
- npm i | ||
- npm run build | ||
deploy: | ||
- dist | ||
- package.json | ||
- node_modules | ||
cache: | ||
- node_modules | ||
- package-lock.json | ||
run: | ||
start: node dist/server/entry.mjs | ||
envVariables: | ||
HOST: 0.0.0.0 | ||
NODE_ENV: production | ||
``` | ||
</Fragment> | ||
<Fragment slot="pnpm"> | ||
```yaml title="zerops.yml" | ||
zerops: | ||
- setup: hellothere | ||
build: | ||
base: nodejs@20 | ||
buildCommands: | ||
- pnpm i | ||
- pnpm run build | ||
deploy: | ||
- dist | ||
- package.json | ||
- node_modules | ||
cache: | ||
- node_modules | ||
- pnpm-lock.json | ||
run: | ||
start: node dist/server/entry.mjs | ||
envVariables: | ||
HOST: 0.0.0.0 | ||
NODE_ENV: production | ||
``` | ||
</Fragment> | ||
<Fragment slot="yarn"> | ||
```yaml title="zerops.yml" | ||
zerops: | ||
- setup: astronode | ||
build: | ||
base: nodejs@20 | ||
buildCommands: | ||
- yarn | ||
- yarn build | ||
deploy: | ||
- dist | ||
- package.json | ||
- node_modules | ||
cache: | ||
- node_modules | ||
- yarn.lock | ||
run: | ||
start: node dist/server/entry.mjs | ||
envVariables: | ||
HOST: 0.0.0.0 | ||
NODE_ENV: production | ||
``` | ||
</Fragment> | ||
</PackageManagerTabs> | ||
|
||
### GitHub / GitLab을 사용하는 파이프라인 트리거 | ||
브랜치 푸시 또는 새 릴리스에 대한 지속적인 배포를 설정하려면 Node.js 서비스 세부 정보로 이동하여 Zerops 서비스를 GitHub 또는 GitLab 저장소와 연결하세요. | ||
|
||
|
||
### Zerops CLI (zcli)를 사용하는 파이프라인 트리거 | ||
|
||
<Steps> | ||
1. Zerops CLI를 설치합니다. | ||
```shell | ||
# zcli 바이너리를 직접 다운로드하려면, | ||
# https://github.com/zeropsio/zcli/releases 를 방문하세요. | ||
npm i -g @zerops/zcli | ||
``` | ||
|
||
2. Zerops 앱에서 [`Settings > Access Token Management`](https://app.zerops.io/settings/token-management)를 열고 새 액세스 토큰을 생성합니다. | ||
|
||
3. 다음 명령으로 액세스 토큰을 사용하여 로그인합니다. | ||
```shell | ||
zcli login <token> | ||
``` | ||
|
||
4. 앱의 루트 (`zerops.yml`이 있는 위치)로 이동하고 다음 명령을 실행하여 배포를 트리거합니다. | ||
```shell | ||
zcli push | ||
``` | ||
</Steps> | ||
|
||
## Resources | ||
|
||
- [3분 안에 Astro를 Zerops에 배포](https://medium.com/@arjunaditya/how-to-deploy-astro-to-zerops-4230816a62b4) | ||
- [Zerops Node.js 서비스 생성에 대한 자세한 가이드](https://docs.zerops.io/nodejs/how-to/create) |