Running on Galaxy Legacy? Visit the legacy docs.
Galaxy

AdonisJS Reference

Environment variables, database configuration, and deployment reference for AdonisJS apps on Galaxy.

Environment Variables

Set these in the Galaxy deployment form or your app's Settings page.

Required Variables

VariableDescription
PORTPort your app listens on (AdonisJS default is 3333)
APP_KEY32-character encryption key (generate with node ace generate:key)
NODE_ENVSet to production for live apps

Optional Variables

VariableDefaultDescription
TZUTCTimezone for your app
LOG_LEVELinfoLogging verbosity (trace, debug, info, warn, error, fatal)
SESSION_DRIVERcookieSession storage (cookie, file, redis, memory)
DRIVE_DISKlocalFile storage driver (local, s3)

Database Configuration

Connection Variables

DB_CONNECTION=pg
DB_HOST=your-postgres-host
DB_PORT=5432
DB_USER=your-username
DB_PASSWORD=your-password
DB_DATABASE=your-database
DB_CONNECTION=mysql
DB_HOST=your-mysql-host
DB_PORT=3306
DB_USER=your-username
DB_PASSWORD=your-password
DB_DATABASE=your-database
DB_CONNECTION=sqlite
DB_DATABASE=./database/db.sqlite3

SQLite is not recommended for production. Use PostgreSQL or MySQL with persistent storage instead.

Lucid ORM Configuration

If using Galaxy's managed databases, update your database config:

// config/database.ts
import { defineConfig } from '@adonisjs/lucid'
import env from '#start/env'

const dbConfig = defineConfig({
  connection: env.get('DB_CONNECTION', 'pg'),
  connections: {
    pg: {
      client: 'pg',
      connection: {
        connectionString: env.get('DATABASE_URL'),
        ssl: {
          rejectUnauthorized: false
        }
      },
      pool: {
        min: 2,
        max: 10
      }
    }
  }
})

Running Migrations

Run database migrations automatically on every deployment using the Pre-Deploy Command. This command executes after the build completes but before your app starts, within your private network with access to your environment variables.

In Galaxy, set the Pre-Deploy Command to:

node ace migration:run --force

Set this during initial deployment or later in your app's Settings page under Build Commands.

Paid Plans Only

Pre-deploy commands require a paid plan. Always backup your database before running migrations in production.


Advanced Configuration

Custom Build Commands

Override the defaults in your package.json:

{
  "scripts": {
    "build": "node ace build --production && node ace optimize",
    "start": "node bin/server.js"
  }
}

Then in Galaxy, set Build Command to npm run build.

Health Check Endpoint

// start/routes.ts
import router from '@adonisjs/core/services/router'

router.get('/health', async ({ response }) => {
  return response.ok({
    status: 'healthy',
    timestamp: new Date().toISOString()
  })
})

In the Galaxy deployment form, set Health Check Path to /health.


Troubleshooting


Need Help?

Quick Help

Live chat is fastest for urgent issues. Available directly from your Galaxy dashboard.