Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
File renamed without changes.
32 changes: 10 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
/server/vendor/
node_modules/
npm-debug.log
yarn-error.log
/server/config/services.php
/server/keys/*
# Laravel 4 specific
/server/bootstrap/compiled.php
/server/app/storage/
/server/.env
# Laravel 5 & Lumen specific
public/storage
public/hot

# Laravel 5 & Lumen specific with changed public path
public_html/storage
public_html/hot

/server/storage/*.key
/node_modules
/public/storage
/storage/*.key
/vendor
.env
Homestead.yaml
Homestead.json
/.vagrant
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
File renamed without changes.
89 changes: 89 additions & 0 deletions app/Console/Commands/CloudFlareRun.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use App\Rest\Cloudflare\Cloudflare;
use Illuminate\Support\Str;
class CloudFlareRun extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cloudflare:dns {action} {--name=} {--ip=} {--test=}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Manage entries to cloudflare dns';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}



public function handle()
{
$cf=new Cloudflare();

$action=$this->argument('action');

if($action=='create')
{
$cf->create($this->option('name'),$this->option('ip'));
}
else if($action=='delete')
{
$cf->delete($this->option('name'),$this->option('ip'));
}
else if($action=="list")
{
$cf->list();
}
else if($action=="truncate")
{
$cf->truncate();
}
else if($action=="test")
{
$failed=0;
for($i=0;$i<intval($this->option('test'));$i++)
{
$name = "TEST".Str::random(32);
$cf->create($name,"8.8.8.8");
$exist=$cf->checkIfNameExist($name);
$cf->delete($name,"8.8.8.8");
;
if($exist==TRUE && $cf->checkIfNameExist($name)==FALSE)
{
echo "Test run $i:done".PHP_EOL;
}
if($exist==FALSE )
{
$failed++;
echo "Test run $i:failed - ".$name." UNABLE TO CREATE".PHP_EOL;
}
if($cf->checkIfNameExist($name)==TRUE)
{
$failed++;
echo "Test run $i:failed - ".$name." UNABLE TO DELETE".PHP_EOL;
}
}

echo "Count failed - ".$failed.PHP_EOL;
}

}
}
121 changes: 121 additions & 0 deletions app/Console/Commands/CloudImages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use App\Rest\Hetzner\Instance\Create;
use App\Rest\Hetzner\Instance\Delete;
use App\Rest\Hetzner\Instance\Stop;
use App\Rest\Hetzner\Instance\Get;
use Carbon\Carbon;
class CloudImages extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cloud:instance {type} {action}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Cloud functions instance';


public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/


function hetzner()
{
$key = getenv('HETZNER_API_KEY');
$location=getenv('HETZNER_DC_LOCATION');
$type=getenv('HETZNER_SERVER_TYPE');
$info=new Create($key,getenv('HETZNER_DC_LOCATION'),getenv('HETZNER_SERVER_TYPE'),"test","new-server");
echo "Creating";
$response=$info->execute();
echo "FFFU";
var_dump($response);
while(true)
{
$info=new Get($key,"new-server");
$response=$info->execute();
echo $response['status'].PHP_EOL;
if($response['status']=='running')break;
}
echo "Stoppping".PHP_EOL;
$info=new Delete($key,"new-server");
$response=$info->execute();
while(true)
{
$info=new Get($key,"new-server");
$response=$info->execute();
if($response==false)break;

}



var_dump($response);


}

function test()
{

$key = getenv('HETZNER_API_KEY');
// $info=new GetInstance($key,"ubuntu-2gb-nbg1-1");
// $response=$info->execute();
// var_dump($response);

$info=new Create($key,getenv('HETZNER_DC_LOCATION'),getenv('HETZNER_SERVER_TYPE'),"test","new-server");
echo "Creating";
$response=$info->execute();
echo "FFFU";
var_dump($response);
while(true)
{
$info=new Get($key,"new-server");
$response=$info->execute();
echo $response['status'].PHP_EOL;
if($response['status']=='running')break;
}
echo "Stoppping".PHP_EOL;
$info=new Delete($key,"new-server");
$response=$info->execute();
while(true)
{
$info=new Get($key,"new-server");
$response=$info->execute();
if($response==false)break;

}



var_dump($response);



}

public function handle()
{
for($i=0;$i<50;$i++)
$this->test();

}
}
133 changes: 133 additions & 0 deletions app/Console/Commands/CloudInstance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use App\Rest\Hetzner\Instance\Create;
use App\Rest\Hetzner\Instance\Delete;
use App\Rest\Hetzner\Instance\Stop;
use App\Rest\Hetzner\Instance\Get;
use Carbon\Carbon;
class CloudInstance extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cloud:instance
{cloud}
{action}
{--server-type=? : Whether the job should be queued}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Cloud functions instance';


public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/


function hetzner()
{
$key = getenv('HETZNER_API_KEY');
$location=getenv('HETZNER_DC_LOCATION');
$server_type=getenv('HETZNER_SERVER_TYPE');
if($this->argument('--server-type')!==null)
$type=getenv('HETZNER_SERVER_TYPE');



$info=new Create($key,$location,$server_type,"test","new-server");
echo "Creating";
$response=$info->execute();
echo "FFFU";
var_dump($response);
while(true)
{
$info=new Get($key,"new-server");
$response=$info->execute();
echo $response['status'].PHP_EOL;
if($response['status']=='running')break;
}
echo "Stoppping".PHP_EOL;
$info=new Delete($key,"new-server");
$response=$info->execute();
while(true)
{
$info=new Get($key,"new-server");
$response=$info->execute();
if($response==false)break;

}



var_dump($response);


}

function test()
{

$key = getenv('HETZNER_API_KEY');
// $info=new GetInstance($key,"ubuntu-2gb-nbg1-1");
// $response=$info->execute();
// var_dump($response);

$info=new Create($key,getenv('HETZNER_DC_LOCATION'),getenv('HETZNER_SERVER_TYPE'),"test","new-server");
echo "Creating";
$response=$info->execute();
echo "FFFU";
var_dump($response);
while(true)
{
$info=new Get($key,"new-server");
$response=$info->execute();
echo $response['status'].PHP_EOL;
if($response['status']=='running')break;
}
echo "Stoppping".PHP_EOL;
$info=new Delete($key,"new-server");
$response=$info->execute();
while(true)
{
$info=new Get($key,"new-server");
$response=$info->execute();
if($response==false)break;

}



var_dump($response);



}

public function handle()
{
/*
for($i=0;$i<50;$i++)
$this->test();
*/



}
}
Loading