Astro 사이트를 Zerops에 배포
Zerops는 SSR Astro 사이트를 배포하는 데 사용할 수 있는 개발 우선 클라우드 플랫폼입니다.
이 가이드는 Node.js 어댑터를 사용하여 Astro 프로젝트를 Zerops에 배포하는 과정을 안내합니다.
전제조건
섹션 제목: 전제조건@astrojs/node
SSR 어댑터를 사용하는 Astro 프로젝트- Zerops 계정 - 아직 계정이 없다면 무료로 Zerops 계정을 생성할 수 있습니다.
Zerops x Astro - Node.js 예시 앱을 Zerops 대시보드로 직접 가져와 한 번의 클릭으로 배포할 수 있습니다!
project: name: astroservices: - 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 Node.js 프로젝트 생성Zerops project add
마법사를 통해 또는 .yaml
을 사용하여 Astro 사이트를 가져와 Astro 사이트를 위한 Node.js 서비스를 만들 수 있습니다.
다음 YAML 구조는 hellothere
라는 Node.js v20 서비스를 사용하여 my-astro-sites
라는 프로젝트를 설정합니다. 하나의 Zerops 프로젝트에는 여러 Astro 앱이 포함될 수 있습니다.
project: name: my-astro-sitesservices: - hostname: hellothere type: nodejs@20 ports: - port: 4321 httpSupport: true minContainers: 1
Zerops에 앱 빌드 및 배포
섹션 제목: Zerops에 앱 빌드 및 배포이제 Zerops에서 Node.js 서비스를 준비했으므로 프로젝트 루트에 zerops.yml
파일을 생성하여 Zerops에서 파이프라인 빌드 및 배포를 트리거해야 합니다.
다음 예시에서는 호스트 이름이 hellothere
인 예시 프로젝트에 필요한 빌드 및 실행 작업을 구성하는 방법을 보여줍니다.
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
zerops: - setup: hellothere build: base: nodejs@20 buildCommands: - pnpm i - pnpm run build deploy: - dist - package.json - node_modules cache: - node_modules - pnpm-lock.yaml run: start: node dist/server/entry.mjs envVariables: HOST: 0.0.0.0 NODE_ENV: production
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을 사용하는 파이프라인 트리거
섹션 제목: GitHub / GitLab을 사용하는 파이프라인 트리거브랜치 푸시 또는 새 릴리스에 대한 지속적인 배포를 설정하려면 Node.js 서비스 세부 정보로 이동하여 Zerops 서비스를 GitHub 또는 GitLab 저장소와 연결하세요.
Zerops CLI (zcli)를 사용하는 파이프라인 트리거
섹션 제목: Zerops CLI (zcli)를 사용하는 파이프라인 트리거-
Zerops CLI를 설치합니다.
Terminal window # zcli 바이너리를 직접 다운로드하려면,# https://github.com/zeropsio/zcli/releases 를 방문하세요.npm i -g @zerops/zcli -
Zerops 앱에서
Settings > Access Token Management
를 열고 새 액세스 토큰을 생성합니다. -
다음 명령으로 액세스 토큰을 사용하여 로그인합니다.
Terminal window zcli login <token> -
앱의 루트 (
zerops.yml
이 있는 위치)로 이동하고 다음 명령을 실행하여 배포를 트리거합니다.Terminal window zcli push