Skip to content

Latest commit

 

History

History
164 lines (140 loc) · 5.24 KB

zerops.mdx

File metadata and controls

164 lines (140 loc) · 5.24 KB
title description type i18nReady
Astro 사이트를 Zerops에 배포
Zerops를 사용하여 Astro 사이트를 웹에 배포하는 방법.
deploy
true

import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro' import { Steps } from '@astrojs/starlight/components';

Zerops는 SSR Astro 사이트를 배포하는 데 사용할 수 있는 개발 우선 클라우드 플랫폼입니다.

이 가이드는 Node.js 어댑터를 사용하여 Astro 프로젝트를 Zerops에 배포하는 과정을 안내합니다.

전제조건

:::tip[템플릿으로 시작] Zerops x Astro - Node.js 예시 앱Zerops 대시보드로 직접 가져와 한 번의 클릭으로 배포할 수 있습니다!

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 마법사를 통해 또는 .yaml을 사용하여 Astro 사이트를 가져와 Astro 사이트를 위한 Node.js 서비스를 만들 수 있습니다.

다음 YAML 구조는 hellothere라는 Node.js v20 서비스를 사용하여 my-astro-sites라는 프로젝트를 설정합니다. 하나의 Zerops 프로젝트에는 여러 Astro 앱이 포함될 수 있습니다.

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인 예시 프로젝트에 필요한 빌드 및 실행 작업을 구성하는 방법을 보여줍니다.

```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 ``` ```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 ``` ```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 ```

GitHub / GitLab을 사용하는 파이프라인 트리거

브랜치 푸시 또는 새 릴리스에 대한 지속적인 배포를 설정하려면 Node.js 서비스 세부 정보로 이동하여 Zerops 서비스를 GitHub 또는 GitLab 저장소와 연결하세요.

Zerops CLI (zcli)를 사용하는 파이프라인 트리거

1. Zerops CLI를 설치합니다. ```shell # zcli 바이너리를 직접 다운로드하려면, # https://github.com/zeropsio/zcli/releases 를 방문하세요. npm i -g @zerops/zcli ```
  1. Zerops 앱에서 Settings > Access Token Management를 열고 새 액세스 토큰을 생성합니다.

  2. 다음 명령으로 액세스 토큰을 사용하여 로그인합니다. shell zcli login <token>

  3. 앱의 루트 (zerops.yml이 있는 위치)로 이동하고 다음 명령을 실행하여 배포를 트리거합니다. shell zcli push

Resources