Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: tcp proxy for dbs

Andras Bacsai84d8e354119f
diff --git a/bootstrap/helpers/proxy.php b/bootstrap/helpers/proxy.php
index 316628958d..86034282ed 100644
--- a/bootstrap/helpers/proxy.php
+++ b/bootstrap/helpers/proxy.php
@@ -204,17 +204,23 @@ stream {
proxy_pass $database->uuid:5432;
}
}
+EOF;
+ $dockerfile = <<< EOF
+FROM nginx:stable-alpine
+
+COPY nginx.conf /etc/nginx/nginx.conf
EOF;
$docker_compose = [
'version' => '3.8',
'services' => [
$containerName => [
+ 'build' => [
+ 'context' => $configuration_dir,
+ 'dockerfile' => 'Dockerfile',
+ ],
'image' => "nginx:stable-alpine",
'container_name' => $containerName,
'restart' => RESTART_MODE,
- 'volumes' => [
- "$configuration_dir/nginx.conf:/etc/nginx/nginx.conf:ro",
- ],
'ports' => [
"$database->public_port:$database->public_port",
],
@@ -243,13 +249,13 @@ EOF;
];
$dockercompose_base64 = base64_encode(Yaml::dump($docker_compose, 4, 2));
$nginxconf_base64 = base64_encode($nginxconf);
+ $dockerfile_base64 = base64_encode($dockerfile);
instant_remote_process([
"mkdir -p $configuration_dir",
+ "echo '{$dockerfile_base64}' | base64 -d > $configuration_dir/Dockerfile",
"echo '{$nginxconf_base64}' | base64 -d > $configuration_dir/nginx.conf",
"echo '{$dockercompose_base64}' | base64 -d > $configuration_dir/docker-compose.yaml",
- "docker compose --project-directory {$configuration_dir} up -d --remove-orphans >/dev/null",
-
-
+ "docker compose --project-directory {$configuration_dir} up --build -d >/dev/null",
], $database->destination->server);
}
function stopPostgresProxy(StandalonePostgresql $database)