Skip to content

Commit

Permalink
wip: nixpacksarchive
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Sep 11, 2023
1 parent f0adf10 commit b778650
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/Http/Livewire/Project/Application/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class General extends Component
'application.ports_exposes' => 'required',
'application.ports_mappings' => 'nullable',
'application.dockerfile' => 'nullable',
'application.nixpkgsarchive' => 'nullable',
];
protected $validationAttributes = [
'application.name' => 'name',
Expand All @@ -66,6 +67,7 @@ class General extends Component
'application.ports_exposes' => 'Ports exposes',
'application.ports_mappings' => 'Ports mappings',
'application.dockerfile' => 'Dockerfile',
'application.nixpkgsarchive' => 'Nixpkgs archive',
];

public function instantSave()
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/IsBoardingFlow.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class IsBoardingFlow
*/
public function handle(Request $request, Closure $next): Response
{
ray()->showQueries()->color('orange');
// ray()->showQueries()->color('orange');
if (showBoarding() && !in_array($request->path(), allowedPathsForBoardingAccounts())) {
return redirect('boarding');
}
Expand Down
10 changes: 10 additions & 0 deletions app/Jobs/ApplicationDeploymentJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
use Symfony\Component\Yaml\Yaml;
use Throwable;
use Visus\Cuid2\Cuid2;
use Yosymfony\Toml\Toml;
use Yosymfony\Toml\TomlArray;

class ApplicationDeploymentJob implements ShouldQueue
{
Expand Down Expand Up @@ -411,6 +413,7 @@ private function cleanup_git()

private function generate_nixpacks_confs()
{
ray('nixpkgsarchive', $this->application->nixpkgsarchive);
$this->execute_remote_command(
[
"echo -n 'Generating nixpacks configuration.'",
Expand All @@ -419,6 +422,13 @@ private function generate_nixpacks_confs()
[$this->execute_in_builder("cp {$this->workdir}/.nixpacks/Dockerfile {$this->workdir}/Dockerfile")],
[$this->execute_in_builder("rm -f {$this->workdir}/.nixpacks/Dockerfile")]
);

// if ($this->application->nixpkgsarchive) {
// $this->execute_remote_command([
// $this->execute_in_builder("cat {$this->workdir}/nixpacks.toml"), "hidden" => true, "save" => 'nixpacks_toml'
// ]);

// }
}

private function nixpacks_build_cmd()
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"spatie/url": "^2.2",
"stripe/stripe-php": "^12.0",
"symfony/yaml": "^6.2",
"visus/cuid2": "^2.0.0"
"visus/cuid2": "^2.0.0",
"yosymfony/toml": "^1.0"
},
"require-dev": {
"fakerphp/faker": "^v1.21.0",
Expand Down
112 changes: 111 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->string('nixpkgsarchive')->nullable();
});
}

public function down(): void
{
Schema::table('teams', function (Blueprint $table) {
$table->dropColumn('nixpkgsarchive');
});
}
};
2 changes: 1 addition & 1 deletion docker/coolify-helper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARG DOCKER_BUILDX_VERSION=0.11.2
# https://github.com/buildpacks/pack/releases
ARG PACK_VERSION=0.30.0
# https://github.com/railwayapp/nixpacks/releases
ARG NIXPACKS_VERSION=1.13.0
ARG NIXPACKS_VERSION=1.14.0

USER root
WORKDIR /artifacts
Expand Down
2 changes: 1 addition & 1 deletion docker/testing-host/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARG DOCKER_BUILDX_VERSION=0.11.2
# https://github.com/buildpacks/pack/releases
ARG PACK_VERSION=0.30.0
# https://github.com/railwayapp/nixpacks/releases
ARG NIXPACKS_VERSION=1.13.0
ARG NIXPACKS_VERSION=1.14.0

USER root
WORKDIR /root
Expand Down
16 changes: 11 additions & 5 deletions resources/views/livewire/project/application/general.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@
@endif
@endif
</div>
<x-forms.select id="application.build_pack" label="Build Pack" required>
<option value="nixpacks">Nixpacks</option>
<option value="dockerfile">Dockerfile</option>
<option disabled value="compose">Compose</option>
</x-forms.select>
<div class="flex items-end gap-2">
<x-forms.select id="application.build_pack" label="Build Pack" required>
<option value="nixpacks">Nixpacks</option>
<option value="dockerfile">Dockerfile</option>
<option disabled value="compose">Compose</option>
</x-forms.select>
{{-- @if ($application->build_pack === 'nixpacks')
<x-forms.input id="application.nixpkgsarchive" label="NixPackages Archive (nixpkgsArchive)"
helper="You can customize the NixPackages archive to use."> </x-forms.input>
@endif --}}
</div>
@if ($application->settings->is_static)
<x-forms.select id="application.static_image" label="Static Image" required>
<option value="nginx:alpine">nginx:alpine</option>
Expand Down

0 comments on commit b778650

Please sign in to comment.