| @@ -516,9 +516,19 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted | ||||
|     private function check_git_if_build_needed() | ||||
|     { | ||||
|         $this->generate_git_import_commands(); | ||||
|         $private_key = base64_encode($this->application->private_key->private_key); | ||||
|         $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}"), | ||||
|                 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" | ||||
|             ], | ||||
|   | ||||
| @@ -39,14 +39,18 @@ class Subscription extends Model | ||||
|             if (!$subscription) { | ||||
|                 return null; | ||||
|             } | ||||
|             $subscriptionPlanId = data_get($subscription,'stripe_plan_id'); | ||||
|             $subscriptionPlanId = data_get($subscription, 'stripe_plan_id'); | ||||
|             if (!$subscriptionPlanId) { | ||||
|                 return null; | ||||
|             } | ||||
|             $subscriptionInvoicePaid = data_get($subscription, 'stripe_invoice_paid'); | ||||
|             if (!$subscriptionInvoicePaid) { | ||||
|                 return null; | ||||
|             } | ||||
|             $subscriptionConfigs = collect(config('subscription')); | ||||
|             $stripePlanId = null; | ||||
|             $subscriptionConfigs->map(function ($value, $key) use ($subscriptionPlanId, &$stripePlanId) { | ||||
|                 if ($value === $subscriptionPlanId){ | ||||
|                 if ($value === $subscriptionPlanId) { | ||||
|                     $stripePlanId = $key; | ||||
|                 }; | ||||
|             })->first(); | ||||
|   | ||||
| @@ -7,7 +7,7 @@ return [ | ||||
| 
 | ||||
|     // The release version of your application
 | ||||
|     // 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.106', | ||||
|     // When left empty or `null` the Laravel environment will be used
 | ||||
|     'environment' => config('app.env'), | ||||
| 
 | ||||
|   | ||||
| @@ -1,3 +1,3 @@ | ||||
| <?php | ||||
| 
 | ||||
| return '4.0.0-beta.105'; | ||||
| return '4.0.0-beta.106'; | ||||
|   | ||||
| @@ -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(); | ||||
|                     if ($found) { | ||||
|                         $found->delete(); | ||||
|                         $container_name = generateApplicationContainerName($application,$pull_request_id); | ||||
|                         $container_name = generateApplicationContainerName($application, $pull_request_id); | ||||
|                         // ray('Stopping container: ' . $container_name);
 | ||||
|                         instant_remote_process(["docker rm -f $container_name"], $application->destination->server); | ||||
|                         return response('Preview Deployment closed.'); | ||||
| @@ -288,6 +288,14 @@ Route::post('/payments/stripe/events', function () { | ||||
|                     'stripe_invoice_paid' => true, | ||||
|                 ]); | ||||
|                 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': | ||||
|                 $customerId = data_get($data, 'customer'); | ||||
|                 $subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail(); | ||||
| @@ -305,11 +313,11 @@ Route::post('/payments/stripe/events', function () { | ||||
|                     'stripe_plan_id' => $planId, | ||||
|                     'stripe_cancel_at_period_end' => $cancelAtPeriodEnd, | ||||
|                 ]); | ||||
|                 if ($status === 'paused') { | ||||
|                 if ($status === 'paused' || $status === 'incomplete_expired') { | ||||
|                     $subscription->update([ | ||||
|                         '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
 | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
|             "version": "3.12.36" | ||||
|         }, | ||||
|         "v4": { | ||||
|             "version": "4.0.0-beta.105" | ||||
|             "version": "4.0.0-beta.106" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Andras Bacsai
					Andras Bacsai