okay, now it is way better

This commit is contained in:
Andras Bacsai
2023-09-27 12:45:53 +02:00
parent c9a278b750
commit f0abdcc2da
20 changed files with 1005 additions and 525 deletions

View File

@@ -22,18 +22,82 @@ class DockerCompose extends Component
$this->query = request()->query();
if (isDev()) {
$this->dockerComposeRaw = 'services:
plausible_events_db:
image: clickhouse/clickhouse-server:23.3.7.5-alpine
restart: always
volumes:
- event-data:/var/lib/clickhouse
- ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
- ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
ulimits:
nofile:
soft: 262144
hard: 262144
';
ghost:
image: ghost:5
volumes:
- ~/configs:/etc/configs/:ro
- ./var/lib/ghost/content:/tmp/ghost2/content:ro
- /var/lib/ghost/content:/tmp/ghost/content:rw
- ghost-content-data:/var/lib/ghost/content
- type: volume
source: mydata
target: /data
volume:
nocopy: true
- type: bind
source: ./var/lib/ghost/data
target: /data
- type: bind
source: /tmp
target: /tmp
labels:
- "test.label=true"
ports:
- "3000"
- "3000-3005"
- "8000:8000"
- "9090-9091:8080-8081"
- "49100:22"
- "127.0.0.1:8001:8001"
- "127.0.0.1:5000-5010:5000-5010"
- "127.0.0.1::5000"
- "6060:6060/udp"
- "12400-12500:1240"
- target: 80
published: 8080
protocol: tcp
mode: host
networks:
- some-network
- other-network
environment:
- database__client=${DATABASE_CLIENT:-mysql}
- database__connection__database=${MYSQL_DATABASE:-ghost}
- database__connection__host=${DATABASE_CONNECTION_HOST:-mysql}
- test=${TEST:?true}
- url=$SERVICE_FQDN_GHOST
- database__connection__user=$SERVICE_USER_MYSQL
- database__connection__password=$SERVICE_PASSWORD_MYSQL
depends_on:
- mysql
mysql:
image: mysql:8.0
volumes:
- ghost-mysql-data:/var/lib/mysql
environment:
- MYSQL_USER=${SERVICE_USER_MYSQL}
- MYSQL_PASSWORD=${SERVICE_PASSWORD_MYSQL}
- MYSQL_DATABASE=$MYSQL_DATABASE
- MYSQL_ROOT_PASSWORD=${SERVICE_PASSWORD_MYSQLROOT}
- SESSION_SECRET
minio:
image: minio/minio
environment:
RACK_ENV: development
A: $A
SHOW: ${SHOW}
SHOW1: ${SHOW2-show1}
SHOW2: ${SHOW3:-show2}
SHOW3: ${SHOW4?show3}
SHOW4: ${SHOW5:?show4}
SHOW5: ${SERVICE_USER_MINIO}
SHOW6: ${SERVICE_PASSWORD_MINIO}
SHOW7: ${SERVICE_PASSWORD_64_MINIO}
SHOW8: ${SERVICE_BASE64_64_MINIO}
SHOW9: ${SERVICE_BASE64_128_MINIO}
SHOW10: ${SERVICE_BASE64_MINIO}
SHOW11:
';
}
}
public function submit()

View File

@@ -3,15 +3,12 @@
namespace App\Http\Livewire\Project\Service;
use App\Models\ServiceApplication;
use Illuminate\Support\Collection;
use Livewire\Component;
class Application extends Component
{
public ServiceApplication $application;
public $parameters;
public $fileStorages;
protected $listeners = ["refreshFileStorages"];
protected $rules = [
'application.human_name' => 'nullable',
'application.description' => 'nullable',
@@ -28,10 +25,7 @@ class Application extends Component
{
$this->submit();
}
public function refreshFileStorages()
{
$this->fileStorages = $this->application->fileStorages()->get();
}
public function delete()
{
try {
@@ -45,18 +39,16 @@ class Application extends Component
public function mount()
{
$this->parameters = get_route_parameters();
$this->fileStorages = collect();
$this->refreshFileStorages();
}
public function submit()
{
try {
$this->validate();
$this->application->save();
switchImage($this->application);
updateCompose($this->application);
$this->emit('success', 'Application saved successfully.');
} catch (\Throwable $e) {
ray($e);
return handleError($e, $this);
} finally {
$this->emit('generateDockerCompose');
}

View File

@@ -35,7 +35,7 @@ class Database extends Component
try {
$this->validate();
$this->database->save();
switchImage($this->database);
updateCompose($this->database);
$this->emit('success', 'Database saved successfully.');
} catch (\Throwable $e) {
ray($e);

View File

@@ -20,13 +20,17 @@ class FileStorage extends Component
'fileStorage.mount_path' => 'required',
'fileStorage.content' => 'nullable',
];
public function mount() {
public function mount()
{
$this->service = $this->fileStorage->service;
$this->fs_path = Str::of($this->fileStorage->fs_path)->beforeLast('/');
$file = Str::of($this->fileStorage->fs_path)->afterLast('/');
if (Str::of($this->fs_path)->startsWith('.')) {
$this->fs_path = Str::of($this->fs_path)->after('.');
$this->fs_path = $this->service->service->workdir() . $this->fs_path . "/" .$file;
$this->fs_path = $this->service->service->workdir() . $this->fs_path . "/" . $file;
}
if ($this->fileStorage->is_directory) {
$this->fs_path = Str::of($this->fileStorage->fs_path);
}
}
public function submit()
@@ -40,7 +44,8 @@ class FileStorage extends Component
return handleError($e, $this);
}
}
public function instantSave() {
public function instantSave()
{
$this->submit();
}
public function render()

View File

@@ -34,19 +34,11 @@ class Index extends Component
{
$this->applications = $this->service->applications->sort();
$this->applications->each(function ($application) {
$application->fileStorages()->get()->each(function ($fileStorage) use ($application) {
if (!$fileStorage->is_directory && $fileStorage->content == null) {
$application->hasMissingFiles = true;
}
});
$application->configuration_required = $application->configurationRequired();
});
$this->databases = $this->service->databases->sort();
$this->databases->each(function ($database) {
$database->fileStorages()->get()->each(function ($fileStorage) use ($database) {
if (!$fileStorage->is_directory && $fileStorage->content == null) {
$database->hasMissingFiles = true;
}
});
$database->configuration_required = $database->configurationRequired();
});
$this->emit('success', 'Stack refreshed successfully.');
}
@@ -61,24 +53,29 @@ class Index extends Component
{
return view('livewire.project.service.index');
}
public function save()
{
try {
$this->service->save();
$this->service->parse();
$this->service->refresh();
$this->emit('refreshEnvs');
$this->emit('success', 'Service saved successfully.');
$this->service->saveComposeConfigs();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
// public function save()
// {
// try {
// $this->service->save();
// $this->service->parse();
// $this->service->refresh();
// $this->emit('refreshEnvs');
// $this->emit('success', 'Service saved successfully.');
// $this->service->saveComposeConfigs();
// } catch (\Throwable $e) {
// return handleError($e, $this);
// }
// }
public function submit()
{
try {
$this->validate();
$this->service->save();
$this->service->parse();
$this->service->refresh();
$this->service->saveComposeConfigs();
$this->refreshStack();
$this->emit('refreshEnvs');
$this->emit('success', 'Service saved successfully.');
} catch (\Throwable $e) {
return handleError($e, $this);