Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Apr 14, 2023
1 parent 09ab641 commit c8434ac
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/public/storage
/storage/*.key
/vendor
.env.example
.env
.env.backup
.env.production
Expand All @@ -19,5 +20,5 @@ yarn-error.log
/.vscode
/.npm
/.bash_history
/_volumes/*
/_volumes

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ yarn-error.log
/.vscode
/.npm
/.bash_history
/_volumes/*
/_volumes
29 changes: 29 additions & 0 deletions app/Http/Livewire/CheckUpdate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Http\Livewire;

use App\Models\Server;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Process;
use Livewire\Component;

class CheckUpdate extends Component
{
public $updateAvailable = false;
public $latestVersion = '4.0.0-nightly.1';
protected $currentVersion;
protected $image = 'ghcr.io/coollabsio/coolify';

public function checkUpdate()
{
$response = Http::get('https://get.coollabs.io/versions.json');
$versions = $response->json();
// $this->latestVersion = data_get($versions, 'coolify.main.version');
$this->currentVersion = config('coolify.version');
version_compare($this->currentVersion, $this->latestVersion, '<') ? $this->updateAvailable = true : $this->updateAvailable = false;
}
public function render()
{
return view('livewire.check-update');
}
}
8 changes: 8 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Providers;

use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\ServiceProvider;

Expand All @@ -13,6 +14,13 @@ class AppServiceProvider extends ServiceProvider
*/
public function register(): void
{
// @TODO: Is this the best place to run the seeder?
// if (env('APP_ENV') === 'production') {
// dump('Seed default data.');
// Process::run('php artisan db:seed --class=ProductionSeeder --force');
// } else {
// dump('Not in production environment.');
// }
//
}

Expand Down
2 changes: 2 additions & 0 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
|
*/

use Illuminate\Support\Facades\Artisan;

$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
Expand Down
27 changes: 27 additions & 0 deletions database/seeders/ProductionSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Database\Seeders;

use App\Models\PrivateKey;
use App\Models\Project;
use App\Models\Team;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Storage;

class ProductionSeeder extends Seeder
{
public function run(): void
{
$coolify_key = Storage::disk('local')->get('ssh-keys/coolify.dsa');
if (PrivateKey::where('name', 'Coolify Host')->doesntExist()) {
PrivateKey::create([
"id" => 0,
"name" => "Coolify Host",
"description" => "This is the private key for the server where Coolify is hosted.",
"private_key" => $coolify_key,
]);
} else {
dump('Coolify SSH Key already exists.');
}
}
}
20 changes: 10 additions & 10 deletions database/seeders/ServerSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ public function run(): void
{
$root_team = Team::find(1);
$private_key_1 = PrivateKey::find(1);

Server::create([
'id' => 1,
'name' => "testing-local-docker-container",
'description' => "This is a test docker container",
'ip' => "coolify-testing-host",
'name' => "localhost",
'description' => "This is the local machine",
'user' => 'root',
'ip' => "host.docker.internal",
'team_id' => $root_team->id,
'private_key_id' => $private_key_1->id,
]);
Server::create([
'id' => 2,
'name' => "testing-local-docker-container-2",
'name' => "testing-local-docker-container",
'description' => "This is a test docker container",
'ip' => "coolify-testing-host-2",
'ip' => "coolify-testing-host",
'team_id' => $root_team->id,
'private_key_id' => $private_key_1->id,
]);
Server::create([
'id' => 3,
'name' => "localhost",
'description' => "This is the local machine",
'user' => 'root',
'ip' => "coolify-testing-host",
'name' => "testing-local-docker-container-2",
'description' => "This is a test docker container",
'ip' => "coolify-testing-host-2",
'team_id' => $root_team->id,
'private_key_id' => $private_key_1->id,
]);

}
}
8 changes: 4 additions & 4 deletions database/seeders/ServerSettingSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class ServerSettingSeeder extends Seeder
*/
public function run(): void
{
$server_1 = Server::find(1)->load(['settings']);
$server_1->settings->is_build_server = true;
$server_1->settings->save();

$server_2 = Server::find(2)->load(['settings']);
$server_2->settings->is_build_server = true;
$server_2->settings->save();

$server_3 = Server::find(3)->load(['settings']);
$server_3->settings->is_build_server = true;
$server_3->settings->save();

}
}
4 changes: 2 additions & 2 deletions database/seeders/StandaloneDockerSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class StandaloneDockerSeeder extends Seeder
*/
public function run(): void
{
$server_3 = Server::find(3);
$server_1 = Server::find(1);
StandaloneDocker::create([
'id' => 1,
'network' => 'coolify',
'server_id' => $server_3->id,
'server_id' => $server_1->id,
]);
}
}
4 changes: 2 additions & 2 deletions database/seeders/SwarmDockerSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class SwarmDockerSeeder extends Seeder
*/
public function run(): void
{
$server_1 = Server::find(1);
$server_2 = Server::find(2);
SwarmDocker::create([
'id' => 1,
'server_id' => $server_1->id,
'server_id' => $server_2->id,
]);
}
}
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ version: '3.8'
services:
coolify:
working_dir: /var/www/html
extra_hosts:
- 'host.docker.internal:host-gateway'
networks:
- coolify
depends_on:
Expand Down
1 change: 1 addition & 0 deletions resources/views/components/navbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
@csrf
<button type="submit">Logout</button>
</form>
<livewire:check-update>
@endauth
</nav>
4 changes: 4 additions & 0 deletions resources/views/livewire/check-update.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<button wire:click='checkUpdate'>Updates</button>
{{ $updateAvailable ? 'Update available' : 'No updates' }}
</div>
3 changes: 3 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
Route::get('/profile', function () {
return view('profile');
});
Route::get('/update', function () {
return view('update');
});
Route::get('/demo', function () {
return view('demo');
});
Expand Down

0 comments on commit c8434ac

Please sign in to comment.