show public key of generated private key

This commit is contained in:
Andras Bacsai 2023-08-27 15:23:47 +02:00
parent 9f10cb2899
commit c21ce45d70
24 changed files with 40 additions and 33 deletions

View File

@ -14,14 +14,14 @@ public function __invoke()
$settings->update([
'is_resale_license_active' => false,
]);
if (is_dev()) {
if (isDev()) {
return;
}
if (!$settings->resale_license) {
return;
}
$base_url = config('coolify.license_url');
if (is_dev()) {
if (isDev()) {
$base_url = 'http://host.docker.internal:8787';
}
$instance_id = config('app.id');

View File

@ -12,7 +12,7 @@ public function __invoke(Server $server, Team $team)
{
$dockerVersion = '23.0';
$config = base64_encode('{ "live-restore": true }');
if (is_dev()) {
if (isDev()) {
$activity = remote_process([
"echo ####### Installing Prerequisites...",
"echo ####### Installing/updating Docker Engine...",

View File

@ -50,7 +50,7 @@ public function __invoke(bool $force)
private function update()
{
if (is_dev()) {
if (isDev()) {
ray("Running update on local docker container. Updating to $this->latest_version");
remote_process([
"sleep 10"

View File

@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule): void
{
// $schedule->call(fn() => $this->check_scheduled_backups($schedule))->everyTenSeconds();
if (is_dev()) {
if (isDev()) {
$schedule->command('horizon:snapshot')->everyMinute();
$schedule->job(new ResourceStatusJob)->everyMinute();
$schedule->job(new ProxyCheckJob)->everyFiveMinutes();

View File

@ -45,7 +45,7 @@ public function register(): void
{
$this->reportable(function (Throwable $e) {
$this->settings = InstanceSettings::get();
if ($this->settings->do_not_track || is_dev()) {
if ($this->settings->do_not_track || isDev()) {
return;
}
Integration::captureUnhandledException($e);

View File

@ -66,7 +66,7 @@ public function dashboard()
]);
}
public function boarding() {
if (currentTeam()->boarding || is_dev()) {
if (currentTeam()->boarding || isDev()) {
return view('boarding');
} else {
return redirect()->route('dashboard');

View File

@ -14,6 +14,7 @@ class Boarding extends Component
public ?string $privateKeyType = null;
public ?string $privateKey = null;
public ?string $publicKey = null;
public ?string $privateKeyName = null;
public ?string $privateKeyDescription = null;
public ?PrivateKey $createdPrivateKey = null;
@ -31,7 +32,7 @@ public function mount()
{
$this->privateKeyName = generate_random_name();
$this->remoteServerName = generate_random_name();
if (is_dev()) {
if (isDev()) {
$this->privateKey = '-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevAAAAJi/QySHv0Mk
@ -77,6 +78,9 @@ public function setServer(string $type)
public function setPrivateKey(string $type)
{
$this->privateKeyType = $type;
if ($type === 'create' && !isDev()) {
$this->createNewPrivateKey();
}
$this->currentState = 'create-private-key';
}
public function savePrivateKey()
@ -95,9 +99,6 @@ public function saveServer()
'remoteServerPort' => 'required',
'remoteServerUser' => 'required',
]);
if ($this->privateKeyType === 'create') {
$this->createNewPrivateKey();
}
$this->privateKey = formatPrivateKey($this->privateKey);
$this->createdPrivateKey = PrivateKey::create([
'name' => $this->privateKeyName,
@ -175,6 +176,6 @@ private function createNewPrivateKey()
{
$this->privateKeyName = generate_random_name();
$this->privateKeyDescription = 'Created by Coolify';
['private' => $this->privateKey] = generateSSHKey();
['private' => $this->privateKey, 'public'=> $this->publicKey] = generateSSHKey();
}
}

View File

@ -50,7 +50,7 @@ class GithubPrivateRepositoryDeployKey extends Component
public function mount()
{
if (is_dev()) {
if (isDev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
}
$this->parameters = get_route_parameters();

View File

@ -45,7 +45,7 @@ class PublicGitRepository extends Component
public function mount()
{
if (is_dev()) {
if (isDev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
$this->port = 3000;
}

View File

@ -19,7 +19,7 @@ public function mount()
{
$this->parameters = get_route_parameters();
$this->query = request()->query();
if (is_dev()) {
if (isDev()) {
$this->dockerfile = 'FROM nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -15,7 +15,7 @@ class InviteLink extends Component
public function mount()
{
$this->email = is_dev() ? 'test3@example.com' : '';
$this->email = isDev() ? 'test3@example.com' : '';
}
public function viaEmail()

View File

@ -36,7 +36,7 @@ class Create extends Component
public function mount()
{
if (is_dev()) {
if (isDev()) {
$this->name = 'Local MinIO';
$this->description = 'Local MinIO';
$this->key = 'minioadmin';

View File

@ -18,7 +18,7 @@ public function checkUpdate()
$this->latestVersion = get_latest_version_of_coolify();
$currentVersion = config('version');
version_compare($currentVersion, $this->latestVersion, '<') ? $this->isUpgradeAvailable = true : $this->isUpgradeAvailable = false;
if (is_dev()) {
if (isDev()) {
$this->isUpgradeAvailable = true;
}
$settings = InstanceSettings::get();

View File

@ -17,7 +17,7 @@ class Waitlist extends Component
];
public function mount()
{
if (is_dev()) {
if (isDev()) {
$this->email = 'waitlist@example.com';
}
}

View File

@ -32,7 +32,7 @@ public function handle(): void
try {
$servers = Server::all();
foreach ($servers as $server) {
if (is_dev()) {
if (isDev()) {
$docker_root_filesystem = "/";
} else {
$docker_root_filesystem = instant_remote_process(['stat --printf=%m $(docker info --format "{{json .DockerRootDir}}" |sed \'s/"//g\')'], $server);

View File

@ -82,7 +82,7 @@ function generate_default_proxy_configuration(Server $server)
],
],
];
if (is_dev()) {
if (isDev()) {
$config['services']['traefik']['command'][] = "--log.level=debug";
}
return Yaml::dump($config, 4, 2);

View File

@ -163,7 +163,7 @@ function set_transanctional_email_settings(InstanceSettings | null $settings = n
function base_ip(): string
{
if (is_dev()) {
if (isDev()) {
return "localhost";
}
$settings = InstanceSettings::get();
@ -188,12 +188,12 @@ function base_url(bool $withPort = true): string
$port = config('app.port');
if ($settings->public_ipv4) {
if ($withPort) {
if (is_dev()) {
if (isDev()) {
return "http://localhost:$port";
}
return "http://$settings->public_ipv4:$port";
}
if (is_dev()) {
if (isDev()) {
return "http://localhost";
}
return "http://$settings->public_ipv4";
@ -207,7 +207,7 @@ function base_url(bool $withPort = true): string
return url('/');
}
function is_dev(): bool
function isDev(): bool
{
return config('app.env') === 'local';
}

View File

@ -55,7 +55,7 @@ class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hove
@endif
@if (data_get($application, 'ports_mappings_array'))
@foreach ($application->ports_mappings_array as $port)
@if (is_dev())
@if (isDev())
<li>
<a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white"
target="_blank" href="http://localhost:{{ explode(':', $port)[0] }}">

View File

@ -28,7 +28,7 @@
<x-slot:other>
<script src="https://cdn.paddle.com/paddle/v2/paddle.js"></script>
<script type="text/javascript">
Paddle.Environment.set("{{ is_dev() ? 'sandbox' : 'production' }}");
Paddle.Environment.set("{{ isDev() ? 'sandbox' : 'production' }}");
Paddle.Setup({
seller: {{ config('subscription.paddle_vendor_id') }},
checkout: {

View File

@ -22,7 +22,7 @@
<div class="stat-value">{{ $s3s->count() }}</div>
</div>
</div>
@if (is_dev())
@if (isDev())
{{-- <livewire:dev.s3-test /> --}}
@endif
</x-layout>

View File

@ -47,7 +47,8 @@
<x-slot:explanation>
<p>SSH Keys are used to connect to a remote server through a secure shell, called SSH.</p>
<p>You can use your own ssh private key, or you can let Coolify to create one for you.</p>
<p>In both ways, you need to add the public version of your ssh private key to the remote server's
<p>In both ways, you need to add the public version of your ssh private key to the remote
server's
<code class="text-warning">~/.ssh/authorized_keys</code> file.
</p>
</x-slot:explanation>
@ -66,6 +67,10 @@
label="Description" id="privateKeyDescription" />
<x-forms.textarea required placeholder="-----BEGIN OPENSSH PRIVATE KEY-----"
label="Private Key" id="privateKey" />
@if ($privateKeyType === 'create' && !isDev())
<span class="font-bold text-warning">Copy this to your server's ~/.ssh/authorized_keys file.</span>
<x-forms.textarea rows="7" readonly label="Public Key" id="publicKey" />
@endif
<x-forms.button type="submit">Save</x-forms.button>
</form>
</x-slot:actions>
@ -115,7 +120,8 @@
Could not find Docker Engine on your server. Do you want me to install it for you?
</x-slot:question>
<x-slot:actions>
<div class="justify-center box" wire:click="installDocker" onclick="installDocker.showModal()">Let's do
<div class="justify-center box" wire:click="installDocker" onclick="installDocker.showModal()">
Let's do
it!</div>
</x-slot:actions>
<x-slot:explanation>

View File

@ -22,7 +22,7 @@
@if (data_get($model, 'discord_enabled'))
<h3 class="mt-4">Subscribe to events</h3>
<div class="w-64">
@if (is_dev())
@if (isDev())
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications_test" label="Test" />
@endif
<h4 class="mt-4">General</h4>

View File

@ -59,7 +59,7 @@ class="text-white normal-case btn btn-xs no-animation btn-primary">
@if (data_get($model, 'smtp_enabled'))
<h4 class="mt-4">Subscribe to events</h4>
<div class="w-64">
@if (is_dev())
@if (isDev())
<x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications_test" label="Test" />
@endif
<h4 class="mt-4">General</h4>

View File

@ -93,7 +93,7 @@
<div class="pb-4">This will remove this server from Coolify. Beware! There is no coming
back!
</div>
@if ($server->id !== 0 || is_dev())
@if ($server->id !== 0 || isDev())
<x-forms.button isError isModal modalId="deleteServer">
Delete
</x-forms.button>