fix: Dokploy domain.create uses 'host' (not 'hostName') + certificateType: letsencrypt
- Field name: hostName → host (verified via direct API test) - Added certificateType: 'letsencrypt' for automatic HTTPS cert provisioning - Updated createDomain in dokploy.ts + custom-domain route - HTTPS is enabled by default (https: true) - Let's Encrypt auto-provisions certificate for the subdomain
This commit is contained in:
1 parent
4b6a1946b4
commit
7e458ae698
2 files changed
+9
-5
No files matched your search
@@ -183,9 +183,10 @@ export async function PATCH(req: Request, { params }: { params: Promise<{ id: st
|
|||||||
try {
|
try {
|
||||||
await dokploy.createDomain({
|
await dokploy.createDomain({
|
||||||
applicationId: instance.dokployAppId,
|
applicationId: instance.dokployAppId,
|
||||||
hostName: instance.customDomain,
|
host: instance.customDomain,
|
||||||
port: 3000,
|
port: 3000,
|
||||||
https: true,
|
https: true,
|
||||||
|
certificateType: 'letsencrypt',
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Non-fatal — domain verification still succeeded, Dokploy attach can retry
|
// Non-fatal — domain verification still succeeded, Dokploy attach can retry
|
||||||
|
|||||||
+7
-4
@@ -259,17 +259,19 @@ export function createDokployClient(config: DokployConfig) {
|
|||||||
|
|
||||||
async function createDomain(input: {
|
async function createDomain(input: {
|
||||||
applicationId: string
|
applicationId: string
|
||||||
hostName: string
|
host: string
|
||||||
path?: string
|
path?: string
|
||||||
port?: number
|
port?: number
|
||||||
https?: boolean
|
https?: boolean
|
||||||
|
certificateType?: string
|
||||||
}): Promise<DokployDomain> {
|
}): Promise<DokployDomain> {
|
||||||
const res = await call<{ domainId?: string; id?: string }>('/domain.create', {
|
const res = await call<{ domainId?: string; id?: string }>('/domain.create', {
|
||||||
applicationId: input.applicationId,
|
applicationId: input.applicationId,
|
||||||
hostName: input.hostName,
|
host: input.host,
|
||||||
path: input.path ?? '/',
|
path: input.path ?? '/',
|
||||||
port: input.port ?? 3000,
|
port: input.port ?? 3000,
|
||||||
https: input.https ?? true,
|
https: input.https ?? true,
|
||||||
|
certificateType: input.certificateType ?? 'letsencrypt',
|
||||||
})
|
})
|
||||||
const domainId = res.domainId ?? res.id
|
const domainId = res.domainId ?? res.id
|
||||||
if (!domainId) {
|
if (!domainId) {
|
||||||
@@ -277,7 +279,7 @@ export function createDokployClient(config: DokployConfig) {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
domainId,
|
domainId,
|
||||||
hostName: input.hostName,
|
hostName: input.host,
|
||||||
applicationId: input.applicationId,
|
applicationId: input.applicationId,
|
||||||
https: input.https ?? true,
|
https: input.https ?? true,
|
||||||
}
|
}
|
||||||
@@ -349,9 +351,10 @@ export function createDokployClient(config: DokployConfig) {
|
|||||||
try {
|
try {
|
||||||
domain = await createDomain({
|
domain = await createDomain({
|
||||||
applicationId: app.applicationId,
|
applicationId: app.applicationId,
|
||||||
hostName: input.subdomain,
|
host: input.subdomain,
|
||||||
port: 3000,
|
port: 3000,
|
||||||
https: true,
|
https: true,
|
||||||
|
certificateType: 'letsencrypt',
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Domain creation is non-fatal — app is already deployed
|
// Domain creation is non-fatal — app is already deployed
|
||||||
|
|||||||
Reference in new issue
Block a user