By Bernat Sampera 1 min read

Deploy Astro site to coolify

Small guide on how to deploy an astro site on mode server to coolify

The Problem

On Astro is very easy to deploy static apps to Coolify, but when using the mode server it gets a bit more difficult.

astro.config.mjs

This is the configuration needed to set the type of the app to server, this is an example for this site, samperalabs.com

  output: 'server',
  adapter: node({
    mode: 'standalone'
  }),
  site: 'https://samperalabs.com',
  server: { port: 4322 }

package.json

change the start command to the following

"start": "HOST=0.0.0.0 PORT=4322 node ./dist/server/entry.mjs"

Create the resource for the site on coolify

In this case I choose the github repo and selected the following parameters

create server instance with nixpacks on coolify

Adjust the Configuration of the Resource

I have set the installation, build and start commands to follow the configuration that we need for astro.

astro configuration server mode coolify

Set the env variables and start

On the tab environment variables in the left side I set the urls I need and then I started the application