- Remove push:true from postgres adapter (unreliable for new columns) - Remove profile:tools from migrate service so it runs on every deploy - Add restart:no to migrate service (one-shot runner) - App now depends on migrate with service_completed_successfully condition: postgres healthy → migrate applies pending → app starts Workflow for future schema changes: 1. Add field to collection/global TypeScript 2. ssh server: docker-compose run --rm migrate migrate:create --name <field> 3. git pull the generated .ts migration file 4. commit + push → next deploy applies it automatically Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
125 lines
3.3 KiB
TypeScript
125 lines
3.3 KiB
TypeScript
import { buildConfig } from 'payload'
|
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
|
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
|
import { seoPlugin } from '@payloadcms/plugin-seo'
|
|
import { resendAdapter } from '@payloadcms/email-resend'
|
|
import sharp from 'sharp'
|
|
import path from 'path'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
import { Users } from './src/collections/Users'
|
|
import { Media } from './src/collections/Media'
|
|
import { Pages } from './src/collections/Pages'
|
|
import { BlogPosts } from './src/collections/BlogPosts'
|
|
import { Categories } from './src/collections/Categories'
|
|
import { Tags } from './src/collections/Tags'
|
|
import { Tariffs } from './src/collections/Tariffs'
|
|
import { Leads } from './src/collections/Leads'
|
|
import { Orders } from './src/collections/Orders'
|
|
import { Locations } from './src/collections/Locations'
|
|
import { Reviews } from './src/collections/Reviews'
|
|
import { BirthdayPackages } from './src/collections/BirthdayPackages'
|
|
|
|
import { HomePage } from './src/globals/HomePage'
|
|
import { CheckoutPage } from './src/globals/CheckoutPage'
|
|
import { ThankYouPage } from './src/globals/ThankYouPage'
|
|
import { Header } from './src/globals/Header'
|
|
import { Footer } from './src/globals/Footer'
|
|
import { SiteSettings } from './src/globals/SiteSettings'
|
|
import { DyvoLisPage } from './src/globals/DyvoLisPage'
|
|
import { GroupVisitsPage } from './src/globals/GroupVisitsPage'
|
|
|
|
const filename = fileURLToPath(import.meta.url)
|
|
const dirname = path.dirname(filename)
|
|
|
|
const siteURL = process.env['NEXT_PUBLIC_SITE_URL'] ?? 'http://localhost:3000'
|
|
|
|
export default buildConfig({
|
|
secret: process.env['PAYLOAD_SECRET']!,
|
|
serverURL: siteURL,
|
|
|
|
email: resendAdapter({
|
|
defaultFromAddress: process.env['RESEND_FROM'] ?? 'noreply@shumiland.com.ua',
|
|
defaultFromName: 'Шуміленд',
|
|
apiKey: process.env['RESEND_API_KEY'] ?? '',
|
|
}),
|
|
|
|
db: postgresAdapter({
|
|
pool: {
|
|
connectionString: process.env['DATABASE_URL']!,
|
|
},
|
|
migrationDir: path.resolve(dirname, 'migrations'),
|
|
}),
|
|
|
|
editor: lexicalEditor(),
|
|
sharp,
|
|
|
|
collections: [
|
|
Users,
|
|
Media,
|
|
Pages,
|
|
BlogPosts,
|
|
Categories,
|
|
Tags,
|
|
Tariffs,
|
|
Leads,
|
|
Orders,
|
|
Locations,
|
|
Reviews,
|
|
BirthdayPackages,
|
|
],
|
|
|
|
globals: [
|
|
HomePage,
|
|
CheckoutPage,
|
|
ThankYouPage,
|
|
Header,
|
|
Footer,
|
|
SiteSettings,
|
|
DyvoLisPage,
|
|
GroupVisitsPage,
|
|
],
|
|
|
|
plugins: [
|
|
seoPlugin({
|
|
collections: ['pages', 'blog-posts', 'locations'],
|
|
uploadsCollection: 'media',
|
|
generateTitle: ({ doc }) => {
|
|
const title =
|
|
(doc as { title?: string; name?: string }).title ?? (doc as { name?: string }).name ?? ''
|
|
return title ? `${title} — Шуміленд` : 'Шуміленд'
|
|
},
|
|
generateDescription: ({ doc }) => (doc as { excerpt?: string }).excerpt ?? '',
|
|
}),
|
|
],
|
|
|
|
admin: {
|
|
user: 'users',
|
|
livePreview: {
|
|
url: siteURL,
|
|
collections: ['pages'],
|
|
globals: [
|
|
'home-page',
|
|
'checkout-page',
|
|
'thank-you-page',
|
|
'header',
|
|
'footer',
|
|
'site-settings',
|
|
'dyvolis-page',
|
|
'group-visits-page',
|
|
],
|
|
},
|
|
},
|
|
|
|
i18n: {
|
|
fallbackLanguage: 'en',
|
|
},
|
|
|
|
cors: [siteURL],
|
|
|
|
typescript: {
|
|
outputFile: path.resolve(dirname, 'src/payload-types.ts'),
|
|
},
|
|
|
|
telemetry: false,
|
|
})
|