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 astroIf 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 nodeDefault 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 buildConfigure 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 tooadapter: usemode: 'standalone'. If you added the adapter withnpx astro add node, this is already setsecurity.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 with403andAstro.urlreturns 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/webTo change the setting of an existing project, use build-config update.
lolipop build-config update --project <id> --root apps/webUnsupported features
| Feature | Alternative |
|---|---|
@astrojs/cloudflare / @astrojs/netlify / @astrojs/vercel adapters | Use the @astrojs/node adapter |
mode: 'middleware' in @astrojs/node | Use 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.server | Keep the default ./server |
For environment variables and .env files, see Environment variables (in Japanese).