Skip to content

Commit

Permalink
put a few things on high queue
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Nov 6, 2024
1 parent 0aa2ba6 commit 275edb6
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 30 deletions.
2 changes: 1 addition & 1 deletion app/Actions/Database/StartDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
break;
}
if ($database->is_public && $database->public_port) {
StartDatabaseProxy::dispatch($database);
StartDatabaseProxy::dispatch($database)->onQueue('high');
}

return $activity;
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Server/InstallDocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class InstallDocker

public function handle(Server $server)
{
$dockerVersion = config('constants.docker_install_version');
$supported_os_type = $server->validateOS();
if (! $supported_os_type) {
throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/installation#manually">documentation</a>.');
}
$dockerVersion = '26.0';
$config = base64_encode('{
"log-driver": "json-file",
"log-opts": {
Expand Down
4 changes: 2 additions & 2 deletions app/Actions/Server/ServerCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ private function checkLogDrainContainer()
if ($foundLogDrainContainer) {
$status = data_get($foundLogDrainContainer, 'State.Status');
if ($status !== 'running') {
StartLogDrain::dispatch($this->server);
StartLogDrain::dispatch($this->server)->onQueue('high');
}
} else {
StartLogDrain::dispatch($this->server);
StartLogDrain::dispatch($this->server)->onQueue('high');
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private function disable_metrics()
$server->settings->update(['is_metrics_enabled' => false]);
}
if ($server->isFunctional()) {
StopSentinel::dispatch($server);
StopSentinel::dispatch($server)->onQueue('high');
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/ServicesDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private function deleteApplication()
if (! $confirmed) {
break;
}
DeleteResourceJob::dispatch($toDelete);
DeleteResourceJob::dispatch($toDelete)->onQueue('high');
}
}
}
Expand All @@ -122,7 +122,7 @@ private function deleteDatabase()
if (! $confirmed) {
return;
}
DeleteResourceJob::dispatch($toDelete);
DeleteResourceJob::dispatch($toDelete)->onQueue('high');
}
}
}
Expand All @@ -148,7 +148,7 @@ private function deleteService()
if (! $confirmed) {
return;
}
DeleteResourceJob::dispatch($toDelete);
DeleteResourceJob::dispatch($toDelete)->onQueue('high');
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApplicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ public function delete_by_uuid(Request $request)
deleteVolumes: $request->query->get('delete_volumes', true),
dockerCleanup: $request->query->get('docker_cleanup', true),
deleteConnectedNetworks: $request->query->get('delete_connected_networks', true)
);
)->onQueue('high');

return response()->json([
'message' => 'Application deletion request queued.',
Expand Down Expand Up @@ -2482,7 +2482,7 @@ public function action_stop(Request $request)
if (! $application) {
return response()->json(['message' => 'Application not found.'], 404);
}
StopApplication::dispatch($application);
StopApplication::dispatch($application)->onQueue('high');

return response()->json(
[
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Api/DatabasesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@ public function update_by_uuid(Request $request)
$database->update($request->all());

if ($whatToDoWithDatabaseProxy === 'start') {
StartDatabaseProxy::dispatch($database);
StartDatabaseProxy::dispatch($database)->onQueue('high');
} elseif ($whatToDoWithDatabaseProxy === 'stop') {
StopDatabaseProxy::dispatch($database);
StopDatabaseProxy::dispatch($database)->onQueue('high');
}

return response()->json([
Expand Down Expand Up @@ -1593,7 +1593,7 @@ public function delete_by_uuid(Request $request)
deleteVolumes: $request->query->get('delete_volumes', true),
dockerCleanup: $request->query->get('docker_cleanup', true),
deleteConnectedNetworks: $request->query->get('delete_connected_networks', true)
);
)->onQueue('high');

return response()->json([
'message' => 'Database deletion request queued.',
Expand Down Expand Up @@ -1742,7 +1742,7 @@ public function action_stop(Request $request)
if (str($database->status)->contains('stopped') || str($database->status)->contains('exited')) {
return response()->json(['message' => 'Database is already stopped.'], 400);
}
StopDatabase::dispatch($database);
StopDatabase::dispatch($database)->onQueue('high');

return response()->json(
[
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Api/ServersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ public function create_server(Request $request)
'is_build_server' => $request->is_build_server,
]);
if ($request->instant_validate) {
ValidateServer::dispatch($server);
ValidateServer::dispatch($server)->onQueue('high');
}

return response()->json([
Expand Down Expand Up @@ -651,7 +651,7 @@ public function update_server(Request $request)
]);
}
if ($request->instant_validate) {
ValidateServer::dispatch($server);
ValidateServer::dispatch($server)->onQueue('high');
}

return response()->json(serializeApiResponse($server))->setStatusCode(201);
Expand Down Expand Up @@ -787,7 +787,7 @@ public function validate_server(Request $request)
if (! $server) {
return response()->json(['message' => 'Server not found.'], 404);
}
ValidateServer::dispatch($server);
ValidateServer::dispatch($server)->onQueue('high');

return response()->json(['message' => 'Validation started.']);
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ServicesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public function delete_by_uuid(Request $request)
deleteVolumes: $request->query->get('delete_volumes', true),
dockerCleanup: $request->query->get('docker_cleanup', true),
deleteConnectedNetworks: $request->query->get('delete_connected_networks', true)
);
)->onQueue('high');

return response()->json([
'message' => 'Service deletion request queued.',
Expand Down Expand Up @@ -1154,7 +1154,7 @@ public function action_stop(Request $request)
if (str($service->status())->contains('stopped') || str($service->status())->contains('exited')) {
return response()->json(['message' => 'Service is already stopped.'], 400);
}
StopService::dispatch($service);
StopService::dispatch($service)->onQueue('high');

return response()->json(
[
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/PushServerUpdateJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private function isRunning(string $containerStatus)
private function checkLogDrainContainer()
{
if ($this->server->isLogDrainEnabled() && $this->foundLogDrainContainer === false) {
StartLogDrain::dispatch($this->server);
StartLogDrain::dispatch($this->server)->onQueue('high');
}
}
}
4 changes: 2 additions & 2 deletions app/Jobs/ServerCheckJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ private function checkLogDrainContainer()
if ($foundLogDrainContainer) {
$status = data_get($foundLogDrainContainer, 'State.Status');
if ($status !== 'running') {
StartLogDrain::dispatch($this->server);
StartLogDrain::dispatch($this->server)->onQueue('high');
}
} else {
StartLogDrain::dispatch($this->server);
StartLogDrain::dispatch($this->server)->onQueue('high');
}
}
}
1 change: 1 addition & 0 deletions config/constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

return [
'docker_install_version' => '26.0',
'docs' => [
'base_url' => 'https://coolify.io/docs',
'contact' => 'https://coolify.io/docs/contact',
Expand Down
20 changes: 12 additions & 8 deletions other/nightly/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ set -e # Exit immediately if a command exits with a non-zero status
## $1 could be empty, so we need to disable this check
#set -u # Treat unset variables as an error and exit
set -o pipefail # Cause a pipeline to return the status of the last command that exited with a non-zero status
CDN="https://cdn.coollabs.io/coolify-nightly"
CDN="https://cdn.coollabs.io/coolify"
DATE=$(date +"%Y%m%d-%H%M%S")

VERSION="1.6"
DOCKER_VERSION="26.0"
# TODO: Ask for a user
CURRENT_USER=$USER

mkdir -p /data/coolify/{source,ssh,applications,databases,backups,services,proxy,webhooks-during-maintenance,metrics,logs}
mkdir -p /data/coolify/{source,ssh,applications,databases,backups,services,proxy,webhooks-during-maintenance,sentinel}
mkdir -p /data/coolify/ssh/{keys,mux}
mkdir -p /data/coolify/proxy/dynamic

Expand Down Expand Up @@ -164,7 +164,6 @@ sles | opensuse-leap | opensuse-tumbleweed)
esac



echo -e "2. Check OpenSSH server configuration. "

# Detect OpenSSH server
Expand Down Expand Up @@ -262,9 +261,14 @@ if ! [ -x "$(command -v docker)" ]; then
fi
;;
*)
curl -s https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh >/dev/null 2>&1
if [ "$OS_TYPE" = "ubuntu" ] && [ "$OS_VERSION" = "24.10" ]; then
echo "Docker automated installation is not supported on Ubuntu 24.10 (non-LTS release)."
echo "Please install Docker manually."
exit 1
fi
curl -s https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh 2>&1
if ! [ -x "$(command -v docker)" ]; then
curl -s https://get.docker.com | sh -s -- --version ${DOCKER_VERSION} >/dev/null 2>&1
curl -s https://get.docker.com | sh -s -- --version ${DOCKER_VERSION} 2>&1
if ! [ -x "$(command -v docker)" ]; then
echo " - Docker installation failed."
echo " Maybe your OS is not supported?"
Expand Down Expand Up @@ -404,10 +408,10 @@ if [ ! -f ~/.ssh/authorized_keys ]; then
fi

set +e
IF_COOLIFY_VOLUME_EXISTS=$(docker volume ls | grep coolify-db | wc -l)
IS_COOLIFY_VOLUME_EXISTS=$(docker volume ls | grep coolify-db | wc -l)
set -e

if [ "$IF_COOLIFY_VOLUME_EXISTS" -eq 0 ]; then
if [ "$IS_COOLIFY_VOLUME_EXISTS" -eq 0 ]; then
echo " - Generating SSH key."
ssh-keygen -t ed25519 -a 100 -f /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal -q -N "" -C coolify
chown 9999 /data/coolify/ssh/keys/id.$CURRENT_USER@host.docker.internal
Expand All @@ -424,7 +428,7 @@ echo -e " - It could take a while based on your server's performance, network sp
echo -e " - Please wait."
getAJoke

bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}" >/dev/null 2>&1
bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}"
echo " - Coolify installed successfully."
rm -f $ENV_FILE-$DATE

Expand Down

0 comments on commit 275edb6

Please sign in to comment.