mirror of
https://github.com/ershisan99/coolify.git
synced 2026-01-04 12:33:47 +00:00
Compare commits
11 Commits
v4.0.0-bet
...
v4.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5240abbe5 | ||
|
|
abf5840f97 | ||
|
|
dc6d5af4aa | ||
|
|
0b88cd69f2 | ||
|
|
ce165719d6 | ||
|
|
4f543ce20f | ||
|
|
55f957df21 | ||
|
|
38f59b9410 | ||
|
|
ebe6655349 | ||
|
|
038ea08ca7 | ||
|
|
ba424efd39 |
@@ -516,13 +516,35 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
private function check_git_if_build_needed()
|
private function check_git_if_build_needed()
|
||||||
{
|
{
|
||||||
$this->generate_git_import_commands();
|
$this->generate_git_import_commands();
|
||||||
$this->execute_remote_command(
|
$private_key = data_get($this->application, 'private_key.private_key');
|
||||||
[
|
if ($private_key) {
|
||||||
executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" git ls-remote {$this->fullRepoUrl} {$this->branch}"),
|
$private_key = base64_encode($private_key);
|
||||||
"hidden" => true,
|
$this->execute_remote_command(
|
||||||
"save" => "git_commit_sha"
|
[
|
||||||
],
|
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, "chmod 600 /root/.ssh/id_rsa")
|
||||||
|
],
|
||||||
|
[
|
||||||
|
executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git ls-remote {$this->fullRepoUrl} {$this->branch}"),
|
||||||
|
"hidden" => true,
|
||||||
|
"save" => "git_commit_sha"
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->execute_remote_command(
|
||||||
|
[
|
||||||
|
executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" git ls-remote {$this->fullRepoUrl} {$this->branch}"),
|
||||||
|
"hidden" => true,
|
||||||
|
"save" => "git_commit_sha"
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->commit = $this->saved_outputs->get('git_commit_sha')->before("\t");
|
$this->commit = $this->saved_outputs->get('git_commit_sha')->before("\t");
|
||||||
}
|
}
|
||||||
private function clone_repository()
|
private function clone_repository()
|
||||||
@@ -676,7 +698,12 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
$environment_variables = $this->generate_environment_variables($ports);
|
$environment_variables = $this->generate_environment_variables($ports);
|
||||||
|
|
||||||
if (data_get($this->application, 'custom_labels')) {
|
if (data_get($this->application, 'custom_labels')) {
|
||||||
$labels = collect(str($this->application->custom_labels)->explode(',')->toArray());
|
$labels = collect(str($this->application->custom_labels)->explode(','));
|
||||||
|
$labels = $labels->filter(function ($value, $key) {
|
||||||
|
return !Str::startsWith($value, 'coolify.');
|
||||||
|
});
|
||||||
|
$this->application->custom_labels = $labels->implode(',');
|
||||||
|
$this->application->save();
|
||||||
} else {
|
} else {
|
||||||
$labels = collect(generateLabelsApplication($this->application, $this->preview));
|
$labels = collect(generateLabelsApplication($this->application, $this->preview));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,14 +39,18 @@ class Subscription extends Model
|
|||||||
if (!$subscription) {
|
if (!$subscription) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$subscriptionPlanId = data_get($subscription,'stripe_plan_id');
|
$subscriptionPlanId = data_get($subscription, 'stripe_plan_id');
|
||||||
if (!$subscriptionPlanId) {
|
if (!$subscriptionPlanId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
$subscriptionInvoicePaid = data_get($subscription, 'stripe_invoice_paid');
|
||||||
|
if (!$subscriptionInvoicePaid) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$subscriptionConfigs = collect(config('subscription'));
|
$subscriptionConfigs = collect(config('subscription'));
|
||||||
$stripePlanId = null;
|
$stripePlanId = null;
|
||||||
$subscriptionConfigs->map(function ($value, $key) use ($subscriptionPlanId, &$stripePlanId) {
|
$subscriptionConfigs->map(function ($value, $key) use ($subscriptionPlanId, &$stripePlanId) {
|
||||||
if ($value === $subscriptionPlanId){
|
if ($value === $subscriptionPlanId) {
|
||||||
$stripePlanId = $key;
|
$stripePlanId = $key;
|
||||||
};
|
};
|
||||||
})->first();
|
})->first();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ return [
|
|||||||
|
|
||||||
// The release version of your application
|
// The release version of your application
|
||||||
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
||||||
'release' => '4.0.0-beta.105',
|
'release' => '4.0.0-beta.108',
|
||||||
// When left empty or `null` the Laravel environment will be used
|
// When left empty or `null` the Laravel environment will be used
|
||||||
'environment' => config('app.env'),
|
'environment' => config('app.env'),
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return '4.0.0-beta.105';
|
return '4.0.0-beta.108';
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ Route::post('/source/github/events', function () {
|
|||||||
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||||
if ($found) {
|
if ($found) {
|
||||||
$found->delete();
|
$found->delete();
|
||||||
$container_name = generateApplicationContainerName($application,$pull_request_id);
|
$container_name = generateApplicationContainerName($application, $pull_request_id);
|
||||||
// ray('Stopping container: ' . $container_name);
|
// ray('Stopping container: ' . $container_name);
|
||||||
instant_remote_process(["docker rm -f $container_name"], $application->destination->server);
|
instant_remote_process(["docker rm -f $container_name"], $application->destination->server);
|
||||||
return response('Preview Deployment closed.');
|
return response('Preview Deployment closed.');
|
||||||
@@ -288,6 +288,14 @@ Route::post('/payments/stripe/events', function () {
|
|||||||
'stripe_invoice_paid' => true,
|
'stripe_invoice_paid' => true,
|
||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
|
case 'payment_intent.payment_failed':
|
||||||
|
$customerId = data_get($data, 'customer');
|
||||||
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
||||||
|
$subscription->update([
|
||||||
|
'stripe_invoice_paid' => false,
|
||||||
|
]);
|
||||||
|
send_internal_notification('Subscription payment failed: ' . $subscription->team->id);
|
||||||
|
break;
|
||||||
case 'customer.subscription.updated':
|
case 'customer.subscription.updated':
|
||||||
$customerId = data_get($data, 'customer');
|
$customerId = data_get($data, 'customer');
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
||||||
@@ -305,11 +313,11 @@ Route::post('/payments/stripe/events', function () {
|
|||||||
'stripe_plan_id' => $planId,
|
'stripe_plan_id' => $planId,
|
||||||
'stripe_cancel_at_period_end' => $cancelAtPeriodEnd,
|
'stripe_cancel_at_period_end' => $cancelAtPeriodEnd,
|
||||||
]);
|
]);
|
||||||
if ($status === 'paused') {
|
if ($status === 'paused' || $status === 'incomplete_expired') {
|
||||||
$subscription->update([
|
$subscription->update([
|
||||||
'stripe_invoice_paid' => false,
|
'stripe_invoice_paid' => false,
|
||||||
]);
|
]);
|
||||||
send_internal_notification('Subscription paused for team: ' . $subscription->team->id);
|
send_internal_notification('Subscription paused or incomplete for team: ' . $subscription->team->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trial ended but subscribed, reactive servers
|
// Trial ended but subscribed, reactive servers
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"version": "3.12.36"
|
"version": "3.12.36"
|
||||||
},
|
},
|
||||||
"v4": {
|
"v4": {
|
||||||
"version": "4.0.0-beta.105"
|
"version": "4.0.0-beta.108"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user