diff --git a/app/Actions/Database/StartClickhouse.php b/app/Actions/Database/StartClickhouse.php index fb38c32d5..d043da410 100644 --- a/app/Actions/Database/StartClickhouse.php +++ b/app/Actions/Database/StartClickhouse.php @@ -99,7 +99,7 @@ class StartClickhouse } $docker_compose = Yaml::dump($docker_compose, 10); $docker_compose_base64 = base64_encode($docker_compose); - $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; + $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; $this->commands[] = "echo 'Pulling {$database->image} image.'"; diff --git a/app/Actions/Database/StartDatabaseProxy.php b/app/Actions/Database/StartDatabaseProxy.php index 89bee1d5a..a1e47710c 100644 --- a/app/Actions/Database/StartDatabaseProxy.php +++ b/app/Actions/Database/StartDatabaseProxy.php @@ -149,9 +149,9 @@ class StartDatabaseProxy instant_remote_process(["docker rm -f $proxyContainerName"], $server, false); 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", + "echo '{$dockerfile_base64}' | base64 -d | tee $configuration_dir/Dockerfile > /dev/null", + "echo '{$nginxconf_base64}' | base64 -d | tee $configuration_dir/nginx.conf > /dev/null", + "echo '{$dockercompose_base64}' | base64 -d | tee $configuration_dir/docker-compose.yaml > /dev/null", "docker compose --project-directory {$configuration_dir} pull", "docker compose --project-directory {$configuration_dir} up --build -d", ], $server); diff --git a/app/Actions/Database/StartDragonfly.php b/app/Actions/Database/StartDragonfly.php index 4fb75b3cb..bb71d8c48 100644 --- a/app/Actions/Database/StartDragonfly.php +++ b/app/Actions/Database/StartDragonfly.php @@ -100,7 +100,7 @@ class StartDragonfly } $docker_compose = Yaml::dump($docker_compose, 10); $docker_compose_base64 = base64_encode($docker_compose); - $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; + $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; $this->commands[] = "echo 'Pulling {$database->image} image.'"; diff --git a/app/Actions/Database/StartKeydb.php b/app/Actions/Database/StartKeydb.php index 7b4bbe124..489c74053 100644 --- a/app/Actions/Database/StartKeydb.php +++ b/app/Actions/Database/StartKeydb.php @@ -107,7 +107,7 @@ class StartKeydb } $docker_compose = Yaml::dump($docker_compose, 10); $docker_compose_base64 = base64_encode($docker_compose); - $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; + $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; $this->commands[] = "echo 'Pulling {$database->image} image.'"; diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.php index 755c47867..e02b28b2e 100644 --- a/app/Actions/Database/StartMariadb.php +++ b/app/Actions/Database/StartMariadb.php @@ -100,7 +100,7 @@ class StartMariadb } $docker_compose = Yaml::dump($docker_compose, 10); $docker_compose_base64 = base64_encode($docker_compose); - $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; + $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; $this->commands[] = "echo 'Pulling {$database->image} image.'"; @@ -171,6 +171,6 @@ class StartMariadb $filename = 'custom-config.cnf'; $content = $this->database->mariadb_conf; $content_base64 = base64_encode($content); - $this->commands[] = "echo '{$content_base64}' | base64 -d > $this->configuration_dir/{$filename}"; + $this->commands[] = "echo '{$content_base64}' | base64 -d | tee $this->configuration_dir/{$filename} > /dev/null"; } } diff --git a/app/Actions/Database/StartMongodb.php b/app/Actions/Database/StartMongodb.php index 180ae988a..7bb6cbcd0 100644 --- a/app/Actions/Database/StartMongodb.php +++ b/app/Actions/Database/StartMongodb.php @@ -116,7 +116,7 @@ class StartMongodb $docker_compose = Yaml::dump($docker_compose, 10); $docker_compose_base64 = base64_encode($docker_compose); - $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; + $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; $this->commands[] = "echo 'Pulling {$database->image} image.'"; @@ -184,13 +184,13 @@ class StartMongodb $filename = 'mongod.conf'; $content = $this->database->mongo_conf; $content_base64 = base64_encode($content); - $this->commands[] = "echo '{$content_base64}' | base64 -d > $this->configuration_dir/{$filename}"; + $this->commands[] = "echo '{$content_base64}' | base64 -d | tee $this->configuration_dir/{$filename} > /dev/null"; } private function add_default_database() { $content = "db = db.getSiblingDB(\"{$this->database->mongo_initdb_database}\");db.createCollection('init_collection');db.createUser({user: \"{$this->database->mongo_initdb_root_username}\", pwd: \"{$this->database->mongo_initdb_root_password}\",roles: [{role:\"readWrite\",db:\"{$this->database->mongo_initdb_database}\"}]});"; $content_base64 = base64_encode($content); $this->commands[] = "mkdir -p $this->configuration_dir/docker-entrypoint-initdb.d"; - $this->commands[] = "echo '{$content_base64}' | base64 -d > $this->configuration_dir/docker-entrypoint-initdb.d/01-default-database.js"; + $this->commands[] = "echo '{$content_base64}' | base64 -d | tee $this->configuration_dir/docker-entrypoint-initdb.d/01-default-database.js > /dev/null"; } } diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.php index 0e2e75719..b3f695d72 100644 --- a/app/Actions/Database/StartMysql.php +++ b/app/Actions/Database/StartMysql.php @@ -100,7 +100,7 @@ class StartMysql } $docker_compose = Yaml::dump($docker_compose, 10); $docker_compose_base64 = base64_encode($docker_compose); - $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; + $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; $this->commands[] = "echo 'Pulling {$database->image} image.'"; @@ -171,6 +171,6 @@ class StartMysql $filename = 'custom-config.cnf'; $content = $this->database->mysql_conf; $content_base64 = base64_encode($content); - $this->commands[] = "echo '{$content_base64}' | base64 -d > $this->configuration_dir/{$filename}"; + $this->commands[] = "echo '{$content_base64}' | base64 -d | tee $this->configuration_dir/{$filename} > /dev/null"; } } diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php index 03b460edc..f19a8b036 100644 --- a/app/Actions/Database/StartPostgresql.php +++ b/app/Actions/Database/StartPostgresql.php @@ -122,7 +122,7 @@ class StartPostgresql } $docker_compose = Yaml::dump($docker_compose, 10); $docker_compose_base64 = base64_encode($docker_compose); - $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; + $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; $this->commands[] = "echo 'Pulling {$database->image} image.'"; @@ -197,7 +197,7 @@ class StartPostgresql $filename = data_get($init_script, 'filename'); $content = data_get($init_script, 'content'); $content_base64 = base64_encode($content); - $this->commands[] = "echo '{$content_base64}' | base64 -d > $this->configuration_dir/docker-entrypoint-initdb.d/{$filename}"; + $this->commands[] = "echo '{$content_base64}' | base64 -d | tee $this->configuration_dir/docker-entrypoint-initdb.d/{$filename} > /dev/null"; $this->init_scripts[] = "$this->configuration_dir/docker-entrypoint-initdb.d/{$filename}"; } } @@ -209,6 +209,6 @@ class StartPostgresql $filename = 'custom-postgres.conf'; $content = $this->database->postgres_conf; $content_base64 = base64_encode($content); - $this->commands[] = "echo '{$content_base64}' | base64 -d > $this->configuration_dir/{$filename}"; + $this->commands[] = "echo '{$content_base64}' | base64 -d | tee $this->configuration_dir/{$filename} > /dev/null"; } } diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.php index ff8c63aab..01e9a9bef 100644 --- a/app/Actions/Database/StartRedis.php +++ b/app/Actions/Database/StartRedis.php @@ -111,7 +111,7 @@ class StartRedis } $docker_compose = Yaml::dump($docker_compose, 10); $docker_compose_base64 = base64_encode($docker_compose); - $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; + $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; $this->commands[] = "echo 'Pulling {$database->image} image.'"; diff --git a/app/Actions/Proxy/SaveConfiguration.php b/app/Actions/Proxy/SaveConfiguration.php index 5fb983d1a..4c413ca36 100644 --- a/app/Actions/Proxy/SaveConfiguration.php +++ b/app/Actions/Proxy/SaveConfiguration.php @@ -23,7 +23,7 @@ class SaveConfiguration return instant_remote_process([ "mkdir -p $proxy_path", - "echo '$docker_compose_yml_base64' | base64 -d > $proxy_path/docker-compose.yml", + "echo '$docker_compose_yml_base64' | base64 -d | tee $proxy_path/docker-compose.yml > /dev/null", ], $server); } } diff --git a/app/Actions/Server/ConfigureCloudflared.php b/app/Actions/Server/ConfigureCloudflared.php index b67572b22..e123444c2 100644 --- a/app/Actions/Server/ConfigureCloudflared.php +++ b/app/Actions/Server/ConfigureCloudflared.php @@ -31,7 +31,7 @@ class ConfigureCloudflared $commands = collect([ "mkdir -p /tmp/cloudflared", "cd /tmp/cloudflared", - "echo '$docker_compose_yml_base64' | base64 -d > docker-compose.yml", + "echo '$docker_compose_yml_base64' | base64 -d | tee docker-compose.yml > /dev/null", "docker compose pull", "docker compose down -v --remove-orphans > /dev/null 2>&1", "docker compose up -d --remove-orphans", diff --git a/app/Actions/Server/InstallDocker.php b/app/Actions/Server/InstallDocker.php index d1db588cd..721d174b8 100644 --- a/app/Actions/Server/InstallDocker.php +++ b/app/Actions/Server/InstallDocker.php @@ -65,7 +65,7 @@ class InstallDocker } else if ($supported_os_type->contains('sles')) { $command = $command->merge([ "echo 'Installing Prerequisites...'", - " zypper update -y", + "zypper update -y", "command -v curl >/dev/null || zypper install -y curl", "command -v wget >/dev/null || zypper install -y wget", "command -v git >/dev/null || zypper install -y git", @@ -78,10 +78,13 @@ class InstallDocker "echo 'Installing Docker Engine...'", "curl https://releases.rancher.com/install-docker/{$dockerVersion}.sh | sh || curl https://get.docker.com | sh -s -- --version {$dockerVersion}", "echo 'Configuring Docker Engine (merging existing configuration with the required)...'", - "test -s /etc/docker/daemon.json && cp /etc/docker/daemon.json \"/etc/docker/daemon.json.original-`date +\"%Y%m%d-%H%M%S\"`\" || echo '{$config}' | base64 -d > /etc/docker/daemon.json", - "echo '{$config}' | base64 -d > /etc/docker/daemon.json.coolify", - "cat <<< $(jq . /etc/docker/daemon.json.coolify) > /etc/docker/daemon.json.coolify", - "cat <<< $(jq -s '.[0] * .[1]' /etc/docker/daemon.json /etc/docker/daemon.json.coolify) > /etc/docker/daemon.json", + "test -s /etc/docker/daemon.json && cp /etc/docker/daemon.json \"/etc/docker/daemon.json.original-$(date +\"%Y%m%d-%H%M%S\")\"", + "test ! -s /etc/docker/daemon.json && echo '{$config}' | base64 -d | tee /etc/docker/daemon.json > /dev/null", + "echo '{$config}' | base64 -d | tee /etc/docker/daemon.json.coolify > /dev/null", + "jq . /etc/docker/daemon.json.coolify | tee /etc/docker/daemon.json.coolify.pretty > /dev/null", + "mv /etc/docker/daemon.json.coolify.pretty /etc/docker/daemon.json.coolify", + "jq -s '.[0] * .[1]' /etc/docker/daemon.json.coolify /etc/docker/daemon.json | tee /etc/docker/daemon.json.appended > /dev/null", + "mv /etc/docker/daemon.json.appended /etc/docker/daemon.json", "echo 'Restarting Docker Engine...'", "systemctl enable docker >/dev/null 2>&1 || true", "systemctl restart docker", diff --git a/app/Actions/Server/InstallLogDrain.php b/app/Actions/Server/InstallLogDrain.php index 86ca69a6e..aa32d4c0b 100644 --- a/app/Actions/Server/InstallLogDrain.php +++ b/app/Actions/Server/InstallLogDrain.php @@ -168,10 +168,10 @@ Files: $command = [ "echo 'Saving configuration'", "mkdir -p $config_path", - "echo '{$parsers}' | base64 -d > $parsers_config", - "echo '{$config}' | base64 -d > $fluent_bit_config", - "echo '{$compose}' | base64 -d > $compose_path", - "echo '{$readme}' | base64 -d > $readme_path", + "echo '{$parsers}' | base64 -d | tee $parsers_config > /dev/null", + "echo '{$config}' | base64 -d | tee $fluent_bit_config > /dev/null", + "echo '{$compose}' | base64 -d | tee $compose_path > /dev/null", + "echo '{$readme}' | base64 -d | tee $readme_path > /dev/null", "test -f $config_path/.env && rm $config_path/.env", ]; diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index fd5d741e0..6591bef02 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -322,7 +322,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted $this->prepare_builder_image(); $this->execute_remote_command( [ - executeInDocker($this->deployment_uuid, "echo '$dockerfile_base64' | base64 -d > {$this->workdir}{$this->dockerfile_location}") + executeInDocker($this->deployment_uuid, "echo '$dockerfile_base64' | base64 -d | tee {$this->workdir}{$this->dockerfile_location} > /dev/null") ], ); $this->generate_image_names(); @@ -391,7 +391,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted } $this->docker_compose_base64 = base64_encode($yaml); $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "echo '{$this->docker_compose_base64}' | base64 -d > {$this->workdir}{$this->docker_compose_location}"), "hidden" => true + executeInDocker($this->deployment_uuid, "echo '{$this->docker_compose_base64}' | base64 -d | tee {$this->workdir}{$this->docker_compose_location} > /dev/null"), "hidden" => true ]); $this->save_environment_variables(); // Build new container to limit downtime. @@ -565,7 +565,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted "mkdir -p $this->configuration_dir" ], [ - "echo '{$this->docker_compose_base64}' | base64 -d > $composeFileName", + "echo '{$this->docker_compose_base64}' | base64 -d | tee $composeFileName > /dev/null", ], [ "echo '{$readme}' > $this->configuration_dir/README.md", @@ -783,10 +783,10 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted $envs_base64 = base64_encode($envs->implode("\n")); $this->execute_remote_command( [ - executeInDocker($this->deployment_uuid, "echo '$envs_base64' | base64 -d > $this->workdir/.env") + executeInDocker($this->deployment_uuid, "echo '$envs_base64' | base64 -d | tee $this->workdir/.env > /dev/null") ], [ - "echo '$envs_base64' | base64 -d > $this->configuration_dir/{$this->env_filename}" + "echo '$envs_base64' | base64 -d | tee $this->configuration_dir/{$this->env_filename} > /dev/null" ] ); } @@ -1027,7 +1027,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted executeInDocker($this->deployment_uuid, "mkdir -p /root/.ssh") ], [ - executeInDocker($this->deployment_uuid, "echo '{$private_key}' | base64 -d > /root/.ssh/id_rsa") + executeInDocker($this->deployment_uuid, "echo '{$private_key}' | base64 -d | tee /root/.ssh/id_rsa > /dev/null") ], [ executeInDocker($this->deployment_uuid, "chmod 600 /root/.ssh/id_rsa") @@ -1412,7 +1412,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted $this->docker_compose = Yaml::dump($docker_compose, 10); $this->docker_compose_base64 = base64_encode($this->docker_compose); - $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->docker_compose_base64}' | base64 -d > {$this->workdir}/docker-compose.yml"), "hidden" => true]); + $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->docker_compose_base64}' | base64 -d | tee {$this->workdir}/docker-compose.yml > /dev/null"), "hidden" => true]); } private function generate_local_persistent_volumes() @@ -1605,7 +1605,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); } else { if ($this->application->build_pack === 'nixpacks') { $this->nixpacks_plan = base64_encode($this->nixpacks_plan); - $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->nixpacks_plan}' | base64 -d > /artifacts/thegameplan.json"), "hidden" => true]); + $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->nixpacks_plan}' | base64 -d | tee /artifacts/thegameplan.json > /dev/null"), "hidden" => true]); if ($this->force_rebuild) { $this->execute_remote_command([ executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --no-cache --no-error-without-start -n {$this->build_image_name} {$this->workdir}"), "hidden" => true @@ -1626,7 +1626,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); } $this->execute_remote_command( [ - executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d > /artifacts/build.sh"), "hidden" => true + executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"), "hidden" => true ], [ executeInDocker($this->deployment_uuid, "bash /artifacts/build.sh"), "hidden" => true @@ -1661,13 +1661,13 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); $base64_build_command = base64_encode($build_command); $this->execute_remote_command( [ - executeInDocker($this->deployment_uuid, "echo '{$dockerfile}' | base64 -d > {$this->workdir}/Dockerfile") + executeInDocker($this->deployment_uuid, "echo '{$dockerfile}' | base64 -d | tee {$this->workdir}/Dockerfile > /dev/null") ], [ - executeInDocker($this->deployment_uuid, "echo '{$nginx_config}' | base64 -d > {$this->workdir}/nginx.conf") + executeInDocker($this->deployment_uuid, "echo '{$nginx_config}' | base64 -d | tee {$this->workdir}/nginx.conf > /dev/null") ], [ - executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d > /artifacts/build.sh"), "hidden" => true + executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"), "hidden" => true ], [ executeInDocker($this->deployment_uuid, "bash /artifacts/build.sh"), "hidden" => true @@ -1680,7 +1680,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); $base64_build_command = base64_encode($build_command); $this->execute_remote_command( [ - executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d > /artifacts/build.sh"), "hidden" => true + executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"), "hidden" => true ], [ executeInDocker($this->deployment_uuid, "bash /artifacts/build.sh"), "hidden" => true @@ -1689,7 +1689,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); } else { if ($this->application->build_pack === 'nixpacks') { $this->nixpacks_plan = base64_encode($this->nixpacks_plan); - $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->nixpacks_plan}' | base64 -d > /artifacts/thegameplan.json"), "hidden" => true]); + $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->nixpacks_plan}' | base64 -d | tee /artifacts/thegameplan.json > /dev/null"), "hidden" => true]); if ($this->force_rebuild) { $this->execute_remote_command([ executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --no-cache --no-error-without-start -n {$this->production_image_name} {$this->workdir}"), "hidden" => true @@ -1710,7 +1710,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); } $this->execute_remote_command( [ - executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d > /artifacts/build.sh"), "hidden" => true + executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"), "hidden" => true ], [ executeInDocker($this->deployment_uuid, "bash /artifacts/build.sh"), "hidden" => true @@ -1828,7 +1828,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); } $dockerfile_base64 = base64_encode($dockerfile->implode("\n")); $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "echo '{$dockerfile_base64}' | base64 -d > {$this->workdir}{$this->dockerfile_location}"), + executeInDocker($this->deployment_uuid, "echo '{$dockerfile_base64}' | base64 -d | tee {$this->workdir}{$this->dockerfile_location} > /dev/null"), "hidden" => true ]); } diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php index e7ce3894a..6a6d94142 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php @@ -163,6 +163,7 @@ class All extends Component $environment->value = $data['value']; $environment->is_build_time = $data['is_build_time']; $environment->is_multiline = $data['is_multiline']; + $environment->is_literal = $data['is_literal']; $environment->is_preview = $data['is_preview']; switch ($this->resource->type()) { diff --git a/app/Livewire/Server/Proxy/NewDynamicConfiguration.php b/app/Livewire/Server/Proxy/NewDynamicConfiguration.php index 06180d947..8110986a9 100644 --- a/app/Livewire/Server/Proxy/NewDynamicConfiguration.php +++ b/app/Livewire/Server/Proxy/NewDynamicConfiguration.php @@ -68,7 +68,7 @@ class NewDynamicConfiguration extends Component } $base64_value = base64_encode($this->value); instant_remote_process([ - "echo '{$base64_value}' | base64 -d > {$file}", + "echo '{$base64_value}' | base64 -d | tee {$file} > /dev/null", ], $this->server); if ($proxy_type === 'CADDY') { $this->server->reloadCaddy(); diff --git a/app/Models/Application.php b/app/Models/Application.php index 4c2d23d8f..66e18565b 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -653,13 +653,13 @@ class Application extends BaseModel if ($exec_in_docker) { $commands = collect([ executeInDocker($deployment_uuid, "mkdir -p /root/.ssh"), - executeInDocker($deployment_uuid, "echo '{$private_key}' | base64 -d > /root/.ssh/id_rsa"), + executeInDocker($deployment_uuid, "echo '{$private_key}' | base64 -d | tee /root/.ssh/id_rsa > /dev/null"), executeInDocker($deployment_uuid, "chmod 600 /root/.ssh/id_rsa"), ]); } else { $commands = collect([ "mkdir -p /root/.ssh", - "echo '{$private_key}' | base64 -d > /root/.ssh/id_rsa", + "echo '{$private_key}' | base64 -d | tee /root/.ssh/id_rsa > /dev/null", "chmod 600 /root/.ssh/id_rsa", ]); } diff --git a/app/Models/LocalFileVolume.php b/app/Models/LocalFileVolume.php index 25cb6bee7..5595bbb13 100644 --- a/app/Models/LocalFileVolume.php +++ b/app/Models/LocalFileVolume.php @@ -83,7 +83,7 @@ class LocalFileVolume extends BaseModel $content = base64_encode($content); $chmod = $fileVolume->chmod; $chown = $fileVolume->chown; - $commands->push("echo '$content' | base64 -d > $path"); + $commands->push("echo '$content' | base64 -d | tee $path > /dev/null"); $commands->push("chmod +x $path"); if ($chown) { $commands->push("chown $chown $path"); diff --git a/app/Models/Server.php b/app/Models/Server.php index 7afadecfc..fb3443d94 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -141,7 +141,7 @@ respond 404 $base64 = base64_encode($conf); instant_remote_process([ "mkdir -p $dynamic_conf_path", - "echo '$base64' | base64 -d > $default_redirect_file", + "echo '$base64' | base64 -d | tee $default_redirect_file > /dev/null", ], $this); $this->reloadCaddy(); return; @@ -223,7 +223,7 @@ respond 404 instant_remote_process([ "mkdir -p $dynamic_conf_path", - "echo '$base64' | base64 -d > $default_redirect_file", + "echo '$base64' | base64 -d | tee $default_redirect_file > /dev/null", ], $this); if (config('app.env') == 'local') { @@ -349,7 +349,7 @@ respond 404 $base64 = base64_encode($yaml); instant_remote_process([ "mkdir -p $dynamic_config_path", - "echo '$base64' | base64 -d > $file", + "echo '$base64' | base64 -d | tee $file > /dev/null", ], $this); if (config('app.env') == 'local') { @@ -376,7 +376,7 @@ $schema://$host { }"; $base64 = base64_encode($caddy_file); instant_remote_process([ - "echo '$base64' | base64 -d > $file", + "echo '$base64' | base64 -d | tee $file > /dev/null", ], $this); $this->reloadCaddy(); } diff --git a/app/Models/Service.php b/app/Models/Service.php index baf4c0060..49939ee8b 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -665,7 +665,7 @@ class Service extends BaseModel $commands[] = "cd $workdir"; $docker_compose_base64 = base64_encode($this->docker_compose); - $commands[] = "echo $docker_compose_base64 | base64 -d > docker-compose.yml"; + $commands[] = "echo $docker_compose_base64 | base64 -d | tee docker-compose.yml > /dev/null"; $envs = $this->environment_variables()->get(); $commands[] = "rm -f .env || true"; foreach ($envs as $env) { diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php index 44a541118..a70c85a72 100644 --- a/bootstrap/helpers/docker.php +++ b/bootstrap/helpers/docker.php @@ -582,7 +582,7 @@ function validateComposeFile(string $compose, int $server_id): string|Throwable $server = Server::findOrFail($server_id); $base64_compose = base64_encode($compose); $output = instant_remote_process([ - "echo {$base64_compose} | base64 -d > /tmp/{$uuid}.yml", + "echo {$base64_compose} | base64 -d | tee /tmp/{$uuid}.yml > /dev/null", "docker compose -f /tmp/{$uuid}.yml config", ], $server); ray($output); diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index 85533550b..98255de76 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -35,6 +35,7 @@ function remote_process( if ($server->isNonRoot()) { $command = parseCommandsByLineForSudo(collect($command), $server); } + ray($command); $command_string = implode("\n", $command); if (auth()->user()) { $teams = auth()->user()->teams->pluck('id'); diff --git a/bootstrap/helpers/services.php b/bootstrap/helpers/services.php index 649e9c320..8e3c0337e 100644 --- a/bootstrap/helpers/services.php +++ b/bootstrap/helpers/services.php @@ -71,7 +71,7 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli $dir = Str::of($fileLocation)->dirname(); instant_remote_process([ "mkdir -p $dir", - "echo '$content' | base64 -d > $fileLocation" + "echo '$content' | base64 -d | tee $fileLocation" ], $server); } else if ($isFile == 'NOK' && $isDir == 'NOK' && $fileVolume->is_directory && $isInit) { $fileVolume->content = null; diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index dae9542f6..966b1db59 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -1954,7 +1954,7 @@ function check_domain_usage(ServiceApplication|Application|null $resource = null function parseCommandsByLineForSudo(Collection $commands, Server $server): array { $commands = $commands->map(function ($line) { - if (!str($line)->startSwith('cd') && !str($line)->startSwith('command')) { + if (!str($line)->startsWith('cd') && !str($line)->startsWith('command') && !str($line)->startsWith('echo') && !str($line)->startsWith('true')) { return "sudo $line"; } return $line; @@ -1966,16 +1966,20 @@ function parseCommandsByLineForSudo(Collection $commands, Server $server): array return $line; }); $commands = $commands->map(function ($line) { - if (str($line)->contains('$(') || str($line)->contains('`')) { - return str($line)->replace('$(', '$(sudo ')->replace('`', '`sudo ')->value(); + $line = str($line); + if (str($line)->contains('$(')) { + $line = $line->replace('$(', '$(sudo '); } if (str($line)->contains('||')) { - return str($line)->replace('||', '|| sudo ')->value(); + $line = $line->replace('||', '|| sudo'); } if (str($line)->contains('&&')) { - return str($line)->replace('&&', '&& sudo ')->value(); + $line = $line->replace('&&', '&& sudo'); } - return $line; + if (str($line)->contains(' | ')) { + $line = $line->replace(' | ', ' | sudo '); + } + return $line->value(); }); return $commands->toArray(); diff --git a/resources/views/livewire/server/new/by-ip.blade.php b/resources/views/livewire/server/new/by-ip.blade.php index 9d78c0b35..ac5cf7f79 100644 --- a/resources/views/livewire/server/new/by-ip.blade.php +++ b/resources/views/livewire/server/new/by-ip.blade.php @@ -10,9 +10,10 @@
- - -
+ + + +
Non-root user is experimental.
@foreach ($private_keys as $key)