Merge pull request #596 from Dokploy/595-dokploy-internal-postgres-database-is-publicly-accessible-by-default

fix(dokploy): remove expose ports in production
This commit is contained in:
Mauricio Siu
2024-10-25 20:19:14 -06:00
committed by GitHub
2 changed files with 24 additions and 20 deletions

View File

@@ -32,16 +32,18 @@ export const initializePostgres = async () => {
Replicas: 1, Replicas: 1,
}, },
}, },
EndpointSpec: { ...(process.env.NODE_ENV === "development" && {
Ports: [ EndpointSpec: {
{ Ports: [
TargetPort: 5432, {
PublishedPort: process.env.NODE_ENV === "development" ? 5432 : 0, TargetPort: 5432,
Protocol: "tcp", PublishedPort: 5432,
PublishMode: "host", Protocol: "tcp",
}, PublishMode: "host",
], },
}, ],
},
}),
}; };
try { try {
await pullImage(imageName); await pullImage(imageName);

View File

@@ -29,16 +29,18 @@ export const initializeRedis = async () => {
Replicas: 1, Replicas: 1,
}, },
}, },
EndpointSpec: { ...(process.env.NODE_ENV === "development" && {
Ports: [ EndpointSpec: {
{ Ports: [
TargetPort: 6379, {
PublishedPort: process.env.NODE_ENV === "development" ? 6379 : 0, TargetPort: 6379,
Protocol: "tcp", PublishedPort: 6379,
PublishMode: "host", Protocol: "tcp",
}, PublishMode: "host",
], },
}, ],
},
}),
}; };
try { try {
await pullImage(imageName); await pullImage(imageName);