Skip to Content
ロリポップ!デプロイナウロリポップ!デプロイナウ

Deploy Astro

LOLIPOP! Deploy Now supports Astro static sites and server rendering with the @astrojs/node adapter.

When you deploy, choose astro as the framework.

lolipop deploy --name <name> --framework astro

If you create the project interactively, choose astro when you are asked for the framework. Run lolipop frameworks list to see the available framework names.

Static sites and server rendering

An app without an adapter is published as a static site, and an app with the @astrojs/node adapter runs on a server. This is decided from the build output, so you don’t need to change the framework setting.

To run your app on a server, add the @astrojs/node adapter.

npx astro add node

Default build settings

Choosing astro as the framework applies these build settings:

  • Install command: npm ci --ignore-scripts
  • Build command: npm run build
  • Output directory: dist

If you changed outDir in astro.config, set the output directory to the same value.

lolipop build-config update --project <id> --output build

Configure astro.config

To run your app on a server, configure astro.config as follows.

// astro.config.mjs import { defineConfig } from 'astro/config' import node from '@astrojs/node' export default defineConfig({ site: 'https://<subdomain>.lolipop-now.app', adapter: node({ mode: 'standalone' }), security: { allowedDomains: [ { hostname: '<subdomain>.lolipop-now.app', protocol: 'https' }, { hostname: '*.preview.lolipop-now.app', protocol: 'https' }, { hostname: 'www.example.com', protocol: 'https' }, ], }, })
  • site: the public URL of your site, used to generate canonical URLs and the sitemap. Set it for static sites too
  • adapter: use mode: 'standalone'. If you added the adapter with npx astro add node, this is already set
  • security.allowedDomains: list the domains your site is served on. The first entry is the public URL, the second is for pull request previews, and the third is a custom domain. Remove the third entry if you don’t use a custom domain. When you add a custom domain, add it here as well and deploy again. On a domain that isn’t listed, form submissions fail with 403 and Astro.url returns a different value from the public URL

Set the root in a monorepo

If your Astro app is in a subdirectory of the repository, set the build root to the app’s directory.

lolipop deploy --name <name> --framework astro --root apps/web

To change the setting of an existing project, use build-config update.

lolipop build-config update --project <id> --root apps/web

Unsupported features

FeatureAlternative
@astrojs/cloudflare / @astrojs/netlify / @astrojs/vercel adaptersUse the @astrojs/node adapter
mode: 'middleware' in @astrojs/nodeUse mode: 'standalone'
Default storage for Sessions (Astro.session)Set an external data store (such as Redis) with session.driver
Route caching (Astro.cache, routeRules)None
Changing build.serverKeep the default ./server

For environment variables and .env files, see Environment variables (in Japanese).