SYS-18: add production deployment stack for karbe.cosmolan.fr (Stripe test)
- enable Next.js standalone output and add Docker/Caddy production stack - add production env template and deployment runbook - add healthcheck endpoint for container supervision - fix existing lint/type blockers discovered during validation Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
0a366c65db
commit
c9be24a969
11 changed files with 201 additions and 5 deletions
7
src/app/api/health/route.ts
Normal file
7
src/app/api/health/route.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { NextResponse } from "next/server";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
export async function GET() {
|
||||
return NextResponse.json({ status: "ok" });
|
||||
}
|
||||
|
|
@ -97,11 +97,16 @@ async function handlePaymentIntentFailed(paymentIntent: Stripe.PaymentIntent) {
|
|||
}
|
||||
|
||||
async function handleSubscriptionUpdated(subscription: Stripe.Subscription) {
|
||||
const currentPeriodEnd =
|
||||
subscription.items.data[0]?.current_period_end ??
|
||||
subscription.trial_end ??
|
||||
subscription.canceled_at;
|
||||
|
||||
await prisma.subscription.upsert({
|
||||
where: { providerSubId: subscription.id },
|
||||
update: {
|
||||
status: mapStripeSubscriptionStatus(subscription.status),
|
||||
renewedAt: fromStripeTimestamp(subscription.current_period_end),
|
||||
renewedAt: fromStripeTimestamp(currentPeriodEnd),
|
||||
canceledAt: fromStripeTimestamp(subscription.canceled_at),
|
||||
},
|
||||
create: {
|
||||
|
|
@ -111,7 +116,7 @@ async function handleSubscriptionUpdated(subscription: Stripe.Subscription) {
|
|||
providerSubId: subscription.id,
|
||||
status: mapStripeSubscriptionStatus(subscription.status),
|
||||
startedAt: fromStripeTimestamp(subscription.start_date) ?? new Date(),
|
||||
renewedAt: fromStripeTimestamp(subscription.current_period_end),
|
||||
renewedAt: fromStripeTimestamp(currentPeriodEnd),
|
||||
canceledAt: fromStripeTimestamp(subscription.canceled_at),
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue