import type { CloudConfig } from '@stacksjs/types' import type { CloudConfig as TsCloudConfig } from '@stacksjs/ts-cloud' import { env } from '@stacksjs/env' const APP_SLUG = '__APP_SLUG__' const APP_DOMAIN = env.APP_DOMAIN || undefined /** * Safe application cloud defaults. * * Set APP_DOMAIN and provider credentials before the first deploy. Use * `cloud.attachTo` only when this app is intentionally joining a server owned * by another ts-cloud project. */ export const tsCloud: TsCloudConfig = { project: { name: APP_SLUG, slug: APP_SLUG, region: 'us-east-1', }, stateDir: 'storage/cloud', // Deploy to a Linux box you already own over SSH (a Raspberry Pi, a NUC, a // VPS, an old laptop). Nothing is provisioned through a provider API: the // host is checked, bootstrapped and deployed to like any other box. // // Host, user, port and key can also come from TS_CLOUD_SSH_HOST, // TS_CLOUD_SSH_USER, TS_CLOUD_SSH_PORT and TS_CLOUD_SSH_KEY. See // `buddy server:flash`, `server:first-boot`, `server:doctor` and // `server:setup` for getting a fresh board to that point. cloud: { provider: 'ssh', }, ssh: { hosts: [{ host: 'replace-me.local', user: 'root' }], // 'raspberry-pi' for a small single-board computer. profile: 'generic', }, mode: 'server', environments: { production: { type: 'production', deployBranch: 'main', region: 'us-east-1', variables: { APP_ENV: 'production', NODE_ENV: 'production', LOG_LEVEL: 'info', }, }, }, infrastructure: { compute: { instances: 1, webServer: 'rpx', proxy: { engine: 'rpx', onDemandTls: true, }, }, }, sites: { main: { root: '.', path: '/', domain: APP_DOMAIN, start: 'bun node_modules/@stacksjs/buddy/dist/serve-entry.js', port: 3000, preStart: [ 'bun install --frozen-lockfile', 'bun node_modules/@stacksjs/buddy/dist/cli.js migrate', ], env: { APP_ENV: 'production', NODE_ENV: 'production', PORT_API: '3008', API_URL: 'http://127.0.0.1:3008', }, }, api: { root: '.', start: 'bun node_modules/@stacksjs/actions/dist/serve/api.js', port: 3008, preStart: ['bun install --frozen-lockfile'], env: { HOST: '127.0.0.1', APP_ENV: 'production', NODE_ENV: 'production', }, }, }, } const config: CloudConfig = {} export default config