Merge pull request #1675 from coollabsio/next

v4.0.0-beta.200
This commit is contained in:
Andras Bacsai 2024-01-26 11:25:32 +01:00 committed by GitHub
commit d1daec060a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
106 changed files with 2138 additions and 629 deletions

View File

@ -0,0 +1,12 @@
IS_WINDOWS_DOCKER_DESKTOP=true
APP_ID=coolify-windows-docker-desktop
APP_NAME=Coolify
APP_KEY=base64:ssTlCmrIE/q7whnKMvT6DwURikg69COzGsAwFVROm80=
DB_PASSWORD=coolify
REDIS_PASSWORD=coolify
PUSHER_APP_ID=coolify
PUSHER_APP_KEY=coolify
PUSHER_APP_SECRET=coolify

View File

@ -0,0 +1,84 @@
name: Coolify Testing Host (v4-non-prod)
on:
push:
branches: [ "main", "next" ]
paths:
- .github/workflows/coolify-testing-host.yml
- docker/testing-host/Dockerfile
env:
REGISTRY: ghcr.io
IMAGE_NAME: "coollabsio/coolify-testing-host"
jobs:
amd64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to registry
uses: docker/build-push-action@v3
with:
no-cache: true
context: .
file: docker/testing-host/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
aarch64:
runs-on: [ self-hosted, arm64 ]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to registry
uses: docker/build-push-action@v3
with:
no-cache: true
context: .
file: docker/testing-host/Dockerfile
platforms: linux/aarch64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-aarch64
merge-manifest:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [ amd64, aarch64 ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create & publish manifest
run: |
docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK_DEV_RELEASE_CHANNEL }}

View File

@ -15,15 +15,15 @@ jobs:
amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Login to ghcr.io
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to registry
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: docker/prod-ssu/Dockerfile
@ -36,15 +36,15 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Login to ghcr.io
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to registry
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: docker/prod-ssu/Dockerfile
@ -59,13 +59,13 @@ jobs:
needs: [amd64, aarch64]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}

View File

@ -12,9 +12,9 @@ jobs:
amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Login to ghcr.io
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@ -24,7 +24,7 @@ jobs:
run: |
echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getVersion.php)"|xargs >> $GITHUB_OUTPUT
- name: Build image and push to registry
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: docker/prod-ssu/Dockerfile
@ -34,9 +34,9 @@ jobs:
aarch64:
runs-on: [self-hosted, arm64]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Login to ghcr.io
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@ -46,7 +46,7 @@ jobs:
run: |
echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getVersion.php)"|xargs >> $GITHUB_OUTPUT
- name: Build image and push to registry
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: docker/prod-ssu/Dockerfile
@ -61,13 +61,13 @@ jobs:
needs: [amd64, aarch64]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@ -78,7 +78,7 @@ jobs:
echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getVersion.php)"|xargs >> $GITHUB_OUTPUT
- name: Create & publish manifest
run: |
docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- uses: sarisia/actions-status-discord@v1
if: always()
with:

View File

@ -140,7 +140,7 @@ private function generate_environment_variables()
{
$environment_variables = collect();
foreach ($this->database->runtime_environment_variables as $env) {
$environment_variables->push("$env->key=$env->value");
$environment_variables->push("$env->key=$env->real_value");
}
if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MARIADB_ROOT_PASSWORD'))->isEmpty()) {

View File

@ -156,7 +156,7 @@ private function generate_environment_variables()
{
$environment_variables = collect();
foreach ($this->database->runtime_environment_variables as $env) {
$environment_variables->push("$env->key=$env->value");
$environment_variables->push("$env->key=$env->real_value");
}
if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MONGO_INITDB_ROOT_USERNAME'))->isEmpty()) {

View File

@ -140,7 +140,7 @@ private function generate_environment_variables()
{
$environment_variables = collect();
foreach ($this->database->runtime_environment_variables as $env) {
$environment_variables->push("$env->key=$env->value");
$environment_variables->push("$env->key=$env->real_value");
}
if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MYSQL_ROOT_PASSWORD'))->isEmpty()) {

View File

@ -164,7 +164,7 @@ private function generate_environment_variables()
ray('Generate Environment Variables')->green();
ray($this->database->runtime_environment_variables)->green();
foreach ($this->database->runtime_environment_variables as $env) {
$environment_variables->push("$env->key=$env->value");
$environment_variables->push("$env->key=$env->real_value");
}
if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('POSTGRES_USER'))->isEmpty()) {

View File

@ -151,7 +151,7 @@ private function generate_environment_variables()
{
$environment_variables = collect();
foreach ($this->database->runtime_environment_variables as $env) {
$environment_variables->push("$env->key=$env->value");
$environment_variables->push("$env->key=$env->real_value");
}
if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('REDIS_PASSWORD'))->isEmpty()) {

View File

@ -220,7 +220,6 @@ public function handle(): void
$this->build_server = $this->server;
$this->original_server = $this->server;
}
ray($this->build_server);
try {
if ($this->restart_only && $this->application->build_pack !== 'dockerimage') {
$this->just_restart();
@ -311,7 +310,6 @@ private function write_deployment_configurations()
}
private function push_to_docker_registry($forceFail = false)
{
ray((str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()));
if (
$this->application->docker_registry_image_name &&
$this->application->build_pack !== 'dockerimage' &&
@ -383,7 +381,7 @@ private function generate_image_names()
}
private function just_restart()
{
$this->application_deployment_queue->addLogEntry("Starting deployment of {$this->customRepository}:{$this->application->git_branch}.'");
$this->application_deployment_queue->addLogEntry("Starting deployment of {$this->customRepository}:{$this->application->git_branch}.");
$this->prepare_builder_image();
$this->check_git_if_build_needed();
$this->set_base_dir();
@ -417,11 +415,11 @@ private function save_environment_variables()
$envs = collect([]);
if ($this->pull_request_id !== 0) {
foreach ($this->application->environment_variables_preview as $env) {
$envs->push($env->key . '=' . $env->value);
$envs->push($env->key . '=' . $env->real_value);
}
} else {
foreach ($this->application->environment_variables as $env) {
$envs->push($env->key . '=' . $env->value);
$envs->push($env->key . '=' . $env->real_value);
}
}
$envs_base64 = base64_encode($envs->implode("\n"));
@ -929,11 +927,11 @@ private function generate_nixpacks_env_variables()
$this->env_nixpacks_args = collect([]);
if ($this->pull_request_id === 0) {
foreach ($this->application->nixpacks_environment_variables as $env) {
$this->env_nixpacks_args->push("--env {$env->key}={$env->value}");
$this->env_nixpacks_args->push("--env {$env->key}={$env->real_value}");
}
} else {
foreach ($this->application->nixpacks_environment_variables_preview as $env) {
$this->env_nixpacks_args->push("--env {$env->key}={$env->value}");
$this->env_nixpacks_args->push("--env {$env->key}={$env->real_value}");
}
}
@ -944,11 +942,11 @@ private function generate_env_variables()
$this->env_args = collect([]);
if ($this->pull_request_id === 0) {
foreach ($this->application->build_environment_variables as $env) {
$this->env_args->put($env->key, $env->value);
$this->env_args->put($env->key, $env->real_value);
}
} else {
foreach ($this->application->build_environment_variables_preview as $env) {
$this->env_args->put($env->key, $env->value);
$this->env_args->put($env->key, $env->real_value);
}
}
$this->env_args->put('SOURCE_COMMIT', $this->commit);
@ -1159,22 +1157,19 @@ private function generate_local_persistent_volumes_only_volume_names()
private function generate_environment_variables($ports)
{
$environment_variables = collect();
// ray('Generate Environment Variables')->green();
if ($this->pull_request_id === 0) {
// ray($this->application->runtime_environment_variables)->green();
foreach ($this->application->runtime_environment_variables as $env) {
$environment_variables->push("$env->key=$env->value");
$environment_variables->push("$env->key=$env->real_value");
}
foreach ($this->application->nixpacks_environment_variables as $env) {
$environment_variables->push("$env->key=$env->value");
$environment_variables->push("$env->key=$env->real_value");
}
} else {
// ray($this->application->runtime_environment_variables_preview)->green();
foreach ($this->application->runtime_environment_variables_preview as $env) {
$environment_variables->push("$env->key=$env->value");
$environment_variables->push("$env->key=$env->real_value");
}
foreach ($this->application->nixpacks_environment_variables_preview as $env) {
$environment_variables->push("$env->key=$env->value");
$environment_variables->push("$env->key=$env->real_value");
}
}
// Add PORT if not exists, use the first port as default
@ -1457,12 +1452,12 @@ private function generate_build_env_variables()
$this->build_args = collect(["--build-arg SOURCE_COMMIT=\"{$this->commit}\""]);
if ($this->pull_request_id === 0) {
foreach ($this->application->build_environment_variables as $env) {
$value = escapeshellarg($env->value);
$value = escapeshellarg($env->real_value);
$this->build_args->push("--build-arg {$env->key}={$value}");
}
} else {
foreach ($this->application->build_environment_variables_preview as $env) {
$value = escapeshellarg($env->value);
$value = escapeshellarg($env->real_value);
$this->build_args->push("--build-arg {$env->key}={$value}");
}
}
@ -1478,11 +1473,11 @@ private function add_build_env_variables_to_dockerfile()
$dockerfile = collect(Str::of($this->saved_outputs->get('dockerfile'))->trim()->explode("\n"));
if ($this->pull_request_id === 0) {
foreach ($this->application->build_environment_variables as $env) {
$dockerfile->splice(1, 0, "ARG {$env->key}={$env->value}");
$dockerfile->splice(1, 0, "ARG {$env->key}={$env->real_value}");
}
} else {
foreach ($this->application->build_environment_variables_preview as $env) {
$dockerfile->splice(1, 0, "ARG {$env->key}={$env->value}");
$dockerfile->splice(1, 0, "ARG {$env->key}={$env->real_value}");
}
}
$dockerfile_base64 = base64_encode($dockerfile->implode("\n"));

View File

@ -38,6 +38,8 @@ public function __construct($task)
$this->resource = $service;
} else if ($application = $task->application()->first()) {
$this->resource = $application;
} else {
throw new \Exception('ScheduledTaskJob failed: No resource found.');
}
$this->team = Team::find($task->team_id);
}

View File

@ -41,13 +41,10 @@ public function show_debug()
public function cancel()
{
try {
$kill_command = "kill -9 {$this->application_deployment_queue->current_process_id}";
if ($this->application_deployment_queue->current_process_id) {
$process = Process::run("ps -p {$this->application_deployment_queue->current_process_id} -o command --no-headers");
if (Str::of($process->output())->contains([$this->server->ip, 'EOF-COOLIFY-SSH'])) {
Process::run($kill_command);
}
$kill_command = "docker rm -f {$this->application_deployment_queue->deployment_uuid}";
if ($this->application_deployment_queue->logs) {
$previous_logs = json_decode($this->application_deployment_queue->logs, associative: true, flags: JSON_THROW_ON_ERROR);
$new_log_entry = [
'command' => $kill_command,
'output' => "Deployment cancelled by user.",
@ -60,15 +57,17 @@ public function cancel()
$this->application_deployment_queue->update([
'logs' => json_encode($previous_logs, flags: JSON_THROW_ON_ERROR),
]);
instant_remote_process([$kill_command], $this->server);
}
} catch (\Throwable $e) {
ray($e);
return handleError($e, $this);
} finally {
$this->application_deployment_queue->update([
'current_process_id' => null,
'status' => ApplicationDeploymentStatus::CANCELLED_BY_USER->value,
]);
queue_next_deployment($this->application);
// queue_next_deployment($this->application);
}
}
}

View File

@ -3,7 +3,6 @@
namespace App\Livewire\Project\Application;
use App\Actions\Application\StopApplication;
use App\Events\ApplicationStatusChanged;
use App\Jobs\ContainerStatusJob;
use App\Jobs\ServerStatusJob;
use App\Models\Application;
@ -56,6 +55,7 @@ public function deployNew()
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
deployment_uuid: $this->deploymentUuid,
force_rebuild: false,
is_new_deployment: true,
@ -84,6 +84,7 @@ public function deploy(bool $force_rebuild = false)
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
deployment_uuid: $this->deploymentUuid,
force_rebuild: $force_rebuild,
);
@ -113,6 +114,7 @@ public function restartNew()
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
deployment_uuid: $this->deploymentUuid,
restart_only: true,
is_new_deployment: true,
@ -129,6 +131,7 @@ public function restart()
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
deployment_uuid: $this->deploymentUuid,
restart_only: true,
);

View File

@ -48,6 +48,7 @@ public function deploy(int $pull_request_id, string|null $pull_request_html_url
}
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
deployment_uuid: $this->deployment_uuid,
force_rebuild: false,
pull_request_id: $pull_request_id,

View File

@ -25,6 +25,7 @@ public function rollbackImage($commit)
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
deployment_uuid: $deployment_uuid,
commit: $commit,
force_rebuild: false,

View File

@ -12,7 +12,24 @@ class Edit extends Component
'project.name' => 'required|min:3|max:255',
'project.description' => 'nullable|string|max:255',
];
public function mount() {
protected $listeners = ['refreshEnvs' => '$refresh', 'saveKey' => 'saveKey'];
public function saveKey($data)
{
try {
$this->project->environment_variables()->create([
'key' => $data['key'],
'value' => $data['value'],
'type' => 'project',
'team_id' => currentTeam()->id,
]);
$this->project->refresh();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function mount()
{
$projectUuid = request()->route('project_uuid');
$teamId = currentTeam()->id;
$project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first();

View File

@ -12,14 +12,30 @@ class EnvironmentEdit extends Component
public Application $application;
public $environment;
public array $parameters;
protected $rules = [
'environment.name' => 'required|min:3|max:255',
'environment.description' => 'nullable|min:3|max:255',
];
public function mount() {
$this->parameters = get_route_parameters();
protected $listeners = ['refreshEnvs' => '$refresh', 'saveKey' => 'saveKey'];
public function saveKey($data)
{
try {
$this->environment->environment_variables()->create([
'key' => $data['key'],
'value' => $data['value'],
'type' => 'environment',
'team_id' => currentTeam()->id,
]);
$this->environment->refresh();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function mount()
{
$this->parameters = get_route_parameters();
$this->project = Project::ownedByCurrentTeam()->where('uuid', request()->route('project_uuid'))->first();
$this->environment = $this->project->environments()->where('name', request()->route('environment_name'))->first();
}

View File

@ -39,6 +39,8 @@ class GithubPrivateRepository extends Component
public bool $is_static = false;
public string|null $publish_directory = null;
protected int $page = 1;
public $build_pack = 'nixpacks';
public bool $show_is_static = true;
public function mount()
@ -49,6 +51,20 @@ public function mount()
$this->repositories = $this->branches = collect();
$this->github_apps = GithubApp::private();
}
public function updatedBuildPack()
{
if ($this->build_pack === 'nixpacks') {
$this->show_is_static = true;
$this->port = 3000;
} else if ($this->build_pack === 'static') {
$this->show_is_static = false;
$this->is_static = false;
$this->port = 80;
} else {
$this->show_is_static = false;
$this->is_static = false;
}
}
public function loadRepositories($github_app_id)
{
$this->repositories = collect();
@ -95,7 +111,7 @@ public function loadBranches()
$this->loadBranchByPage();
}
}
$this->selected_branch_name = data_get($this->branches,'0.name');
$this->selected_branch_name = data_get($this->branches, '0.name', 'main');
}
protected function loadBranchByPage()

View File

@ -29,12 +29,17 @@ class GithubPrivateRepositoryDeployKey extends Component
public string $repository_url;
public string $branch;
public $build_pack = 'nixpacks';
public bool $show_is_static = true;
protected $rules = [
'repository_url' => 'required',
'branch' => 'required|string',
'port' => 'required|numeric',
'is_static' => 'required|boolean',
'publish_directory' => 'nullable|string',
'build_pack' => 'required|string',
];
protected $validationAttributes = [
'repository_url' => 'Repository',
@ -42,6 +47,7 @@ class GithubPrivateRepositoryDeployKey extends Component
'port' => 'Port',
'is_static' => 'Is static',
'publish_directory' => 'Publish directory',
'build_pack' => 'Build pack',
];
private object $repository_url_parsed;
private GithubApp|GitlabApp|string $git_source = 'other';
@ -62,6 +68,20 @@ public function mount()
}
}
public function updatedBuildPack()
{
if ($this->build_pack === 'nixpacks') {
$this->show_is_static = true;
$this->port = 3000;
} else if ($this->build_pack === 'static') {
$this->show_is_static = false;
$this->is_static = false;
$this->port = 80;
} else {
$this->show_is_static = false;
$this->is_static = false;
}
}
public function instantSave()
{
if ($this->is_static) {

View File

@ -30,7 +30,7 @@ class PublicGitRepository extends Component
public GithubApp|GitlabApp|string $git_source = 'other';
public string $git_host;
public string $git_repository;
public $build_pack;
public $build_pack = 'nixpacks';
public bool $show_is_static = true;
protected $rules = [
@ -61,9 +61,11 @@ public function updatedBuildPack()
{
if ($this->build_pack === 'nixpacks') {
$this->show_is_static = true;
$this->port = 3000;
} else if ($this->build_pack === 'static') {
$this->show_is_static = false;
$this->is_static = false;
$this->port = 80;
} else {
$this->show_is_static = false;
$this->is_static = false;

View File

@ -30,7 +30,10 @@ public function mount()
{
$this->parameters = get_route_parameters();
$this->query = request()->query();
$this->service = Service::whereUuid($this->parameters['service_uuid'])->firstOrFail();
$this->service = Service::whereUuid($this->parameters['service_uuid'])->first();
if (!$this->service) {
return redirect()->route('dashboard');
}
$this->applications = $this->service->applications->sort();
$this->databases = $this->service->databases->sort();
}

View File

@ -32,7 +32,6 @@ public function mount()
public function submit()
{
$this->validate();
ray($this->key, $this->value, $this->is_build_time);
$this->dispatch('saveKey', [
'key' => $this->key,
'value' => $this->value,

View File

@ -3,16 +3,18 @@
namespace App\Livewire\Project\Shared\EnvironmentVariable;
use App\Models\EnvironmentVariable as ModelsEnvironmentVariable;
use App\Models\SharedEnvironmentVariable;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class Show extends Component
{
public $parameters;
public ModelsEnvironmentVariable $env;
public ModelsEnvironmentVariable|SharedEnvironmentVariable $env;
public ?string $modalId = null;
public bool $isDisabled = false;
public bool $isLocked = false;
public bool $isSharedVariable = false;
public string $type;
protected $rules = [
@ -20,16 +22,20 @@ class Show extends Component
'env.value' => 'nullable',
'env.is_build_time' => 'required|boolean',
'env.is_shown_once' => 'required|boolean',
'env.real_value' => 'nullable',
];
protected $validationAttributes = [
'key' => 'Key',
'value' => 'Value',
'is_build_time' => 'Build Time',
'is_shown_once' => 'Shown Once',
'env.key' => 'Key',
'env.value' => 'Value',
'env.is_build_time' => 'Build Time',
'env.is_shown_once' => 'Shown Once',
];
public function mount()
{
if ($this->env->getMorphClass() === 'App\Models\SharedEnvironmentVariable') {
$this->isSharedVariable = true;
}
$this->modalId = new Cuid2(7);
$this->parameters = get_route_parameters();
$this->checkEnvs();
@ -44,9 +50,16 @@ public function checkEnvs()
$this->isLocked = true;
}
}
public function serialize() {
data_forget($this->env, 'real_value');
if ($this->env->getMorphClass() === 'App\Models\SharedEnvironmentVariable') {
data_forget($this->env, 'is_build_time');
}
}
public function lock()
{
$this->env->is_shown_once = true;
$this->serialize();
$this->env->save();
$this->checkEnvs();
$this->dispatch('refreshEnvs');
@ -57,10 +70,23 @@ public function instantSave()
}
public function submit()
{
$this->validate();
$this->env->save();
$this->dispatch('success', 'Environment variable updated successfully.');
$this->dispatch('refreshEnvs');
try {
if ($this->isSharedVariable) {
$this->validate([
'env.key' => 'required|string',
'env.value' => 'nullable',
'env.is_shown_once' => 'required|boolean',
]);
} else {
$this->validate();
}
$this->serialize();
$this->env->save();
$this->dispatch('success', 'Environment variable updated successfully.');
$this->dispatch('refreshEnvs');
} catch(\Exception $e) {
return handleError($e);
}
}
public function delete()

View File

@ -0,0 +1,173 @@
<?php
namespace App\Livewire\Project\Shared;
use App\Models\Environment;
use App\Models\Project;
use App\Models\StandaloneDocker;
use App\Models\SwarmDocker;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class ResourceOperations extends Component
{
public $resource;
public $projectUuid;
public $environmentName;
public $projects;
public $servers;
public function mount()
{
$parameters = get_route_parameters();
$this->projectUuid = $parameters['project_uuid'];
$this->environmentName = $parameters['environment_name'];
$this->projects = Project::ownedByCurrentTeam()->get();
$this->servers = currentTeam()->servers;
}
public function cloneTo($destination_id)
{
$new_destination = StandaloneDocker::find($destination_id);
if (!$new_destination) {
$new_destination = SwarmDocker::find($destination_id);
}
if (!$new_destination) {
return $this->addError('destination_id', 'Destination not found.');
}
$uuid = (string)new Cuid2(7);
$server = $new_destination->server;
if ($this->resource->getMorphClass() === 'App\Models\Application') {
$new_resource = $this->resource->replicate()->fill([
'uuid' => $uuid,
'name' => $this->resource->name . '-clone-' . $uuid,
'fqdn' => generateFqdn($server, $uuid),
'status' => 'exited',
'destination_id' => $new_destination->id,
]);
$new_resource->save();
$environmentVaribles = $this->resource->environment_variables()->get();
foreach ($environmentVaribles as $environmentVarible) {
$newEnvironmentVariable = $environmentVarible->replicate()->fill([
'application_id' => $new_resource->id,
]);
$newEnvironmentVariable->save();
}
$persistentVolumes = $this->resource->persistentStorages()->get();
foreach ($persistentVolumes as $volume) {
$newPersistentVolume = $volume->replicate()->fill([
'name' => $new_resource->uuid . '-' . str($volume->name)->afterLast('-'),
'resource_id' => $new_resource->id,
]);
$newPersistentVolume->save();
}
$route = route('project.application.configuration', [
'project_uuid' => $this->projectUuid,
'environment_name' => $this->environmentName,
'application_uuid' => $new_resource->uuid,
]) . "#resource-operations";
return redirect()->to($route);
} else if (
$this->resource->getMorphClass() === 'App\Models\StandalonePostgresql' ||
$this->resource->getMorphClass() === 'App\Models\StandaloneMongodb' ||
$this->resource->getMorphClass() === 'App\Models\StandaloneMysql' ||
$this->resource->getMorphClass() === 'App\Models\StandaloneMariadb' ||
$this->resource->getMorphClass() === 'App\Models\StandaloneRedis'
) {
$uuid = (string)new Cuid2(7);
$new_resource = $this->resource->replicate()->fill([
'uuid' => $uuid,
'name' => $this->resource->name . '-clone-' . $uuid,
'status' => 'exited',
'started_at' => null,
'destination_id' => $new_destination->id,
]);
$new_resource->save();
$environmentVaribles = $this->resource->environment_variables()->get();
foreach ($environmentVaribles as $environmentVarible) {
$payload = [];
if ($this->resource->type() === 'standalone-postgresql') {
$payload['standalone_postgresql_id'] = $new_resource->id;
} else if ($this->resource->type() === 'standalone-redis') {
$payload['standalone_redis_id'] = $new_resource->id;
} else if ($this->resource->type() === 'standalone-mongodb') {
$payload['standalone_mongodb_id'] = $new_resource->id;
} else if ($this->resource->type() === 'standalone-mysql') {
$payload['standalone_mysql_id'] = $new_resource->id;
} else if ($this->resource->type() === 'standalone-mariadb') {
$payload['standalone_mariadb_id'] = $new_resource->id;
}
$newEnvironmentVariable = $environmentVarible->replicate()->fill($payload);
$newEnvironmentVariable->save();
}
$route = route('project.database.configuration', [
'project_uuid' => $this->projectUuid,
'environment_name' => $this->environmentName,
'database_uuid' => $new_resource->uuid,
]) . "#resource-operations";
return redirect()->to($route);
} else if ($this->resource->type() === 'service') {
$uuid = (string)new Cuid2(7);
$new_resource = $this->resource->replicate()->fill([
'uuid' => $uuid,
'name' => $this->resource->name . '-clone-' . $uuid,
'destination_id' => $new_destination->id,
]);
$new_resource->save();
foreach ($new_resource->applications() as $application) {
$application->update([
'status' => 'exited',
]);
}
foreach ($new_resource->databases() as $database) {
$database->update([
'status' => 'exited',
]);
}
$new_resource->parse();
$route = route('project.service.configuration', [
'project_uuid' => $this->projectUuid,
'environment_name' => $this->environmentName,
'service_uuid' => $new_resource->uuid,
]) . "#resource-operations";
return redirect()->to($route);
}
return;
}
public function moveTo($environment_id)
{
try {
$new_environment = Environment::findOrFail($environment_id);
$this->resource->update([
'environment_id' => $environment_id
]);
if ($this->resource->type() === 'application') {
$route = route('project.application.configuration', [
'project_uuid' => $new_environment->project->uuid,
'environment_name' => $new_environment->name,
'application_uuid' => $this->resource->uuid,
]) . "#resource-operations";
return redirect()->to($route);
} else if (str($this->resource->type())->startsWith('standalone-')) {
$route = route('project.database.configuration', [
'project_uuid' => $new_environment->project->uuid,
'environment_name' => $new_environment->name,
'database_uuid' => $this->resource->uuid,
]) . "#resource-operations";
return redirect()->to($route);
} else if ($this->resource->type() === 'service') {
$route = route('project.service.configuration', [
'project_uuid' => $new_environment->project->uuid,
'environment_name' => $new_environment->name,
'service_uuid' => $this->resource->uuid,
]) . "#resource-operations";
return redirect()->to($route);
}
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function render()
{
return view('livewire.project.shared.resource-operations');
}
}

View File

@ -27,6 +27,7 @@ class Form extends Component
'server.settings.is_swarm_manager' => 'required|boolean',
'server.settings.is_swarm_worker' => 'required|boolean',
'server.settings.is_build_server' => 'required|boolean',
'server.settings.concurrent_builds' => 'required|integer|min:1',
'wildcard_domain' => 'nullable|url',
];
protected $validationAttributes = [
@ -40,6 +41,7 @@ class Form extends Component
'server.settings.is_swarm_manager' => 'Swarm Manager',
'server.settings.is_swarm_worker' => 'Swarm Worker',
'server.settings.is_build_server' => 'Build Server',
'server.settings.concurrent_builds' => 'Concurrent Builds',
];
public function mount()

View File

@ -17,7 +17,7 @@ class Change extends Component
public ?bool $preview_deployment_permissions = true;
public $parameters;
public GithubApp $github_app;
public ?GithubApp $github_app;
public string $name;
public bool $is_system_wide;

View File

@ -0,0 +1,36 @@
<?php
namespace App\Livewire;
use App\Models\Team;
use Livewire\Component;
class TeamSharedVariablesIndex extends Component
{
public Team $team;
protected $listeners = ['refreshEnvs' => '$refresh', 'saveKey' => 'saveKey'];
public function saveKey($data)
{
try {
$this->team->environment_variables()->create([
'key' => $data['key'],
'value' => $data['value'],
'type' => 'team',
'team_id' => currentTeam()->id,
]);
$this->team->refresh();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function mount()
{
$this->team = currentTeam();
}
public function render()
{
return view('livewire.team-shared-variables-index');
}
}

View File

@ -263,6 +263,10 @@ public function portsExposesArray(): Attribute
: explode(',', $this->ports_exposes)
);
}
public function team()
{
return data_get($this, 'environment.project.team');
}
public function serviceType()
{
$found = str(collect(SPECIFIC_SERVICES)->filter(function ($service) {
@ -431,7 +435,7 @@ public function isConfigurationChanged($save = false)
{
$newConfigHash = $this->fqdn . $this->git_repository . $this->git_branch . $this->git_commit_sha . $this->build_pack . $this->static_image . $this->install_command . $this->build_command . $this->start_command . $this->port_exposes . $this->port_mappings . $this->base_directory . $this->publish_directory . $this->dockerfile . $this->dockerfile_location . $this->custom_labels;
if ($this->pull_request_id === 0 || $this->pull_request_id === null) {
$newConfigHash .= json_encode($this->environment_variables->all());
$newConfigHash .= json_encode($this->environment_variables());
} else {
$newConfigHash .= json_encode($this->environment_variables_preview->all());
}
@ -1002,7 +1006,7 @@ function loadComposeFile($isInit = false)
if (!$composeFileContent) {
$this->docker_compose_location = $initialDockerComposeLocation;
$this->save();
throw new \Exception("Could not load base compose file from $workdir$composeFile");
throw new \RuntimeException("Could not load base compose file from $workdir$composeFile");
} else {
$this->docker_compose_raw = $composeFileContent;
$this->save();

View File

@ -17,6 +17,9 @@ public function isEmpty()
$this->services()->count() == 0;
}
public function environment_variables() {
return $this->hasMany(SharedEnvironmentVariable::class);
}
public function applications()
{
return $this->hasMany(Application::class);

View File

@ -15,6 +15,7 @@ class EnvironmentVariable extends Model
'value' => 'encrypted',
'is_build_time' => 'boolean',
];
protected $appends = ['real_value', 'is_shared'];
protected static function booted()
{
@ -48,24 +49,78 @@ protected function value(): Attribute
set: fn (?string $value = null) => $this->set_environment_variables($value),
);
}
private function get_environment_variables(?string $environment_variable = null): string|null
public function realValue(): Attribute
{
$resource = null;
if ($this->application_id) {
$resource = Application::find($this->application_id);
} else if ($this->service_id) {
$resource = Service::find($this->service_id);
} else if ($this->database_id) {
$resource = StandalonePostgresql::find($this->database_id);
if (!$resource) {
$resource = StandaloneMysql::find($this->database_id);
if (!$resource) {
$resource = StandaloneRedis::find($this->database_id);
if (!$resource) {
$resource = StandaloneMongodb::find($this->database_id);
if (!$resource) {
$resource = StandaloneMariadb::find($this->database_id);
}
}
}
}
}
return Attribute::make(
get: function () use ($resource) {
return $this->get_real_environment_variables($this->value, $resource);
}
);
}
protected function isShared(): Attribute
{
return Attribute::make(
get: function () {
$type = str($this->value)->after("{{")->before(".")->value;
if (str($this->value)->startsWith('{{' . $type) && str($this->value)->endsWith('}}')) {
return true;
}
return false;
}
);
}
private function get_real_environment_variables(?string $environment_variable = null, $resource = null): string|null
{
// $team_id = currentTeam()->id;
if (!$environment_variable) {
return null;
}
$environment_variable = trim(decrypt($environment_variable));
if (Str::startsWith($environment_variable, '{{') && Str::endsWith($environment_variable, '}}') && Str::contains($environment_variable, 'global.')) {
$variable = Str::after($environment_variable, 'global.');
$environment_variable = trim($environment_variable);
$type = str($environment_variable)->after("{{")->before(".")->value;
if (str($environment_variable)->startsWith("{{" . $type) && str($environment_variable)->endsWith('}}')) {
$variable = Str::after($environment_variable, "{$type}.");
$variable = Str::before($variable, '}}');
$variable = Str::of($variable)->trim()->value;
// $environment_variable = GlobalEnvironmentVariable::where('name', $environment_variable)->where('team_id', $team_id)->first()?->value;
ray('global env variable');
return $environment_variable;
if ($type === 'environment') {
$id = $resource->environment->id;
} else if ($type === 'project') {
$id = $resource->environment->project->id;
} else {
$id = $resource->team()->id;
}
$environment_variable_found = SharedEnvironmentVariable::where("type", $type)->where('key', $variable)->where('team_id', $resource->team()->id)->where("{$type}_id", $id)->first();
if ($environment_variable_found) {
return $environment_variable_found->value;
}
}
return $environment_variable;
}
private function get_environment_variables(?string $environment_variable = null): string|null
{
if (!$environment_variable) {
return null;
}
return trim(decrypt($environment_variable));
}
private function set_environment_variables(?string $environment_variable = null): string|null
{
@ -73,6 +128,10 @@ private function set_environment_variables(?string $environment_variable = null)
return null;
}
$environment_variable = trim($environment_variable);
$type = str($environment_variable)->after("{{")->before(".")->value;
if (str($environment_variable)->startsWith("{{" . $type) && str($environment_variable)->endsWith('}}')) {
return encrypt((string) str($environment_variable)->replace(' ', ''));
}
return encrypt($environment_variable);
}

View File

@ -27,7 +27,9 @@ protected static function booted()
$project->settings()->delete();
});
}
public function environment_variables() {
return $this->hasMany(SharedEnvironmentVariable::class);
}
public function environments()
{
return $this->hasMany(Environment::class);

View File

@ -398,6 +398,8 @@ public function isSwarmWorker()
}
public function validateConnection()
{
config()->set('coolify.mux_enabled', false);
$server = Server::find($this->id);
if (!$server) {
return false;

View File

@ -8,6 +8,7 @@
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Symfony\Component\Yaml\Yaml;
class Service extends BaseModel
{
@ -17,6 +18,10 @@ public function type()
{
return 'service';
}
public function team()
{
return data_get($this, 'environment.project.team');
}
public function extraFields()
{
$fields = collect([]);
@ -423,7 +428,7 @@ public function saveComposeConfigs()
$envs = $this->environment_variables()->get();
$commands[] = "rm -f .env || true";
foreach ($envs as $env) {
$commands[] = "echo '{$env->key}={$env->value}' >> .env";
$commands[] = "echo '{$env->key}={$env->real_value}' >> .env";
}
if ($envs->count() === 0) {
$commands[] = "touch .env";

View File

@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SharedEnvironmentVariable extends Model
{
protected $guarded = [];
protected $casts = [
'key' => 'string',
'value' => 'encrypted',
];
}

View File

@ -42,6 +42,10 @@ protected static function booted()
$database->environment_variables()->delete();
});
}
public function team()
{
return data_get($this, 'environment.project.team');
}
public function link()
{
if (data_get($this, 'environment.project.uuid')) {

View File

@ -45,6 +45,10 @@ protected static function booted()
$database->environment_variables()->delete();
});
}
public function team()
{
return data_get($this, 'environment.project.team');
}
public function isLogDrainEnabled()
{
return data_get($this, 'is_log_drain_enabled', false);

View File

@ -42,6 +42,10 @@ protected static function booted()
$database->environment_variables()->delete();
});
}
public function team()
{
return data_get($this, 'environment.project.team');
}
public function link()
{
if (data_get($this, 'environment.project.uuid')) {

View File

@ -74,7 +74,10 @@ public function portsMappingsArray(): Attribute
);
}
public function team()
{
return data_get($this, 'environment.project.team');
}
public function type(): string
{
return 'standalone-postgresql';

View File

@ -37,6 +37,10 @@ protected static function booted()
$database->environment_variables()->delete();
});
}
public function team()
{
return data_get($this, 'environment.project.team');
}
public function link()
{
if (data_get($this, 'environment.project.uuid')) {

View File

@ -70,7 +70,9 @@ public function limits(): Attribute
);
}
public function environment_variables() {
return $this->hasMany(SharedEnvironmentVariable::class)->whereNull('project_id')->whereNull('environment_id');
}
public function members()
{
return $this->belongsToMany(User::class, 'team_user', 'team_id', 'user_id')->withPivot('role');

View File

@ -19,7 +19,7 @@ public function __construct(
public string|null $label = null,
public string|null $helper = null,
public bool $required = false,
public string $defaultClass = "select select-sm w-full rounded text-white text-sm bg-coolgray-100 font-normal disabled:bg-coolgray-200/50 disabled:border-none"
public string $defaultClass = "select select-sm w-full rounded text-sm bg-coolgray-100 font-normal disabled:bg-coolgray-200/50 disabled:border-none"
) {
//
}

View File

@ -1,21 +1,19 @@
<?php
use App\Jobs\ApplicationDeployDockerImageJob;
use App\Jobs\ApplicationDeploymentJob;
use App\Jobs\ApplicationDeploymentNewJob;
use App\Jobs\ApplicationDeploySimpleDockerfileJob;
use App\Jobs\ApplicationRestartJob;
use App\Jobs\MultipleApplicationDeploymentJob;
use App\Models\Application;
use App\Models\ApplicationDeploymentQueue;
use App\Models\ApplicationPreview;
use App\Models\Server;
use Symfony\Component\Yaml\Yaml;
function queue_application_deployment(int $application_id, string $deployment_uuid, int | null $pull_request_id = 0, string $commit = 'HEAD', bool $force_rebuild = false, bool $is_webhook = false, bool $restart_only = false, ?string $git_type = null, bool $is_new_deployment = false)
function queue_application_deployment(int $application_id, int $server_id, string $deployment_uuid, int | null $pull_request_id = 0, string $commit = 'HEAD', bool $force_rebuild = false, bool $is_webhook = false, bool $restart_only = false, ?string $git_type = null, bool $is_new_deployment = false)
{
$server = Application::find($application_id)->destination->server;
$deployment = ApplicationDeploymentQueue::create([
'application_id' => $application_id,
'server_id' => $server_id,
'deployment_uuid' => $deployment_uuid,
'pull_request_id' => $pull_request_id,
'force_rebuild' => $force_rebuild,
@ -24,9 +22,15 @@ function queue_application_deployment(int $application_id, string $deployment_uu
'commit' => $commit,
'git_type' => $git_type
]);
$queued_deployments = ApplicationDeploymentQueue::where('application_id', $application_id)->where('status', 'queued')->get()->sortByDesc('created_at');
$running_deployments = ApplicationDeploymentQueue::where('application_id', $application_id)->where('status', 'in_progress')->get()->sortByDesc('created_at');
ray('Q:' . $queued_deployments->count() . 'R:' . $running_deployments->count() . '| Queuing deployment: ' . $deployment_uuid . ' of applicationID: ' . $application_id . ' pull request: ' . $pull_request_id . ' with commit: ' . $commit . ' and is it forced: ' . $force_rebuild);
$deployments_per_server = ApplicationDeploymentQueue::where('server_id', $server_id)->whereIn('status', ['in_progress', 'queued'])->get();
$deployments = ApplicationDeploymentQueue::where('application_id', $application_id)->where('server_id', $server_id);
$queued_deployments = $deployments->where('status', 'queued')->get()->sortByDesc('created_at');
$running_deployments = $deployments->where('status', 'in_progress')->get()->sortByDesc('created_at');
ray("serverId:{$server->id}", "concurrentBuilds:{$server->settings->concurrent_builds}", "deployments:{$deployments_per_server->count()}", "queued:{$queued_deployments->count()}", "running:{$running_deployments->count()}");
// ray('Q:' . $queued_deployments->count() . 'R:' . $running_deployments->count() . '| Queuing deployment: ' . $deployment_uuid . ' of applicationID: ' . $application_id . ' pull request: ' . $pull_request_id . ' with commit: ' . $commit . ' and is it forced: ' . $force_rebuild);
if ($queued_deployments->count() > 1) {
$queued_deployments = $queued_deployments->skip(1);
$queued_deployments->each(function ($queued_deployment, $key) {
@ -37,6 +41,9 @@ function queue_application_deployment(int $application_id, string $deployment_uu
if ($running_deployments->count() > 0) {
return;
}
if ($deployments_per_server->count() > $server->settings->concurrent_builds) {
return;
}
if ($is_new_deployment) {
dispatch(new ApplicationDeploymentNewJob(
deployment: $deployment,
@ -51,7 +58,10 @@ function queue_application_deployment(int $application_id, string $deployment_uu
function queue_next_deployment(Application $application, bool $isNew = false)
{
$next_found = ApplicationDeploymentQueue::where('application_id', $application->id)->where('status', 'queued')->first();
$server_id = $application->destination->server_id;
$next_found = ApplicationDeploymentQueue::where('server_id', $server_id)->where('status', 'queued')->get()->sortBy('created_at')->first();;
// $next_found = ApplicationDeploymentQueue::where('status', 'queued')->get()->sortBy('created_at')->first();
ray($next_found, $server_id);
if ($next_found) {
if ($isNew) {
dispatch(new ApplicationDeploymentNewJob(

View File

@ -108,7 +108,7 @@ function instant_scp(string $source, string $dest, Server $server, $throwError =
}
return $output;
}
function generateSshCommand(Server $server, string $command, bool $isMux = true)
function generateSshCommand(Server $server, string $command)
{
$user = $server->user;
$port = $server->port;
@ -120,7 +120,7 @@ function generateSshCommand(Server $server, string $command, bool $isMux = true)
$delimiter = 'EOF-COOLIFY-SSH';
$ssh_command = "timeout $timeout ssh ";
if ($isMux && config('coolify.mux_enabled')) {
if (config('coolify.mux_enabled') && config('coolify.is_windows_docker_desktop') == false) {
$ssh_command .= '-o ControlMaster=auto -o ControlPersist=1m -o ControlPath=/var/www/html/storage/app/ssh/mux/%h_%p_%r ';
}
if (data_get($server, 'settings.is_cloudflare_tunnel')) {

View File

@ -24,7 +24,6 @@
"league/flysystem-sftp-v3": "^3.0",
"livewire/livewire": "^3.0",
"lorisleiva/laravel-actions": "^2.7",
"masmerise/livewire-toaster": "^2.0",
"nubs/random-name-generator": "^2.2",
"phpseclib/phpseclib": "~3.0",
"poliander/cron": "^3.0",

73
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "de3b59fade9b132d2582a40dcf3c00f9",
"content-hash": "19b19082b605e09867e6ae65fb8135f6",
"packages": [
{
"name": "amphp/amp",
@ -4485,77 +4485,6 @@
],
"time": "2023-02-05T15:03:45+00:00"
},
{
"name": "masmerise/livewire-toaster",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/masmerise/livewire-toaster.git",
"reference": "89aa127df5d17b915b0818761bdf83e8915036c2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/masmerise/livewire-toaster/zipball/89aa127df5d17b915b0818761bdf83e8915036c2",
"reference": "89aa127df5d17b915b0818761bdf83e8915036c2",
"shasum": ""
},
"require": {
"laravel/framework": "^10.0",
"livewire/livewire": "^3.0",
"php": "~8.2"
},
"conflict": {
"stevebauman/unfinalize": "*"
},
"require-dev": {
"dive-be/php-crowbar": "^1.0",
"laravel/pint": "^1.0",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^8.0",
"phpunit/phpunit": "^10.0"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Toaster": "Masmerise\\Toaster\\Toaster"
},
"providers": [
"Masmerise\\Toaster\\ToasterServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Masmerise\\Toaster\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Muhammed Sari",
"email": "support@muhammedsari.me",
"role": "Developer"
}
],
"description": "Beautiful toast notifications for Laravel / Livewire.",
"homepage": "https://github.com/masmerise/livewire-toaster",
"keywords": [
"alert",
"laravel",
"livewire",
"toast",
"toaster"
],
"support": {
"issues": "https://github.com/masmerise/livewire-toaster/issues",
"source": "https://github.com/masmerise/livewire-toaster/tree/2.0.3"
},
"time": "2023-09-28T12:07:49+00:00"
},
{
"name": "monolog/monolog",
"version": "3.5.0",

View File

@ -1,12 +1,14 @@
<?php
return [
'docs' => 'https://coolify.io/docs/contact',
'docs' => 'https://coolify.io/docs/',
'contact' => 'https://coolify.io/docs/contact',
'self_hosted' => env('SELF_HOSTED', true),
'waitlist' => env('WAITLIST', false),
'license_url' => 'https://licenses.coollabs.io',
'mux_enabled' => env('MUX_ENABLED', true),
'dev_webhook' => env('SERVEO_URL'),
'is_windows_docker_desktop' => env('IS_WINDOWS_DOCKER_DESKTOP', false),
'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'),
'helper_image' => env('HELPER_IMAGE', 'ghcr.io/coollabsio/coolify-helper:latest'),
];

View File

@ -7,7 +7,7 @@
// 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.199',
'release' => '4.0.0-beta.200',
// When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'),

View File

@ -1,3 +1,3 @@
<?php
return '4.0.0-beta.199';
return '4.0.0-beta.200';

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('shared_environment_variables', function (Blueprint $table) {
$table->id();
$table->string('key');
$table->string('value')->nullable();
$table->boolean('is_shown_once')->default(false);
$table->enum('type', ['team', 'project', 'environment'])->default('team');
$table->foreignId('team_id')->constrained()->onDelete('cascade');
$table->foreignId('project_id')->nullable()->constrained()->onDelete('cascade');
$table->foreignId('environment_id')->nullable()->constrained()->onDelete('cascade');
$table->unique(['key', 'project_id', 'team_id']);
$table->unique(['key', 'environment_id', 'team_id']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('shared_environment_variables');
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->integer('concurrent_builds')->default(2);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->dropColumn('concurrent_builds');
});
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('application_deployment_queues', function (Blueprint $table) {
$table->integer('server_id')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('application_deployment_queues', function (Blueprint $table) {
$table->dropColumn('server_id');
});
}
};

View File

@ -18,6 +18,7 @@ public function run(): void
ProjectSeeder::class,
ProjectSettingSeeder::class,
EnvironmentSeeder::class,
TeamEnvironmentVariableSeeder::class,
StandaloneDockerSeeder::class,
SwarmDockerSeeder::class,
KubernetesSeeder::class,

View File

@ -14,7 +14,6 @@
use App\Models\Team;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Facades\Storage;
@ -67,7 +66,8 @@ public function run(): void
]);
}
if (!isCloud()) {
if (!isCloud() && config('coolify.is_windows_docker_desktop') == false) {
echo "Checking localhost key.\n";
// Save SSH Keys for the Coolify Host
$coolify_key_name = "id.root@host.docker.internal";
$coolify_key = Storage::disk('ssh-keys')->get("{$coolify_key_name}");
@ -123,6 +123,59 @@ public function run(): void
]);
}
}
if (config('coolify.is_windows_docker_desktop')) {
PrivateKey::updateOrCreate(
[
'id' => 0,
'team_id' => 0,
],
[
"name" => "Testing-host",
"description" => "This is a a docker container with SSH access",
"private_key" => "-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevAAAAJi/QySHv0Mk
hwAAAAtzc2gtZWQyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevA
AAAECBQw4jg1WRT2IGHMncCiZhURCts2s24HoDS0thHnnRKVuGmoeGq/pojrsyP1pszcNV
uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
-----END OPENSSH PRIVATE KEY-----
"
]
);
if (Server::find(0) == null) {
$server_details = [
'id' => 0,
'uuid' => 'coolify-testing-host',
'name' => "localhost",
'description' => "This is the server where Coolify is running on. Don't delete this!",
'user' => 'root',
'ip' => "coolify-testing-host",
'team_id' => 0,
'private_key_id' => 0
];
$server_details['proxy'] = ServerMetadata::from([
'type' => ProxyTypes::TRAEFIK_V2->value,
'status' => ProxyStatus::EXITED->value
]);
$server = Server::create($server_details);
$server->settings->is_reachable = true;
$server->settings->is_usable = true;
$server->settings->save();
} else {
$server = Server::find(0);
$server->settings->is_reachable = true;
$server->settings->is_usable = true;
$server->settings->save();
}
if (StandaloneDocker::find(0) == null) {
StandaloneDocker::create([
'id' => 0,
'name' => 'localhost-coolify',
'network' => 'coolify',
'server_id' => 0,
]);
}
}
try {
$settings = InstanceSettings::get();

View File

@ -0,0 +1,36 @@
<?php
namespace Database\Seeders;
use App\Models\SharedEnvironmentVariable;
use Illuminate\Database\Seeder;
class SharedEnvironmentVariableSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
SharedEnvironmentVariable::create([
'key' => 'NODE_ENV',
'value' => 'team_env',
'type' => 'team',
'team_id' => 0,
]);
SharedEnvironmentVariable::create([
'key' => 'NODE_ENV',
'value' => 'env_env',
'type' => 'environment',
'environment_id' => 1,
'team_id' => 0,
]);
SharedEnvironmentVariable::create([
'key' => 'NODE_ENV',
'value' => 'project_env',
'type' => 'project',
'project_id' => 1,
'team_id' => 0,
]);
}
}

View File

@ -1,13 +1,5 @@
version: "3.8"
x-testing-host: &testing-host-base
build:
dockerfile: Dockerfile
context: ./docker/testing-host
networks:
- coolify
init: true
services:
coolify:
build:
@ -30,6 +22,7 @@ services:
volumes:
- .:/var/www/html/:cached
postgres:
pull_policy: always
ports:
- "${FORWARD_DB_PORT:-5432}:5432"
env_file:
@ -43,6 +36,7 @@ services:
- /data/coolify/_volumes/database/:/var/lib/postgresql/data
# - coolify-pg-data-dev:/var/lib/postgresql/data
redis:
pull_policy: always
ports:
- "${FORWARD_REDIS_PORT:-6379}:6379"
env_file:
@ -62,6 +56,7 @@ services:
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}"
vite:
image: node:20
pull_policy: always
working_dir: /var/www/html
# environment:
# VITE_PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}"
@ -73,7 +68,9 @@ services:
networks:
- coolify
testing-host:
<<: *testing-host-base
image: "ghcr.io/coollabsio/coolify-testing-host:latest"
pull_policy: always
init: true
container_name: coolify-testing-host
volumes:
- /:/host
@ -83,6 +80,7 @@ services:
- coolify
mailpit:
image: "axllent/mailpit:latest"
pull_policy: always
container_name: coolify-mail
ports:
- "${FORWARD_MAILPIT_PORT:-1025}:1025"
@ -91,6 +89,7 @@ services:
- coolify
minio:
image: minio/minio:latest
pull_policy: always
container_name: coolify-minio
command: server /data --console-address ":9001"
ports:

128
docker-compose.windows.yml Normal file
View File

@ -0,0 +1,128 @@
version: '3.8'
services:
coolify-testing-host:
init: true
image: "ghcr.io/coollabsio/coolify-testing-host:latest"
pull_policy: always
container_name: coolify-testing-host
volumes:
- //var/run/docker.sock://var/run/docker.sock
- ./:/data/coolify
coolify:
image: "ghcr.io/coollabsio/coolify:latest"
pull_policy: always
container_name: coolify
restart: always
working_dir: /var/www/html
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes:
- type: bind
source: .env
target: /var/www/html/.env
read_only: true
- ./ssh:/var/www/html/storage/app/ssh
- ./applications:/var/www/html/storage/app/applications
- ./databases:/var/www/html/storage/app/databases
- ./services:/var/www/html/storage/app/services
- ./backups:/var/www/html/storage/app/backups
env_file:
- .env
environment:
- APP_ID
- APP_ENV=production
- APP_NAME
- APP_KEY
- DB_PASSWORD
- REDIS_PASSWORD
- SSL_MODE=off
- PHP_PM_CONTROL=dynamic
- PHP_PM_START_SERVERS=1
- PHP_PM_MIN_SPARE_SERVERS=1
- PHP_PM_MAX_SPARE_SERVERS=10
- PUSHER_APP_ID
- PUSHER_APP_KEY
- PUSHER_APP_SECRET
- AUTOUPDATE=true
- SELF_HOSTED=true
- MUX_ENABLED=false
- IS_WINDOWS_DOCKER_DESKTOP=true
ports:
- "${APP_PORT:-8000}:80"
expose:
- "${APP_PORT:-8000}"
healthcheck:
test: curl --fail http://localhost:80/api/health || exit 1
interval: 5s
retries: 10
timeout: 2s
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
postgres:
image: postgres:15-alpine
pull_policy: always
container_name: coolify-db
restart: always
env_file:
- .env
volumes:
- coolify-db:/var/lib/postgresql/data
environment:
POSTGRES_USER: "${DB_USERNAME:-coolify}"
POSTGRES_PASSWORD: "${DB_PASSWORD}"
POSTGRES_DB: "${DB_DATABASE:-coolify}"
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${DB_USERNAME:-coolify}",
"-d",
"${DB_DATABASE:-coolify}"
]
interval: 5s
retries: 10
timeout: 2s
redis:
image: redis:alpine
pull_policy: always
container_name: coolify-redis
restart: always
command: redis-server --save 20 1 --loglevel warning --requirepass ${REDIS_PASSWORD}
env_file:
- .env
environment:
REDIS_PASSWORD: "${REDIS_PASSWORD}"
volumes:
- coolify-redis:/data
healthcheck:
test: redis-cli ping
interval: 5s
retries: 10
timeout: 2s
soketi:
image: 'quay.io/soketi/soketi:1.6-16-alpine'
pull_policy: always
container_name: coolify-realtime
restart: always
env_file:
- .env
ports:
- "${SOKETI_PORT:-6001}:6001"
environment:
SOKETI_DEBUG: "${SOKETI_DEBUG:-false}"
SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}"
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}"
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}"
healthcheck:
test: wget -qO- http://localhost:6001/ready || exit 1
interval: 5s
retries: 10
timeout: 2s
volumes:
coolify-db:
name: coolify-db
coolify-redis:
name: coolify-redis

8
package-lock.json generated
View File

@ -20,7 +20,7 @@
"postcss": "8.4.33",
"pusher-js": "8.4.0-rc2",
"tailwindcss": "3.4.1",
"vite": "4.5.1",
"vite": "4.5.2",
"vue": "3.4.13"
}
},
@ -2041,9 +2041,9 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/vite": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.5.1.tgz",
"integrity": "sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==",
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz",
"integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==",
"dev": true,
"dependencies": {
"esbuild": "^0.18.10",

View File

@ -14,7 +14,7 @@
"postcss": "8.4.33",
"pusher-js": "8.4.0-rc2",
"tailwindcss": "3.4.1",
"vite": "4.5.1",
"vite": "4.5.2",
"vue": "3.4.13"
},
"dependencies": {

View File

@ -168,3 +168,6 @@ .fullscreen {
input.input-sm {
@apply pr-10;
}
option{
@apply text-white;
}

View File

@ -1,6 +1,5 @@
import { createApp } from "vue";
import MagicBar from "./components/MagicBar.vue";
import '../../vendor/masmerise/livewire-toaster/resources/js';
import "../../vendor/wire-elements/modal/resources/js/modal";
const app = createApp({});

View File

@ -429,6 +429,13 @@ const magicActions = [{
tags: 'api,tokens,rest',
icon: 'goto',
sequence: ['main', 'redirect']
},
{
id: 26,
name: 'Goto: Team Shared Variables',
tags: 'team,shared,variables',
icon: 'goto',
sequence: ['main', 'redirect']
}
]
const initialState = {
@ -665,6 +672,9 @@ async function redirect() {
case 25:
targetUrl.pathname = `/security/api-tokens`
break;
case 26:
targetUrl.pathname = `/team/shared-variables`
break;
}
window.location.href = targetUrl;
}

View File

@ -13,7 +13,7 @@ class="transition rounded w-11 h-11" src="{{ asset('coolify-transparent.png') }}
</a>
</li>
<li title="Help us!">
<a class="hover:bg-transparent"href="https://coolify.io/sponsorships" target="_blank">
<a class="hover:bg-transparent" href="https://coolify.io/sponsorships" target="_blank">
<svg class="icon hover:text-pink-500" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="2">

View File

@ -258,7 +258,7 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap
<div class="flex items-start gap-4 text-xl tracking-tight">Need official support for
your self-hosted instance?
<x-forms.button>
<a class="font-bold text-white hover:no-underline" href="{{ config('coolify.docs') }}">Contact
<a class="font-bold text-white hover:no-underline" href="{{ config('coolify.contact') }}">Contact
Us</a>
</x-forms.button>
</div>

View File

@ -0,0 +1,48 @@
<div x-data="{
slideOverOpen: false
}" class="relative w-auto h-auto">
{{ $slot }}
<template x-teleport="body">
<div x-show="slideOverOpen" @keydown.window.escape="slideOverOpen=false" class="relative z-[99]">
<div x-show="slideOverOpen" @click="slideOverOpen = false" class="fixed inset-0 bg-black bg-opacity-60"></div>
<div class="fixed inset-0 overflow-hidden">
<div class="absolute inset-0 overflow-hidden">
<div class="fixed inset-y-0 right-0 flex max-w-full pl-10">
<div x-show="slideOverOpen" @click.away="slideOverOpen = false"
x-transition:enter="transform transition ease-in-out duration-100 sm:duration-300"
x-transition:enter-start="translate-x-full" x-transition:enter-end="translate-x-0"
x-transition:leave="transform transition ease-in-out duration-100 sm:duration-300"
x-transition:leave-start="translate-x-0" x-transition:leave-end="translate-x-full"
class="w-screen max-w-md">
<div
class="flex flex-col h-full py-6 overflow-hidden border-l shadow-lg bg-base-100 border-neutral-800">
<div class="px-4 pb-10 sm:px-5">
<div class="flex items-start justify-between pb-1">
<h2 class="text-2xl leading-6" id="slide-over-title">
{{ $title }}</h2>
<div class="flex items-center h-auto ml-3">
<button class="icon" @click="slideOverOpen=false"
class="absolute top-0 right-0 z-30 flex items-center justify-center px-3 py-2 mt-4 mr-2 space-x-1 text-xs font-normal border-none rounded">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none"
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
>
<path stroke-linecap="round" stroke-linejoin="round"
d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
</div>
</div>
<div class="relative flex-1 px-4 mt-5 sm:px-5">
<div class="absolute inset-0 px-4 sm:px-5">
{{ $content }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
</div>

View File

@ -14,20 +14,24 @@ class="text-warning">{{ session('currentTeam.name') }}</span></span>
</ol>
</nav>
<nav class="navbar-main">
<a class="{{ request()->routeIs('team.index') ? 'text-white' : '' }}" href="{{ route('team.index') }}">
<a class="{{ request()->routeIs('team.index') ? 'text-white' : '' }}" href="{{ route('team.index') }}">
<button>General</button>
</a>
<a class="{{ request()->routeIs('team.member.index') ? 'text-white' : '' }}" href="{{ route('team.member.index') }}">
<a class="{{ request()->routeIs('team.member.index') ? 'text-white' : '' }}" href="{{ route('team.member.index') }}">
<button>Members</button>
</a>
<a class="{{ request()->routeIs('team.storage.index') ? 'text-white' : '' }}"
<a class="{{ request()->routeIs('team.storage.index') ? 'text-white' : '' }}"
href="{{ route('team.storage.index') }}">
<button>S3 Storages</button>
</a>
<a class="{{ request()->routeIs('team.notification.index') ? 'text-white' : '' }}"
<a class="{{ request()->routeIs('team.notification.index') ? 'text-white' : '' }}"
href="{{ route('team.notification.index') }}">
<button>Notifications</button>
</a>
<a class="{{ request()->routeIs('team.shared-variables.index') ? 'text-white' : '' }}"
href="{{ route('team.shared-variables.index') }}">
<button>Shared Variables</button>
</a>
<div class="flex-1"></div>
<div class="-mt-9">
<livewire:switch-team />

View File

@ -0,0 +1,439 @@
<div x-data="{
title: 'Default Toast Notification',
description: '',
type: 'default',
position: 'top-center',
expanded: false,
popToast(custom) {
let html = '';
if (typeof custom != 'undefined') {
html = custom;
}
toast(this.title, { description: this.description, type: this.type, position: this.position, html: html })
}
}" x-init="window.toast = function(message, options = {}) {
let description = '';
let type = 'default';
let position = 'top-center';
let html = '';
if (typeof options.description != 'undefined') description = options.description;
if (typeof options.type != 'undefined') type = options.type;
if (typeof options.position != 'undefined') position = options.position;
if (typeof options.html != 'undefined') html = options.html;
window.dispatchEvent(new CustomEvent('toast-show', { detail: { type: type, message: message, description: description, position: position, html: html } }));
}
window.customToastHTML = `
<div class='relative flex items-start justify-center p-4'>
<div class='flex flex-col'>
<p class='text-sm font-medium text-gray-800'>New Friend Request</p>
<p class='mt-1 text-xs leading-none text-gray-800'>Friend request from John Doe.</p>
<div class='flex mt-3'>
<button type='button' @click='burnToast(toast.id)' class='inline-flex items-center px-2 py-1 text-xs font-semibold text-white bg-indigo-600 rounded shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600'>Accept</button>
<button type='button' @click='burnToast(toast.id)' class='inline-flex items-center px-2 py-1 ml-3 text-xs font-semibold text-gray-900 bg-white rounded shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50'>Decline</button>
</div>
</div>
</div>
`" class="relative space-y-5">
<template x-teleport="body">
<ul x-data="{
toasts: [],
toastsHovered: false,
expanded: false,
layout: 'default',
position: 'top-center',
paddingBetweenToasts: 15,
deleteToastWithId(id) {
for (let i = 0; i < this.toasts.length; i++) {
if (this.toasts[i].id === id) {
this.toasts.splice(i, 1);
break;
}
}
},
burnToast(id) {
burnToast = this.getToastWithId(id);
burnToastElement = document.getElementById(burnToast.id);
if (burnToastElement) {
if (this.toasts.length == 1) {
if (this.layout == 'default') {
this.expanded = false;
}
burnToastElement.classList.remove('translate-y-0');
if (this.position.includes('bottom')) {
burnToastElement.classList.add('translate-y-full');
} else {
burnToastElement.classList.add('-translate-y-full');
}
burnToastElement.classList.add('-translate-y-full');
}
burnToastElement.classList.add('opacity-0');
let that = this;
setTimeout(function() {
that.deleteToastWithId(id);
setTimeout(function() {
that.stackToasts();
}, 1)
}, 300);
}
},
getToastWithId(id) {
for (let i = 0; i < this.toasts.length; i++) {
if (this.toasts[i].id === id) {
return this.toasts[i];
}
}
},
stackToasts() {
this.positionToasts();
this.calculateHeightOfToastsContainer();
let that = this;
setTimeout(function() {
that.calculateHeightOfToastsContainer();
}, 300);
},
positionToasts() {
if (this.toasts.length == 0) return;
let topToast = document.getElementById(this.toasts[0].id);
topToast.style.zIndex = 100;
if (this.expanded) {
if (this.position.includes('bottom')) {
topToast.style.top = 'auto';
topToast.style.bottom = '0px';
} else {
topToast.style.top = '0px';
}
}
let bottomPositionOfFirstToast = this.getBottomPositionOfElement(topToast);
if (this.toasts.length == 1) return;
let middleToast = document.getElementById(this.toasts[1].id);
middleToast.style.zIndex = 90;
if (this.expanded) {
middleToastPosition = topToast.getBoundingClientRect().height +
this.paddingBetweenToasts + 'px';
if (this.position.includes('bottom')) {
middleToast.style.top = 'auto';
middleToast.style.bottom = middleToastPosition;
} else {
middleToast.style.top = middleToastPosition;
}
middleToast.style.scale = '100%';
middleToast.style.transform = 'translateY(0px)';
} else {
middleToast.style.scale = '94%';
if (this.position.includes('bottom')) {
middleToast.style.transform = 'translateY(-16px)';
} else {
this.alignBottom(topToast, middleToast);
middleToast.style.transform = 'translateY(16px)';
}
}
if (this.toasts.length == 2) return;
let bottomToast = document.getElementById(this.toasts[2].id);
bottomToast.style.zIndex = 80;
if (this.expanded) {
bottomToastPosition = topToast.getBoundingClientRect().height +
this.paddingBetweenToasts +
middleToast.getBoundingClientRect().height +
this.paddingBetweenToasts + 'px';
if (this.position.includes('bottom')) {
bottomToast.style.top = 'auto';
bottomToast.style.bottom = bottomToastPosition;
} else {
bottomToast.style.top = bottomToastPosition;
}
bottomToast.style.scale = '100%';
bottomToast.style.transform = 'translateY(0px)';
} else {
bottomToast.style.scale = '88%';
if (this.position.includes('bottom')) {
bottomToast.style.transform = 'translateY(-32px)';
} else {
this.alignBottom(topToast, bottomToast);
bottomToast.style.transform = 'translateY(32px)';
}
}
if (this.toasts.length == 3) return;
let burnToast = document.getElementById(this.toasts[3].id);
burnToast.style.zIndex = 70;
if (this.expanded) {
burnToastPosition = topToast.getBoundingClientRect().height +
this.paddingBetweenToasts +
middleToast.getBoundingClientRect().height +
this.paddingBetweenToasts +
bottomToast.getBoundingClientRect().height +
this.paddingBetweenToasts + 'px';
if (this.position.includes('bottom')) {
burnToast.style.top = 'auto';
burnToast.style.bottom = burnToastPosition;
} else {
burnToast.style.top = burnToastPosition;
}
burnToast.style.scale = '100%';
burnToast.style.transform = 'translateY(0px)';
} else {
burnToast.style.scale = '82%';
this.alignBottom(topToast, burnToast);
burnToast.style.transform = 'translateY(48px)';
}
burnToast.firstElementChild.classList.remove('opacity-100');
burnToast.firstElementChild.classList.add('opacity-0');
let that = this;
// Burn 🔥 (remove) last toast
setTimeout(function() {
that.toasts.pop();
}, 300);
if (this.position.includes('bottom')) {
middleToast.style.top = 'auto';
}
return;
},
alignBottom(element1, element2) {
// Get the top position and height of the first element
let top1 = element1.offsetTop;
let height1 = element1.offsetHeight;
// Get the height of the second element
let height2 = element2.offsetHeight;
// Calculate the top position for the second element
let top2 = top1 + (height1 - height2);
// Apply the calculated top position to the second element
element2.style.top = top2 + 'px';
},
alignTop(element1, element2) {
// Get the top position of the first element
let top1 = element1.offsetTop;
// Apply the same top position to the second element
element2.style.top = top1 + 'px';
},
resetBottom() {
for (let i = 0; i < this.toasts.length; i++) {
if (document.getElementById(this.toasts[i].id)) {
let toastElement = document.getElementById(this.toasts[i].id);
toastElement.style.bottom = '0px';
}
}
},
resetTop() {
for (let i = 0; i < this.toasts.length; i++) {
if (document.getElementById(this.toasts[i].id)) {
let toastElement = document.getElementById(this.toasts[i].id);
toastElement.style.top = '0px';
}
}
},
getBottomPositionOfElement(el) {
return (el.getBoundingClientRect().height + el.getBoundingClientRect().top);
},
calculateHeightOfToastsContainer() {
if (this.toasts.length == 0) {
$el.style.height = '0px';
return;
}
lastToast = this.toasts[this.toasts.length - 1];
lastToastRectangle = document.getElementById(lastToast.id).getBoundingClientRect();
firstToast = this.toasts[0];
firstToastRectangle = document.getElementById(firstToast.id).getBoundingClientRect();
if (this.toastsHovered) {
if (this.position.includes('bottom')) {
$el.style.height = ((firstToastRectangle.top + firstToastRectangle.height) - lastToastRectangle.top) + 'px';
} else {
$el.style.height = ((lastToastRectangle.top + lastToastRectangle.height) - firstToastRectangle.top) + 'px';
}
} else {
$el.style.height = firstToastRectangle.height + 'px';
}
}
}"
@set-toasts-layout.window="
layout=event.detail.layout;
if(layout == 'expanded'){
expanded=true;
} else {
expanded=false;
}
stackToasts();
"
@toast-show.window="
event.stopPropagation();
if(event.detail.position){
position = event.detail.position;
}
toasts.unshift({
id: 'toast-' + Math.random().toString(16).slice(2),
show: false,
message: event.detail.message,
description: event.detail.description,
type: event.detail.type,
html: event.detail.html
});
"
@mouseenter="toastsHovered=true;" @mouseleave="toastsHovered=false" x-init="if (layout == 'expanded') {
expanded = true;
}
stackToasts();
$watch('toastsHovered', function(value) {
if (layout == 'default') {
if (position.includes('bottom')) {
resetBottom();
} else {
resetTop();
}
if (value) {
// calculate the new positions
expanded = true;
if (layout == 'default') {
stackToasts();
}
} else {
if (layout == 'default') {
expanded = false;
//setTimeout(function(){
stackToasts();
//}, 10);
setTimeout(function() {
stackToasts();
}, 10)
}
}
}
});"
class="fixed block w-full group z-[99] sm:max-w-xs"
:class="{ 'right-0 top-0 sm:mt-6 sm:mr-6': position=='top-right', 'left-0 top-0 sm:mt-6 sm:ml-6': position=='top-left', 'left-1/2 -translate-x-1/2 top-0 sm:mt-6': position=='top-center', 'right-0 bottom-0 sm:mr-6 sm:mb-6': position=='bottom-right', 'left-0 bottom-0 sm:ml-6 sm:mb-6': position=='bottom-left', 'left-1/2 -translate-x-1/2 bottom-0 sm:mb-6': position=='bottom-center' }"
x-cloak>
<template x-for="(toast, index) in toasts" :key="toast.id">
<li :id="toast.id" x-data="{
toastHovered: false
}" x-init="if (position.includes('bottom')) {
$el.firstElementChild.classList.add('toast-bottom');
$el.firstElementChild.classList.add('opacity-0', 'translate-y-full');
} else {
$el.firstElementChild.classList.add('opacity-0', '-translate-y-full');
}
setTimeout(function() {
setTimeout(function() {
if (position.includes('bottom')) {
$el.firstElementChild.classList.remove('opacity-0', 'translate-y-full');
} else {
$el.firstElementChild.classList.remove('opacity-0', '-translate-y-full');
}
$el.firstElementChild.classList.add('opacity-100', 'translate-y-0');
setTimeout(function() {
stackToasts();
}, 10);
}, 5);
}, 50);
setTimeout(function() {
setTimeout(function() {
$el.firstElementChild.classList.remove('opacity-100');
$el.firstElementChild.classList.add('opacity-0');
if (toasts.length == 1) {
$el.firstElementChild.classList.remove('translate-y-0');
$el.firstElementChild.classList.add('-translate-y-full');
}
setTimeout(function() {
deleteToastWithId(toast.id)
}, 300);
}, 5);
}, 4000);"
@mouseover="toastHovered=true" @mouseout="toastHovered=false"
class="absolute w-full duration-300 ease-out select-none sm:max-w-xs"
:class="{ 'toast-no-description': !toast.description }">
<span
class="relative flex flex-col items-start shadow-[0_5px_15px_-3px_rgb(0_0_0_/_0.08)] w-full transition-all duration-300 ease-out bg-coolgray-200 border border-coolgray-100 sm:rounded-md sm:max-w-xs group"
:class="{ 'p-4': !toast.html, 'p-0': toast.html }">
<template x-if="!toast.html">
<div class="relative">
<div class="flex items-center"
:class="{ 'text-green-500': toast.type=='success', 'text-blue-500': toast.type=='info', 'text-orange-400': toast.type=='warning', 'text-red-500': toast.type=='danger', 'text-gray-800': toast.type=='default' }">
<svg x-show="toast.type=='success'" class="w-[18px] h-[18px] mr-1.5 -ml-1"
viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM16.7744 9.63269C17.1238 9.20501 17.0604 8.57503 16.6327 8.22559C16.2051 7.87615 15.5751 7.93957 15.2256 8.36725L10.6321 13.9892L8.65936 12.2524C8.24484 11.8874 7.61295 11.9276 7.248 12.3421C6.88304 12.7566 6.92322 13.3885 7.33774 13.7535L9.31046 15.4903C10.1612 16.2393 11.4637 16.1324 12.1808 15.2547L16.7744 9.63269Z"
fill="currentColor"></path>
</svg>
<svg x-show="toast.type=='info'" class="w-[18px] h-[18px] mr-1.5 -ml-1"
viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM12 9C12.5523 9 13 8.55228 13 8C13 7.44772 12.5523 7 12 7C11.4477 7 11 7.44772 11 8C11 8.55228 11.4477 9 12 9ZM13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12V16C11 16.5523 11.4477 17 12 17C12.5523 17 13 16.5523 13 16V12Z"
fill="currentColor"></path>
</svg>
<svg x-show="toast.type=='warning'" class="w-[18px] h-[18px] mr-1.5 -ml-1"
viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M9.44829 4.46472C10.5836 2.51208 13.4105 2.51168 14.5464 4.46401L21.5988 16.5855C22.7423 18.5509 21.3145 21 19.05 21L4.94967 21C2.68547 21 1.25762 18.5516 2.4004 16.5862L9.44829 4.46472ZM11.9995 8C12.5518 8 12.9995 8.44772 12.9995 9V13C12.9995 13.5523 12.5518 14 11.9995 14C11.4473 14 10.9995 13.5523 10.9995 13V9C10.9995 8.44772 11.4473 8 11.9995 8ZM12.0009 15.99C11.4486 15.9892 11.0003 16.4363 10.9995 16.9886L10.9995 16.9986C10.9987 17.5509 11.4458 17.9992 11.9981 18C12.5504 18.0008 12.9987 17.5537 12.9995 17.0014L12.9995 16.9914C13.0003 16.4391 12.5532 15.9908 12.0009 15.99Z"
fill="currentColor"></path>
</svg>
<svg x-show="toast.type=='danger'" class="w-[18px] h-[18px] mr-1.5 -ml-1"
viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM11.9996 7C12.5519 7 12.9996 7.44772 12.9996 8V12C12.9996 12.5523 12.5519 13 11.9996 13C11.4474 13 10.9996 12.5523 10.9996 12V8C10.9996 7.44772 11.4474 7 11.9996 7ZM12.001 14.99C11.4488 14.9892 11.0004 15.4363 10.9997 15.9886L10.9996 15.9986C10.9989 16.5509 11.446 16.9992 11.9982 17C12.5505 17.0008 12.9989 16.5537 12.9996 16.0014L12.9996 15.9914C13.0004 15.4391 12.5533 14.9908 12.001 14.99Z"
fill="currentColor"></path>
</svg>
<p class="font-medium leading-none text-neutral-200"
x-html="toast.message">
</p>
</div>
<p x-show="toast.description" :class="{ 'pl-5': toast.type!='default' }"
class="mt-1.5 text-xs leading-none opacity-70" x-html="toast.description"></p>
</div>
</template>
<template x-if="toast.html">
<div x-html="toast.html"></div>
</template>
<span @click="burnToast(toast.id)"
class="absolute right-0 p-1.5 mr-2.5 text-neutral-400 duration-100 ease-in-out rounded-full opacity-0 cursor-pointer hover:bg-coolgray-400 hover:text-neutral-300"
:class="{
'top-1/2 -translate-y-1/2': !toast.description && !toast.html,
'top-0 mt-2.5': (toast
.description || toast.html),
'opacity-100': toastHovered,
'opacity-0': !
toastHovered
}">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg>
</span>
</span>
</li>
</template>
</ul>
</template>
</div>

View File

@ -10,7 +10,7 @@
<a href="/">
<x-forms.button>Go back home</x-forms.button>
</a>
<a target="_blank" class="text-xs" href="{{ config('coolify.docs') }}">Contact
<a target="_blank" class="text-xs" href="{{ config('coolify.contact') }}">Contact
support
<x-external-link />
</a>

View File

@ -10,7 +10,7 @@
<a href="/">
<x-forms.button>Go back home</x-forms.button>
</a>
<a target="_blank" class="text-xs" href="{{ config('coolify.docs') }}">Contact
<a target="_blank" class="text-xs" href="{{ config('coolify.contact') }}">Contact
support
<x-external-link />
</a>

View File

@ -11,7 +11,7 @@
<a href="/">
<x-forms.button>Go back home</x-forms.button>
</a>
<a target="_blank" class="text-xs" href="{{ config('coolify.docs') }}">Contact
<a target="_blank" class="text-xs" href="{{ config('coolify.contact') }}">Contact
support
<x-external-link />
</a>

View File

@ -11,7 +11,7 @@
<a href="/">
<x-forms.button>Go back home</x-forms.button>
</a>
<a href="{{ config('coolify.docs') }}" class="font-semibold text-white ">Contact
<a href="{{ config('coolify.contact') }}" class="font-semibold text-white ">Contact
support
<span aria-hidden="true">&rarr;</span></a>
</div>

View File

@ -11,7 +11,7 @@
<a href="/">
<x-forms.button>Go back home</x-forms.button>
</a>
<a href="{{ config('coolify.docs') }}" class="font-semibold text-white ">Contact
<a href="{{ config('coolify.contact') }}" class="font-semibold text-white ">Contact
support
<span aria-hidden="true">&rarr;</span></a>
</div>

View File

@ -14,7 +14,7 @@
<a href="/">
<x-forms.button>Go back home</x-forms.button>
</a>
<a href="{{ config('coolify.docs') }}" class="font-semibold text-white">Contact
<a href="{{ config('coolify.contact') }}" class="font-semibold text-white">Contact
support
<span aria-hidden="true">&rarr;</span></a>
</div>

View File

@ -8,7 +8,7 @@
patience.
</p>
<div class="flex items-center justify-center mt-10 gap-x-6">
<a href="{{ config('coolify.docs') }}" class="font-semibold text-white ">Contact
<a href="{{ config('coolify.contact') }}" class="font-semibold text-white ">Contact
support
<span aria-hidden="true">&rarr;</span></a>
</div>

View File

@ -42,7 +42,7 @@
<button>close</button>
</form>
</dialog>
<x-toaster-hub />
<x-toast />
<x-version class="fixed left-2 bottom-1" />
<script data-navigate-once>
@auth
@ -89,7 +89,9 @@ function revive() {
fetch('/api/health')
.then(response => {
if (response.ok) {
Toaster.success('Coolify is back online. Reloading...')
window.toast('Coolify is back online. Reloading...', {
type: 'success',
})
if (checkHealthInterval) clearInterval(checkHealthInterval);
setTimeout(() => {
window.location.reload();
@ -110,7 +112,9 @@ function upgrade() {
if (response.ok) {
console.log('It\'s alive. Waiting for server to be dead...');
} else {
Toaster.success('Update done, restarting Coolify!')
window.toast('Update done, restarting Coolify!', {
type: 'success',
})
console.log('It\'s dead. Reviving... Standby... Bzz... Bzz...')
if (checkIfIamDeadInterval) clearInterval(checkIfIamDeadInterval);
revive();
@ -134,16 +138,36 @@ function copyToClipboard(text) {
}
})
window.Livewire.on('info', (message) => {
if (message) Toaster.info(message)
if (message.length > 0) {
window.toast(message[0], {
type: 'info',
description: message[1],
})
}
})
window.Livewire.on('error', (message) => {
if (message) Toaster.error(message)
if (message.length > 0) {
window.toast(message[0], {
type: 'danger',
description: message[1],
})
}
})
window.Livewire.on('warning', (message) => {
if (message) Toaster.warning(message)
if (message.length > 0) {
window.toast(message[0], {
type: 'warning',
description: message[1],
})
}
})
window.Livewire.on('success', (message) => {
if (message) Toaster.success(message)
if (message.length > 0) {
window.toast(message[0], {
type: 'success',
description: message[1],
})
}
})
window.Livewire.on('installDocker', () => {
installDocker.showModal();

View File

@ -5,13 +5,13 @@
<h1>Dashboard</h1>
<div class="subtitle">Your self-hosted environment</div>
@if (request()->query->get('success'))
<div class="rounded alert alert-success">
<div class="text-white rounded alert alert-success">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 stroke-current shrink-0" fill="none"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span>Your subscription has been activated! Welcome onboard!</span>
<span>Your subscription has been activated! Welcome onboard! <br>It could take a few seconds before your subscription is activated.<br> Please be patient.</span>
</div>
@endif
@if ($projects->count() === 0 && $servers->count() === 0)

View File

@ -22,8 +22,8 @@
instantSave id="application.settings.is_log_drain_enabled" label="Drain Logs" />
@endif
<h4>Git</h4>
@if ($application->git_based())
<h4>Git</h4>
<x-forms.checkbox instantSave id="application.settings.is_git_submodules_enabled" label="Git Submodules"
helper="Allow Git Submodules during build process." />
<x-forms.checkbox instantSave id="application.settings.is_git_lfs_enabled" label="Git LFS"

View File

@ -59,7 +59,10 @@
href="#">Resource Limits
</a>
@endif
<a :class="activeTab === 'resource-operations' && 'text-white'"
@click.prevent="activeTab = 'resource-operations'; window.location.hash = 'resource-operations'"
href="#">Resource Operations
</a>
<a :class="activeTab === 'danger' && 'text-white'"
@click.prevent="activeTab = 'danger'; window.location.hash = 'danger'" href="#">Danger Zone
</a>
@ -106,6 +109,9 @@
<div x-cloak x-show="activeTab === 'scheduled-tasks'">
<livewire:project.shared.scheduled-task.all :resource="$application" />
</div>
<div x-cloak x-show="activeTab === 'resource-operations'">
<livewire:project.shared.resource-operations :resource="$application" />
</div>
<div x-cloak x-show="activeTab === 'danger'">
<livewire:project.shared.danger :resource="$application" />
</div>

View File

@ -44,7 +44,10 @@
window.location.hash = 'resource-limits'"
href="#">Resource Limits
</a>
<a :class="activeTab === 'resource-operations' && 'text-white'"
@click.prevent="activeTab = 'resource-operations'; window.location.hash = 'resource-operations'"
href="#">Resource Operations
</a>
<a :class="activeTab === 'danger' && 'text-white'"
@click.prevent="activeTab = 'danger';
window.location.hash = 'danger'"
@ -83,6 +86,9 @@
<div x-cloak x-show="activeTab === 'import'">
<livewire:project.database.import :resource="$database" />
</div>
<div x-cloak x-show="activeTab === 'resource-operations'">
<livewire:project.shared.resource-operations :resource="$database" />
</div>
<div x-cloak x-show="activeTab === 'danger'">
<livewire:project.shared.danger :resource="$database" />
</div>

View File

@ -1,13 +1,37 @@
<div>
<form wire:submit='submit' class="flex flex-col gap-2 ">
<h1>Project: {{ data_get($project, 'name') }}</h1>
<div class="pb-10">Edit project details here.</div>
<form wire:submit='submit' class="flex flex-col gap-2 pb-10">
<div class="flex items-end gap-2">
<h1>Project: {{ data_get($project, 'name') }}</h1>
<h2>General</h2>
<x-forms.button type="submit">Save</x-forms.button>
</div>
<div class="pb-10">Edit project details here.</div>
<div class="flex gap-2">
<x-forms.input label="Name" id="project.name" />
<x-forms.input label="Description" id="project.description" />
</div>
</form>
<div class="flex gap-2">
<h2>Shared Variables</h2>
<x-slide-over>
<x-slot:title>New Shared Variable</x-slot:title>
<x-slot:content>
<livewire:project.shared.environment-variable.add />
</x-slot:content>
<button @click="slideOverOpen=true"
class="font-normal text-white normal-case border-none rounded btn btn-primary btn-sm no-animation">+
Add</button>
</x-slide-over>
</div>
<div class="flex items-center gap-2 pb-4">You can use these variables anywhere with <span class="text-warning">@{{project.VARIABLENAME}}</span><x-helper
helper="More info <a class='text-white underline' href='https://coolify.io/docs/environment-variables#shared-variables' target='_blank'>here</a>."></x-helper>
</div>
<div class="flex flex-col gap-2">
@forelse ($project->environment_variables->sort()->sortBy('real_value') as $env)
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
:env="$env" type="project" />
@empty
<div class="text-neutral-500">No environment variables found.</div>
@endforelse
</div>
</div>

View File

@ -8,7 +8,7 @@
<ol class="flex items-center">
<li class="inline-flex items-center">
<a class="text-xs truncate lg:text-sm"
href="{{ route('project.show', ['project_uuid' => request()->route('project_uuid')]) }}">
href="{{ route('project.show', ['project_uuid' => data_get($parameters, 'project_uuid')]) }}">
{{ $project->name }}</a>
</li>
<li>
@ -20,7 +20,7 @@
clip-rule="evenodd"></path>
</svg>
<a class="text-xs truncate lg:text-sm"
href="{{ route('project.resource.index', ['environment_name' => request()->route('environment_name'), 'project_uuid' => request()->route('project_uuid')]) }}">{{ request()->route('environment_name') }}</a>
href="{{ route('project.resource.index', ['environment_name' => data_get($parameters, 'environment_name'), 'project_uuid' => data_get($parameters, 'project_uuid')]) }}">{{ data_get($parameters, 'environment_name') }}</a>
</div>
</li>
<li>
@ -41,4 +41,27 @@
<x-forms.input label="Description" id="environment.description" />
</div>
</form>
<div class="flex gap-2 pt-10">
<h2>Shared Variables</h2>
<x-slide-over>
<x-slot:title>New Shared Variable</x-slot:title>
<x-slot:content>
<livewire:project.shared.environment-variable.add />
</x-slot:content>
<button @click="slideOverOpen=true"
class="font-normal text-white normal-case border-none rounded btn btn-primary btn-sm no-animation">+
Add</button>
</x-slide-over>
</div>
<div class="flex items-center gap-2 pb-4">You can use these variables anywhere with <span class="text-warning">@{{environment.VARIABLENAME}}</span><x-helper
helper="More info <a class='text-white underline' href='https://coolify.io/docs/environment-variables#shared-variables' target='_blank'>here</a>."></x-helper>
</div>
<div class="flex flex-col gap-2">
@forelse ($environment->environment_variables->sort()->sortBy('real_value') as $env)
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
:env="$env" type="environment" />
@empty
<div class="text-neutral-500">No environment variables found.</div>
@endforelse
</div>
</div>

View File

@ -40,23 +40,29 @@ class="loading loading-xs text-warning loading-spinner"></span>
<li class="step step-secondary">Select a Private Key</li>
<li class="step step-secondary">Select a Repository, Branch & Save</li>
</ul>
<form class="flex flex-col gap-2 pb-6" wire:submit='submit'>
<form class="flex flex-col gap-2 pt-2" wire:submit='submit'>
<x-forms.input id="repository_url" required label="Repository Url" helper="{!! __('repository.url') !!}" />
<div class="flex gap-2">
<x-forms.input id="repository_url" required label="Repository URL"
helper="{!! __('repository.url') !!}" />
<x-forms.input id="branch" required label="Branch" />
<x-forms.select wire:model.live="build_pack" label="Build Pack" required>
<option value="nixpacks">Nixpacks</option>
<option value="static">Static</option>
<option value="dockerfile">Dockerfile</option>
<option value="dockercompose">Docker Compose</option>
</x-forms.select>
@if ($is_static)
<x-forms.input id="publish_directory" required label="Publish Directory" />
@else
<x-forms.input type="number" required id="port" label="Port" :readonly="$is_static" />
@endif
</div>
<div class="w-52">
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
</div>
<x-forms.button type="submit">
Save New Application
@if ($show_is_static)
<x-forms.input type="number" required id="port" label="Port" :readonly="$is_static || $build_pack === 'static'" />
<div class="w-52">
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
</div>
@endif
<x-forms.button type="submit" class="mt-4">
Continue
</x-forms.button>
</form>
@endif

View File

@ -4,8 +4,16 @@
<x-forms.button wire:click="saveFromRedirect('source.new')" class="group-hover:text-white">
+ Add New GitHub App
</x-forms.button>
@if ($repositories->count() > 0)
<a target="_blank" class="flex hover:no-underline" href="{{ get_installation_path($github_app) }}">
<x-forms.button>
Change Repositories on GitHub
<x-external-link />
</x-forms.button>
</a>
@endif
</div>
<div class="pb-4">Deploy any public or private git repositories through a GitHub App.</div>
<div class="pb-4">Deploy any public or private Git repositories through a GitHub App.</div>
@if ($github_apps->count() !== 0)
<div class="flex flex-col gap-2 pt-10">
@if ($current_step === 'github_apps')
@ -53,14 +61,8 @@ class="loading loading-xs text-warning loading-spinner"></span>
@endif
@endforeach
</x-forms.select>
<x-forms.button wire:click.prevent="loadBranches"> Load Repository Details </x-forms.button>
<a target="_blank" class="flex hover:no-underline"
href="{{ get_installation_path($github_app) }}">
<x-forms.button>
Change Repositories on GitHub
<x-external-link />
</x-forms.button>
</a>
<x-forms.button wire:click.prevent="loadBranches"> Load Repository </x-forms.button>
</div>
@else
<div>No repositories found. Check your GitHub App configuration.</div>
@ -84,21 +86,28 @@ class="loading loading-xs text-warning loading-spinner"></span>
@endif
@endforeach
</x-forms.select>
<x-forms.select wire:model.live="build_pack" label="Build Pack" required>
<option value="nixpacks">Nixpacks</option>
<option value="static">Static</option>
<option value="dockerfile">Dockerfile</option>
<option value="dockercompose">Docker Compose</option>
</x-forms.select>
@if ($is_static)
<x-forms.input id="publish_directory" label="Publish Directory"
helper="If there is a build process involved (like Svelte, React, Next, etc..), please specify the output directory for the build assets." />
@else
<x-forms.input type="number" id="port" label="Port" :readonly="$is_static"
helper="The port your application listens on." />
@endif
</div>
<div class="w-52">
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
</div>
@if ($show_is_static)
<x-forms.input type="number" id="port" label="Port" :readonly="$is_static || $build_pack === 'static'"
helper="The port your application listens on." />
<div class="w-52">
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
</div>
@endif
</div>
<x-forms.button type="submit">
Save New Application
Continue
</x-forms.button>
@endif
@endif

View File

@ -11,7 +11,7 @@
</x-forms.button>
</div>
@if (!$branch_found)
<div>
<div class="px-2 pt-4">
<p>Public repositories: <span class='text-helper'>https://...</span></p>
<p>Private repositories: <span class='text-helper'>git@...</span></p>
<p>Preselect branch: <span
@ -42,15 +42,14 @@ class='text-helper'>https://github.com/coollabsio/coolify-examples/tree/static</
<option value="dockerfile">Dockerfile</option>
<option value="dockercompose">Docker Compose</option>
</x-forms.select>
</div>
@if ($show_is_static)
@if ($is_static)
<x-forms.input id="publish_directory" label="Publish Directory"
helper="If there is a build process involved (like Svelte, React, Next, etc..), please specify the output directory for the build assets." />
@else
<x-forms.input type="number" id="port" label="Port" :readonly="$is_static"
helper="The port your application listens on." />
@endif
</div>
@if ($show_is_static)
<x-forms.input type="number" id="port" label="Port" :readonly="$is_static || $build_pack === 'static'"
helper="The port your application listens on." />
<div class="w-52">
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />

View File

@ -43,132 +43,134 @@ class="font-normal text-white normal-case border-none rounded hover:no-underline
@if ($environment->isEmpty())
<a href="{{ route('project.resource.create', ['project_uuid' => request()->route('project_uuid'), 'environment_name' => request()->route('environment_name')]) }} "
class="items-center justify-center box">+ Add New Resource</a>
@endif
<div x-data="searchComponent()">
<x-forms.input placeholder="Search for name, fqdn..." class="w-full" x-model="search" />
<div class="grid gap-2 pt-4 lg:grid-cols-2">
<template x-for="item in filteredApplications" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="pb-2 font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
<div class="description" x-text="item.fqdn"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredPostgresqls" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredRedis" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredMongodbs" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredMysqls" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredMariadbs" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredServices" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('degraded')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
@else
<div x-data="searchComponent()">
<x-forms.input placeholder="Search for name, fqdn..." class="w-full" x-model="search" />
<div class="grid gap-2 pt-4 lg:grid-cols-2">
<template x-for="item in filteredApplications" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="pb-2 font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
<div class="description" x-text="item.fqdn"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredPostgresqls" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredRedis" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredMongodbs" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredMysqls" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredMariadbs" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('restarting')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
<template x-for="item in filteredServices" :key="item.id">
<a class="relative box group" :href="item.hrefLink">
<div class="flex flex-col mx-6">
<div class="font-bold text-white" x-text="item.name"></div>
<div class="description" x-text="item.description"></div>
</div>
<template x-if="item.status.startsWith('running')">
<div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('exited')">
<div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
</template>
<template x-if="item.status.startsWith('degraded')">
<div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
</template>
</a>
</template>
</div>
</div>
</div>
@endif
</div>
<script>

View File

@ -26,6 +26,10 @@
<a :class="activeTab === 'webhooks' && 'text-white'"
@click.prevent="activeTab = 'webhooks'; window.location.hash = 'webhooks'" href="#">Webhooks
</a>
<a :class="activeTab === 'resource-operations' && 'text-white'"
@click.prevent="activeTab = 'resource-operations'; window.location.hash = 'resource-operations'"
href="#">Resource Operations
</a>
<a :class="activeTab === 'danger' && 'text-white'"
@click.prevent="activeTab = 'danger';
window.location.hash = 'danger'"
@ -157,6 +161,9 @@
<div x-cloak x-show="activeTab === 'environment-variables'">
<livewire:project.shared.environment-variable.all :resource="$service" />
</div>
<div x-cloak x-show="activeTab === 'resource-operations'">
<livewire:project.shared.resource-operations :resource="$service" />
</div>
<div x-cloak x-show="activeTab === 'danger'">
<livewire:project.shared.danger :resource="$service" />
</div>

View File

@ -1,16 +1,10 @@
<dialog id="newVariable" class="modal">
<form method="dialog" class="flex flex-col gap-2 rounded modal-box" wire:submit='submit'>
<h3 class="text-lg font-bold">Add Environment Variable</h3>
<x-forms.input placeholder="NODE_ENV" id="key" label="Name" required />
<x-forms.input placeholder="production" id="value" label="Value" required />
@if (data_get($parameters, 'application_uuid'))
<x-forms.checkbox id="is_build_time" label="Build Variable?" />
@endif
<x-forms.button onclick="newVariable.close()" type="submit">
Save
</x-forms.button>
</form>
<form method="dialog" class="modal-backdrop">
<button>close</button>
</form>
</dialog>
<form class="flex flex-col gap-2 rounded" wire:submit='submit'>
<x-forms.input placeholder="NODE_ENV" id="key" label="Name" required />
<x-forms.input placeholder="production" id="value" label="Value" required />
@if (data_get($parameters, 'application_uuid'))
<x-forms.checkbox id="is_build_time" label="Build Variable?" />
@endif
<x-forms.button type="submit" @click="slideOverOpen=false">
Save
</x-forms.button>
</form>

View File

@ -2,15 +2,26 @@
<div>
<div class="flex items-center gap-2">
<h2>Environment Variables</h2>
<x-forms.button class="btn" onclick="newVariable.showModal()">+ Add</x-forms.button>
<livewire:project.shared.environment-variable.add />
@if ($resource->type() !== 'service')
<x-slide-over>
<x-slot:title>New Environment Variable</x-slot:title>
<x-slot:content>
<livewire:project.shared.environment-variable.add />
</x-slot:content>
<button @click="slideOverOpen=true"
class="font-normal text-white normal-case border-none rounded btn btn-primary btn-sm no-animation">+ Add</button>
</x-slide-over>
@endif
<x-forms.button
wire:click='switch'>{{ $view === 'normal' ? 'Developer view' : 'Normal view' }}</x-forms.button>
</div>
<div>Environment variables (secrets) for this resource.</div>
@if ($resource->type() === 'service')
<div>If you cannot find a variable here, or need a new one, define it in the Docker Compose file.</div>
@endif
</div>
@if ($view === 'normal')
@forelse ($resource->environment_variables as $env)
@forelse ($resource->environment_variables->sort()->sortBy('real_value') as $env)
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
:env="$env" :type="$resource->type()" />
@empty
@ -21,19 +32,19 @@
<h3>Preview Deployments</h3>
<div>Environment (secrets) variables for Preview Deployments.</div>
</div>
@foreach ($resource->environment_variables_preview as $env)
@foreach ($resource->environment_variables_preview->sort()->sortBy('real_value') as $env)
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
:env="$env" :type="$resource->type()" />
@endforeach
@endif
@else
<form wire:submit='saveVariables(false)' class="flex flex-col gap-2">
<x-forms.textarea rows=25 class="whitespace-pre-wrap" id="variables"></x-forms.textarea>
<x-forms.textarea rows="10" class="whitespace-pre-wrap" id="variables"></x-forms.textarea>
<x-forms.button type="submit" class="btn btn-primary">Save</x-forms.button>
</form>
@if ($showPreview)
<form wire:submit='saveVariables(true)' class="flex flex-col gap-2">
<x-forms.textarea rows=25 class="whitespace-pre-wrap" label="Preview Environment Variables"
<x-forms.textarea rows="10" class="whitespace-pre-wrap" label="Preview Environment Variables"
id="variablesPreview"></x-forms.textarea>
<x-forms.button type="submit" class="btn btn-primary">Save</x-forms.button>
</form>

View File

@ -19,13 +19,19 @@ class="flex flex-col gap-2 p-4 m-2 border lg:items-center border-coolgray-300 lg
@if ($isDisabled)
<x-forms.input disabled id="env.key" />
<x-forms.input disabled type="password" id="env.value" />
@if ($type !== 'service')
@if ($env->is_shared)
<x-forms.input disabled type="password" id="env.real_value" />
@endif
@if ($type !== 'service' && !$isSharedVariable)
<x-forms.checkbox instantSave id="env.is_build_time" label="Build Variable?" />
@endif
@else
<x-forms.input id="env.key" />
<x-forms.input type="password" id="env.value" />
@if ($type !== 'service')
@if ($env->is_shared)
<x-forms.input disabled type="password" id="env.real_value" />
@endif
@if ($type !== 'service' && !$isSharedVariable)
<x-forms.checkbox instantSave id="env.is_build_time" label="Build Variable?" />
@endif
@endif

View File

@ -0,0 +1,46 @@
<div>
<h2>Resource Operations</h2>
<div class="pb-4">You can easily make different kind of operations on this resource.</div>
<h4>Clone</h4>
<div class="pb-8">
<div class="pb-8">
Clone this resource to another project / environment.
</div>
<div class="flex flex-col gap-4">
@foreach ($servers->sortBy('id') as $server)
<div>
<div class="grid grid-cols-1 gap-2 pb-4 lg:grid-cols-4">
@foreach ($server->destinations() as $destination)
<div class="flex flex-col gap-2 box" wire:click="cloneTo('{{ data_get($destination, 'id') }}')">
<div class="font-bold text-white">{{ $server->name }}</div>
<div>{{ $destination->name }}</div>
</div>
@endforeach
</div>
</div>
@endforeach
</div>
</div>
<h4>Move</h4>
<div>
<div class="pb-8">
This resource is currently in the <span
class="font-bold text-warning">{{ $resource->environment->project->name }} /
{{ $resource->environment->name }}</span> environment.
</div>
<div class="grid gap-4">
@forelse ($projects as $project)
<div class="flex flex-row flex-wrap gap-2">
@foreach ($project->environments as $environment)
<div class="flex flex-col gap-2 box" wire:click="moveTo('{{ data_get($environment, 'id') }}')">
<div class="font-bold text-white">{{ $project->name }}</div>
<div><span class="text-warning">{{ $environment->name }}</span> environment</div>
</div>
@endforeach
</div>
@empty
<div>No projects found to move to</div>
@endforelse
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<div>
<h1>Create a new Private Key</h1>
<h2>Private Key</h2>
<div class="subtitle ">Private Keys are used to connect to your servers without passwords.</div>
<x-forms.button class="mb-4" wire:click="generateNewKey">Generate new SSH key for me</x-forms.button>
<form class="flex flex-col gap-2" wire:submit='createPrivateKey'>

View File

@ -2,7 +2,7 @@
@if ($private_keys->count() === 0)
<h1>Create Private Key</h1>
<div class="subtitle">You need to create a private key before you can create a server.</div>
<livewire:private-key.create from="server" />
<livewire:security.private-key.create from="server" />
@else
<livewire:server.new.by-ip :private_keys="$private_keys" :limit_reached="$limit_reached" />
@endif

View File

@ -86,8 +86,12 @@
@if ($server->isFunctional())
<h3 class="py-4">Settings</h3>
<x-forms.input id="cleanup_after_percentage" label="Disk Cleanup threshold (%)" required
helper="Disk cleanup job will be executed if disk usage is more than this number." />
<div class="flex gap-2">
<x-forms.input id="cleanup_after_percentage" label="Disk cleanup threshold (%)" required
helper="Disk cleanup job will be executed if disk usage is more than this number." />
<x-forms.input id="server.settings.concurrent_builds" label="Number of concurrent builds" required
helper="You can define how many concurrent builds processes / deployments should run at the same time." />
</div>
@endif
</form>
</div>

View File

@ -91,7 +91,13 @@
<span>You must complete this step before you can use this source!</span>
</div>
<div class="flex flex-col">
<h2>Register a GitHub App</h2>
<div class="flex gap-2">
<h2>Register a GitHub App</h2>
<x-forms.button class="bg-coollabs hover:bg-coollabs-100"
x-on:click.prevent="createGithubApp('{{ $webhook_endpoint }}','{{ $preview_deployment_permissions }}')">
Register Now
</x-forms.button>
</div>
<div>You need to register a GitHub App before using this source.</div>
<div class="py-10">
@if (!isCloud() || isDev())
@ -111,16 +117,7 @@
<option value="{{ config('app.url') }}">Use {{ config('app.url') }}</option>
@endif
</x-forms.select>
<x-forms.button
x-on:click.prevent="createGithubApp('{{ $webhook_endpoint }}','{{ $preview_deployment_permissions }}')">
Register
</x-forms.button>
</div>
@else
<x-forms.button
x-on:click.prevent="createGithubApp('{{ $webhook_endpoint }}','{{ $preview_deployment_permissions }}')">
Register Now
</x-forms.button>
@endif
<div class="flex flex-col gap-2 pt-4">
<x-forms.checkbox disabled instantSave id="default_permissions" label="Default Permissions"

View File

@ -18,7 +18,7 @@
<x-forms.checkbox class="pt-2" id="is_system_wide" label="System Wide" />
@endif
<x-forms.button class="mt-4" type="submit">
Save New Source
Continue
</x-forms.button>
</form>
</div>

View File

@ -16,7 +16,7 @@
again</x-forms.button></a>
@endif
<div>To update your subscription (upgrade / downgrade), please <a class="text-white underline"
href="{{ config('coolify.docs') }}" target="_blank">contact us.</a></div>
href="{{ config('coolify.contact') }}" target="_blank">contact us.</a></div>
</div>
@endif
@if (subscriptionProvider() === 'lemon')
@ -25,7 +25,7 @@
@if (currentTeam()->subscription->lemon_status === 'cancelled')
<div class="pb-4">Subscriptions ends at: {{ getRenewDate() }}</div>
<div class="py-4">If you would like to change the subscription to a lower/higher plan, <a
class="text-white underline" href="{{ config('coolify.docs') }}" target="_blank">please
class="text-white underline" href="{{ config('coolify.contact') }}" target="_blank">please
contact
us.</a></div>
@else

View File

@ -23,13 +23,13 @@
</x-slot:pro>
<x-slot:ultimate>
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-ultimate"
class="w-full h-10 buyme"><a class="text-white hover:no-underline" href="{{ config('coolify.docs') }}"
class="w-full h-10 buyme"><a class="text-white hover:no-underline" href="{{ config('coolify.contact') }}"
target="_blank">
Contact Us</a>
</x-forms.button>
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-ultimate"
class="w-full h-10 buyme"><a class="text-white hover:no-underline" href="{{ config('coolify.docs') }}"
class="w-full h-10 buyme"><a class="text-white hover:no-underline" href="{{ config('coolify.contact') }}"
target="_blank">
Contact Us</a>
</x-forms.button>

View File

@ -0,0 +1,27 @@
<div>
<x-team.navbar />
<div class="flex gap-2">
<h2>Shared Variables</h2>
<x-slide-over>
<x-slot:title>New Shared Variable</x-slot:title>
<x-slot:content>
<livewire:project.shared.environment-variable.add />
</x-slot:content>
<button @click="slideOverOpen=true"
class="font-normal text-white normal-case border-none rounded btn btn-primary btn-sm no-animation">+
Add</button>
</x-slide-over>
</div>
<div class="flex items-center gap-2 pb-4">You can use these variables anywhere with <span class="text-warning">@{{team.VARIABLENAME}}</span> <x-helper
helper="More info <a class='text-white underline' href='https://coolify.io/docs/environment-variables#shared-variables' target='_blank'>here</a>."></x-helper>
</div>
<div class="flex flex-col gap-2">
@forelse ($team->environment_variables->sort()->sortBy('real_value') as $env)
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
:env="$env" type="team" />
@empty
<div class="text-neutral-500">No environment variables found.</div>
@endforelse
</div>
</div>

View File

@ -22,3 +22,4 @@
</div>
</div>
</div>
</div>

View File

@ -17,7 +17,7 @@
</div>
<x-forms.button type="submit">
Save New S3 Storage
Continue
</x-forms.button>
</form>
</div>

View File

@ -6,6 +6,7 @@
use App\Actions\Database\StartPostgresql;
use App\Actions\Database\StartRedis;
use App\Actions\Service\StartService;
use App\Models\ApplicationDeploymentQueue;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
@ -23,9 +24,28 @@
|
*/
$middlewares = ['auth:sanctum'];
if (isDev()) {
$middlewares = [];
}
Route::get('/health', function () {
return 'OK';
});
Route::group([
'middleware' => $middlewares,
'prefix' => 'v1'
], function () {
Route::get('/deployments', function() {
return ApplicationDeploymentQueue::whereIn("status", ["in_progress", "queued"])->get([
"id",
"server_id",
"status"
])->groupBy("server_id")->map(function($item) {
return $item;
})->toArray();
});
});
Route::group([
'middleware' => ['auth:sanctum'],
'prefix' => 'v1'
@ -34,74 +54,83 @@
$token = auth()->user()->currentAccessToken();
$teamId = data_get($token, 'team_id');
$uuid = $request->query->get('uuid');
$uuids = explode(',', $uuid);
$uuids = collect(array_filter($uuids));
$force = $request->query->get('force') ?? false;
if (is_null($teamId)) {
return response()->json(['error' => 'Invalid token.'], 400);
return response()->json(['error' => 'Invalid token.', 'docs' => 'https://coolify.io/docs/api/authentication'], 400);
}
if (!$uuid) {
return response()->json(['error' => 'No UUID provided.'], 400);
if (count($uuids) === 0) {
return response()->json(['error' => 'No UUIDs provided.', 'docs' => 'https://coolify.io/docs/api/deploy-webhook'], 400);
}
$resource = getResourceByUuid($uuid, $teamId);
if ($resource) {
$type = $resource->getMorphClass();
if ($type === 'App\Models\Application') {
queue_application_deployment(
application_id: $resource->id,
deployment_uuid: new Cuid2(7),
force_rebuild: $force,
);
return response()->json(['message' => 'Deployment queued.'], 200);
} else if ($type === 'App\Models\StandalonePostgresql') {
if (str($resource->status)->startsWith('running')) {
return response()->json(['message' => 'Database already running.'], 200);
$message = collect([]);
foreach ($uuids as $uuid) {
$resource = getResourceByUuid($uuid, $teamId);
if ($resource) {
$type = $resource->getMorphClass();
if ($type === 'App\Models\Application') {
queue_application_deployment(
server_id: $resource->destination->server->id,
application_id: $resource->id,
deployment_uuid: new Cuid2(7),
force_rebuild: $force,
);
$message->push("Application {$resource->name} deployment queued.");
} else if ($type === 'App\Models\StandalonePostgresql') {
if (str($resource->status)->startsWith('running')) {
$message->push("Database {$resource->name} already running.");
}
StartPostgresql::run($resource);
$resource->update([
'started_at' => now(),
]);
$message->push("Database {$resource->name} started.");
} else if ($type === 'App\Models\StandaloneRedis') {
if (str($resource->status)->startsWith('running')) {
$message->push("Database {$resource->name} already running.");
}
StartRedis::run($resource);
$resource->update([
'started_at' => now(),
]);
$message->push("Database {$resource->name} started.");
} else if ($type === 'App\Models\StandaloneMongodb') {
if (str($resource->status)->startsWith('running')) {
$message->push("Database {$resource->name} already running.");
}
StartMongodb::run($resource);
$resource->update([
'started_at' => now(),
]);
$message->push("Database {$resource->name} started.");
} else if ($type === 'App\Models\StandaloneMysql') {
if (str($resource->status)->startsWith('running')) {
$message->push("Database {$resource->name} already running.");
}
StartMysql::run($resource);
$resource->update([
'started_at' => now(),
]);
$message->push("Database {$resource->name} started.");
} else if ($type === 'App\Models\StandaloneMariadb') {
if (str($resource->status)->startsWith('running')) {
$message->push("Database {$resource->name} already running.");
}
StartMariadb::run($resource);
$resource->update([
'started_at' => now(),
]);
$message->push("Database {$resource->name} started.");
} else if ($type === 'App\Models\Service') {
StartService::run($resource);
$message->push("Service {$resource->name} started. It could take a while, be patient.");
}
StartPostgresql::run($resource);
$resource->update([
'started_at' => now(),
]);
return response()->json(['message' => 'Database started.'], 200);
} else if ($type === 'App\Models\StandaloneRedis') {
if (str($resource->status)->startsWith('running')) {
return response()->json(['message' => 'Database already running.'], 200);
}
StartRedis::run($resource);
$resource->update([
'started_at' => now(),
]);
return response()->json(['message' => 'Database started.'], 200);
} else if ($type === 'App\Models\StandaloneMongodb') {
if (str($resource->status)->startsWith('running')) {
return response()->json(['message' => 'Database already running.'], 200);
}
StartMongodb::run($resource);
$resource->update([
'started_at' => now(),
]);
return response()->json(['message' => 'Database started.'], 200);
} else if ($type === 'App\Models\StandaloneMysql') {
if (str($resource->status)->startsWith('running')) {
return response()->json(['message' => 'Database already running.'], 200);
}
StartMysql::run($resource);
$resource->update([
'started_at' => now(),
]);
return response()->json(['message' => 'Database started.'], 200);
} else if ($type === 'App\Models\StandaloneMariadb') {
if (str($resource->status)->startsWith('running')) {
return response()->json(['message' => 'Database already running.'], 200);
}
StartMariadb::run($resource);
$resource->update([
'started_at' => now(),
]);
return response()->json(['message' => 'Database started.'], 200);
} else if ($type === 'App\Models\Service') {
StartService::run($resource);
return response()->json(['message' => 'Service started. It could take a while, be patient.'], 200);
}
}
return response()->json(['error' => "No resource found with {$uuid}."], 404);
if ($message->count() > 0) {
return response()->json(['message' => $message->toArray()], 200);
}
return response()->json(['error' => "No resources found.", 'docs' => 'https://coolify.io/docs/api/deploy-webhook'], 404);
});
});

Some files were not shown because too many files have changed in this diff Show More