fix: tcp proxy
This commit is contained in:
parent
5bc44ac70d
commit
488ce1961a
@ -508,7 +508,7 @@ export async function startTraefikProxy(id: string): Promise<void> {
|
|||||||
const { engine, network, remoteEngine, remoteIpAddress } = await prisma.destinationDocker.findUnique({ where: { id } })
|
const { engine, network, remoteEngine, remoteIpAddress } = await prisma.destinationDocker.findUnique({ where: { id } })
|
||||||
|
|
||||||
const found = await checkContainer({ dockerId: id, container: 'coolify-proxy', remove: true });
|
const found = await checkContainer({ dockerId: id, container: 'coolify-proxy', remove: true });
|
||||||
const { id: settingsId } = await listSettings();
|
const { id: settingsId, ipv4, ipv6 } = await listSettings();
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
const { stdout: Config } = await executeDockerCmd({ dockerId: id, command: `docker network inspect ${network} --format '{{json .IPAM.Config }}'` })
|
const { stdout: Config } = await executeDockerCmd({ dockerId: id, command: `docker network inspect ${network} --format '{{json .IPAM.Config }}'` })
|
||||||
@ -520,7 +520,7 @@ export async function startTraefikProxy(id: string): Promise<void> {
|
|||||||
if (isDev) {
|
if (isDev) {
|
||||||
ip = getAPIUrl()
|
ip = getAPIUrl()
|
||||||
} else {
|
} else {
|
||||||
ip = `http://${await publicIp({ timeout: 2000 })}`
|
ip = `http://${ipv4 || ipv6}`
|
||||||
}
|
}
|
||||||
traefikUrl = `${ip}/webhooks/traefik/remote/${id}`
|
traefikUrl = `${ip}/webhooks/traefik/remote/${id}`
|
||||||
}
|
}
|
||||||
@ -1082,9 +1082,11 @@ export async function startTraefikTCPProxy(
|
|||||||
privatePort: number,
|
privatePort: number,
|
||||||
type?: string
|
type?: string
|
||||||
): Promise<{ stdout: string; stderr: string } | Error> {
|
): Promise<{ stdout: string; stderr: string } | Error> {
|
||||||
const { network, id: dockerId } = destinationDocker;
|
const { network, id: dockerId, remoteEngine } = destinationDocker;
|
||||||
const container = `${id}-${publicPort}`;
|
const container = `${id}-${publicPort}`;
|
||||||
const found = await checkContainer({ dockerId, container, remove: true });
|
const found = await checkContainer({ dockerId, container, remove: true });
|
||||||
|
const { ipv4, ipv6 } = await listSettings();
|
||||||
|
|
||||||
let dependentId = id;
|
let dependentId = id;
|
||||||
if (type === 'wordpressftp') dependentId = `${id}-ftp`;
|
if (type === 'wordpressftp') dependentId = `${id}-ftp`;
|
||||||
const foundDependentContainer = await checkContainer({ dockerId, container: dependentId, remove: true });
|
const foundDependentContainer = await checkContainer({ dockerId, container: dependentId, remove: true });
|
||||||
@ -1096,12 +1098,22 @@ export async function startTraefikTCPProxy(
|
|||||||
})
|
})
|
||||||
|
|
||||||
const ip = JSON.parse(Config)[0].Gateway;
|
const ip = JSON.parse(Config)[0].Gateway;
|
||||||
|
let traefikUrl = otherTraefikEndpoint
|
||||||
|
if (remoteEngine) {
|
||||||
|
let ip = null
|
||||||
|
if (isDev) {
|
||||||
|
ip = getAPIUrl()
|
||||||
|
} else {
|
||||||
|
ip = `http://${ipv4 || ipv6}`
|
||||||
|
}
|
||||||
|
traefikUrl = `${ip}/webhooks/traefik/other.json`
|
||||||
|
}
|
||||||
const tcpProxy = {
|
const tcpProxy = {
|
||||||
version: '3.8',
|
version: '3.8',
|
||||||
services: {
|
services: {
|
||||||
[`${id}-${publicPort}`]: {
|
[`${id}-${publicPort}`]: {
|
||||||
container_name: container,
|
container_name: container,
|
||||||
image: 'traefik:v2.8',
|
image: defaultTraefikImage,
|
||||||
command: [
|
command: [
|
||||||
`--entrypoints.tcp.address=:${publicPort}`,
|
`--entrypoints.tcp.address=:${publicPort}`,
|
||||||
`--entryPoints.tcp.forwardedHeaders.insecure=true`,
|
`--entryPoints.tcp.forwardedHeaders.insecure=true`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user