fix: if compose file has more that 6 components, force stop
fix: parser
This commit is contained in:
@@ -19,14 +19,19 @@ class StopService
|
|||||||
ray('Stopping service: '.$service->name);
|
ray('Stopping service: '.$service->name);
|
||||||
$applications = $service->applications()->get();
|
$applications = $service->applications()->get();
|
||||||
foreach ($applications as $application) {
|
foreach ($applications as $application) {
|
||||||
instant_remote_process(command: ["docker stop --time=30 {$application->name}-{$service->uuid}"], server: $server, throwError: false);
|
if ($applications->count() < 6) {
|
||||||
|
instant_remote_process(command: ["docker stop --time=10 {$application->name}-{$service->uuid}"], server: $server, throwError: false);
|
||||||
|
}
|
||||||
instant_remote_process(command: ["docker rm {$application->name}-{$service->uuid}"], server: $server, throwError: false);
|
instant_remote_process(command: ["docker rm {$application->name}-{$service->uuid}"], server: $server, throwError: false);
|
||||||
instant_remote_process(command: ["docker rm -f {$application->name}-{$service->uuid}"], server: $server, throwError: false);
|
instant_remote_process(command: ["docker rm -f {$application->name}-{$service->uuid}"], server: $server, throwError: false);
|
||||||
$application->update(['status' => 'exited']);
|
$application->update(['status' => 'exited']);
|
||||||
}
|
}
|
||||||
$dbs = $service->databases()->get();
|
$dbs = $service->databases()->get();
|
||||||
foreach ($dbs as $db) {
|
foreach ($dbs as $db) {
|
||||||
instant_remote_process(command: ["docker stop --time=30 {$db->name}-{$service->uuid}"], server: $server, throwError: false);
|
if ($dbs->count() < 6) {
|
||||||
|
|
||||||
|
instant_remote_process(command: ["docker stop --time=10 {$db->name}-{$service->uuid}"], server: $server, throwError: false);
|
||||||
|
}
|
||||||
instant_remote_process(command: ["docker rm {$db->name}-{$service->uuid}"], server: $server, throwError: false);
|
instant_remote_process(command: ["docker rm {$db->name}-{$service->uuid}"], server: $server, throwError: false);
|
||||||
instant_remote_process(command: ["docker rm -f {$db->name}-{$service->uuid}"], server: $server, throwError: false);
|
instant_remote_process(command: ["docker rm -f {$db->name}-{$service->uuid}"], server: $server, throwError: false);
|
||||||
$db->update(['status' => 'exited']);
|
$db->update(['status' => 'exited']);
|
||||||
|
@@ -91,18 +91,16 @@ class Create extends Component
|
|||||||
$oneClickDotEnvs->each(function ($value) use ($service) {
|
$oneClickDotEnvs->each(function ($value) use ($service) {
|
||||||
$key = str()->before($value, '=');
|
$key = str()->before($value, '=');
|
||||||
$value = str(str()->after($value, '='));
|
$value = str(str()->after($value, '='));
|
||||||
$generatedValue = $value;
|
if ($value) {
|
||||||
if ($value->contains('SERVICE_')) {
|
EnvironmentVariable::create([
|
||||||
$command = $value->after('SERVICE_')->beforeLast('_');
|
'key' => $key,
|
||||||
$generatedValue = generateEnvValue($command->value(), $service);
|
'value' => $value,
|
||||||
|
'service_id' => $service->id,
|
||||||
|
'is_build_time' => false,
|
||||||
|
'is_preview' => false,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
EnvironmentVariable::create([
|
|
||||||
'key' => $key,
|
|
||||||
'value' => $generatedValue,
|
|
||||||
'service_id' => $service->id,
|
|
||||||
'is_build_time' => false,
|
|
||||||
'is_preview' => false,
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$service->parse(isNew: true);
|
$service->parse(isNew: true);
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -146,7 +146,6 @@ function generate_default_proxy_configuration(Server $server)
|
|||||||
'coolify.managed=true',
|
'coolify.managed=true',
|
||||||
];
|
];
|
||||||
$config = [
|
$config = [
|
||||||
'version' => '3.8',
|
|
||||||
'networks' => $array_of_networks->toArray(),
|
'networks' => $array_of_networks->toArray(),
|
||||||
'services' => [
|
'services' => [
|
||||||
'traefik' => [
|
'traefik' => [
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ services:
|
|||||||
activepieces:
|
activepieces:
|
||||||
image: "ghcr.io/activepieces/activepieces:latest"
|
image: "ghcr.io/activepieces/activepieces:latest"
|
||||||
environment:
|
environment:
|
||||||
|
- SERVICE_FQDN_ACTIVEPIECES
|
||||||
- AP_API_KEY=$SERVICE_PASSWORD_64_APIKEY
|
- AP_API_KEY=$SERVICE_PASSWORD_64_APIKEY
|
||||||
- AP_ENCRYPTION_KEY=$SERVICE_PASSWORD_ENCRYPTIONKEY
|
- AP_ENCRYPTION_KEY=$SERVICE_PASSWORD_ENCRYPTIONKEY
|
||||||
- AP_ENGINE_EXECUTABLE_PATH=dist/packages/engine/main.js
|
- AP_ENGINE_EXECUTABLE_PATH=dist/packages/engine/main.js
|
||||||
|
@@ -3,9 +3,6 @@ _APP_LOCALE=en
|
|||||||
_APP_OPTIONS_ABUSE=enabled
|
_APP_OPTIONS_ABUSE=enabled
|
||||||
_APP_OPTIONS_FORCE_HTTPS=disabled
|
_APP_OPTIONS_FORCE_HTTPS=disabled
|
||||||
_APP_OPENSSL_KEY_V1=
|
_APP_OPENSSL_KEY_V1=
|
||||||
_APP_DOMAIN=
|
|
||||||
_APP_DOMAIN_TARGET=
|
|
||||||
_APP_DOMAIN_FUNCTIONS=
|
|
||||||
_APP_CONSOLE_WHITELIST_ROOT=enabled
|
_APP_CONSOLE_WHITELIST_ROOT=enabled
|
||||||
_APP_CONSOLE_WHITELIST_EMAILS=
|
_APP_CONSOLE_WHITELIST_EMAILS=
|
||||||
_APP_CONSOLE_WHITELIST_IPS=
|
_APP_CONSOLE_WHITELIST_IPS=
|
||||||
@@ -28,9 +25,6 @@ _APP_REDIS_PASS=
|
|||||||
_APP_DB_HOST=appwrite-mariadb
|
_APP_DB_HOST=appwrite-mariadb
|
||||||
_APP_DB_PORT=3306
|
_APP_DB_PORT=3306
|
||||||
_APP_DB_SCHEMA=appwrite
|
_APP_DB_SCHEMA=appwrite
|
||||||
_APP_DB_USER=$SERVICE_USER_MYSQL
|
|
||||||
_APP_DB_PASS=$SERVICE_PASSWORD_MYSQL
|
|
||||||
_APP_DB_ROOT_PASS=$SERVICE_PASSWORD_ROOTMYSQL
|
|
||||||
_APP_SMTP_HOST=
|
_APP_SMTP_HOST=
|
||||||
_APP_SMTP_PORT=
|
_APP_SMTP_PORT=
|
||||||
_APP_SMTP_SECURE=
|
_APP_SMTP_SECURE=
|
||||||
@@ -72,7 +66,6 @@ _APP_FUNCTIONS_CPUS=0
|
|||||||
_APP_FUNCTIONS_MEMORY=0
|
_APP_FUNCTIONS_MEMORY=0
|
||||||
_APP_FUNCTIONS_MEMORY_SWAP=0
|
_APP_FUNCTIONS_MEMORY_SWAP=0
|
||||||
_APP_FUNCTIONS_RUNTIMES=node-20.0,php-8.2,python-3.11,ruby-3.2
|
_APP_FUNCTIONS_RUNTIMES=node-20.0,php-8.2,python-3.11,ruby-3.2
|
||||||
_APP_EXECUTOR_SECRET=$SERVICE_PASSWORD_64_APPWRITE
|
|
||||||
_APP_EXECUTOR_HOST=http://appwrite-executor/v1
|
_APP_EXECUTOR_HOST=http://appwrite-executor/v1
|
||||||
_APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes
|
_APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes
|
||||||
_APP_FUNCTIONS_INACTIVE_THRESHOLD=60
|
_APP_FUNCTIONS_INACTIVE_THRESHOLD=60
|
||||||
|
@@ -52,8 +52,9 @@ services:
|
|||||||
- _APP_DB_HOST
|
- _APP_DB_HOST
|
||||||
- _APP_DB_PORT
|
- _APP_DB_PORT
|
||||||
- _APP_DB_SCHEMA
|
- _APP_DB_SCHEMA
|
||||||
- _APP_DB_USER
|
- _APP_DB_USER=$SERVICE_USER_MARIADB
|
||||||
- _APP_DB_PASS
|
- _APP_DB_PASS=$SERVICE_PASSWORD_MARIADB
|
||||||
|
- _APP_DB_ROOT_PASS=$SERVICE_PASSWORD_MARIADBROOT
|
||||||
- _APP_SMTP_HOST
|
- _APP_SMTP_HOST
|
||||||
- _APP_SMTP_PORT
|
- _APP_SMTP_PORT
|
||||||
- _APP_SMTP_SECURE
|
- _APP_SMTP_SECURE
|
||||||
@@ -92,7 +93,7 @@ services:
|
|||||||
- _APP_FUNCTIONS_CPUS
|
- _APP_FUNCTIONS_CPUS
|
||||||
- _APP_FUNCTIONS_MEMORY
|
- _APP_FUNCTIONS_MEMORY
|
||||||
- _APP_FUNCTIONS_RUNTIMES
|
- _APP_FUNCTIONS_RUNTIMES
|
||||||
- _APP_EXECUTOR_SECRET
|
- _APP_EXECUTOR_SECRET=$SERVICE_PASSWORD_64_APPWRITE
|
||||||
- _APP_EXECUTOR_HOST
|
- _APP_EXECUTOR_HOST
|
||||||
- _APP_LOGGING_PROVIDER
|
- _APP_LOGGING_PROVIDER
|
||||||
- _APP_LOGGING_CONFIG
|
- _APP_LOGGING_CONFIG
|
||||||
@@ -500,7 +501,7 @@ services:
|
|||||||
- _APP_MAINTENANCE_RETENTION_SCHEDULES
|
- _APP_MAINTENANCE_RETENTION_SCHEDULES
|
||||||
|
|
||||||
appwrite-worker-usage:
|
appwrite-worker-usage:
|
||||||
image: appwrite/appwrite:1.5.1
|
image: appwrite/appwrite:1.5
|
||||||
entrypoint: worker-usage
|
entrypoint: worker-usage
|
||||||
container_name: appwrite-worker-usage
|
container_name: appwrite-worker-usage
|
||||||
<<: *x-logging
|
<<: *x-logging
|
||||||
@@ -527,7 +528,7 @@ services:
|
|||||||
- _APP_USAGE_AGGREGATION_INTERVAL
|
- _APP_USAGE_AGGREGATION_INTERVAL
|
||||||
|
|
||||||
appwrite-worker-usage-dump:
|
appwrite-worker-usage-dump:
|
||||||
image: appwrite/appwrite:1.5.1
|
image: appwrite/appwrite:1.5
|
||||||
entrypoint: worker-usage-dump
|
entrypoint: worker-usage-dump
|
||||||
<<: *x-logging
|
<<: *x-logging
|
||||||
container_name: appwrite-worker-usage-dump
|
container_name: appwrite-worker-usage-dump
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -11,69 +11,56 @@ use Visus\Cuid2\Cuid2;
|
|||||||
|
|
||||||
ray()->clearAll();
|
ray()->clearAll();
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
$this->applicationComposeFile = [
|
$this->applicationYaml = '
|
||||||
'version' => '3.8',
|
version: "3.8"
|
||||||
'services' => [
|
services:
|
||||||
'app' => [
|
app:
|
||||||
'image' => 'nginx',
|
image: nginx
|
||||||
'environment' => [
|
environment:
|
||||||
'SERVICE_FQDN_APP' => '/app',
|
SERVICE_FQDN_APP: /app
|
||||||
'APP_KEY' => 'base64',
|
APP_KEY: base64
|
||||||
'APP_DEBUG' => '${APP_DEBUG:-false}',
|
APP_DEBUG: "${APP_DEBUG:-false}"
|
||||||
'APP_URL' => '$SERVICE_FQDN_APP',
|
APP_URL: $SERVICE_FQDN_APP
|
||||||
],
|
volumes:
|
||||||
'volumes' => [
|
- "./nginx:/etc/nginx"
|
||||||
'./nginx:/etc/nginx',
|
- "data:/var/www/html"
|
||||||
'data:/var/www/html',
|
depends_on:
|
||||||
],
|
- db
|
||||||
'depends_on' => [
|
db:
|
||||||
'db',
|
image: postgres
|
||||||
],
|
environment:
|
||||||
],
|
POSTGRES_USER: "${POSTGRES_USER:-postgres}"
|
||||||
'db' => [
|
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-postgres}"
|
||||||
'image' => 'postgres',
|
volumes:
|
||||||
'environment' => [
|
- "dbdata:/var/lib/postgresql/data"
|
||||||
'POSTGRES_USER' => '${POSTGRES_USER:-postgres}',
|
healthcheck:
|
||||||
'POSTGRES_PASSWORD' => '${POSTGRES_PASSWORD:-postgres}',
|
test:
|
||||||
],
|
- CMD
|
||||||
'volumes' => [
|
- pg_isready
|
||||||
'dbdata:/var/lib/postgresql/data',
|
- "-U"
|
||||||
],
|
- "postgres"
|
||||||
'healthcheck' => [
|
interval: 2s
|
||||||
'test' => ['CMD', 'pg_isready', '-U', 'postgres'],
|
timeout: 10s
|
||||||
'interval' => '2s',
|
retries: 10
|
||||||
'timeout' => '10s',
|
depends_on:
|
||||||
'retries' => 10,
|
app:
|
||||||
],
|
condition: service_healthy
|
||||||
'depends_on' => [
|
networks:
|
||||||
'app' => [
|
default:
|
||||||
'condition' => 'service_healthy',
|
name: something
|
||||||
],
|
external: true
|
||||||
],
|
noinet:
|
||||||
|
driver: bridge
|
||||||
|
internal: true';
|
||||||
|
|
||||||
],
|
$this->applicationComposeFileString = Yaml::parse($this->applicationYaml);
|
||||||
|
|
||||||
],
|
|
||||||
'networks' => [
|
|
||||||
'default' => [
|
|
||||||
'name' => 'something',
|
|
||||||
'external' => true,
|
|
||||||
],
|
|
||||||
'noinet' => [
|
|
||||||
'driver' => 'bridge',
|
|
||||||
'internal' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
$this->applicationComposeFileString = Yaml::dump($this->applicationComposeFile, 10, 2);
|
|
||||||
$this->jsonapplicationComposeFile = json_encode($this->applicationComposeFile, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
|
|
||||||
|
|
||||||
$this->application = Application::create([
|
$this->application = Application::create([
|
||||||
'name' => 'Application for tests',
|
'name' => 'Application for tests',
|
||||||
'docker_compose_domains' => json_encode([
|
'docker_compose_domains' => json_encode([
|
||||||
'app' => [
|
'app' => [
|
||||||
'domain' => 'http://bcoowoookw0co4cok4sgc4k8.127.0.0.1.sslip.io',
|
'domain' => 'http://bcoowoookw0co4cok4sgc4k8.127.0.0.1.sslip.io',
|
||||||
]
|
],
|
||||||
]),
|
]),
|
||||||
'uuid' => 'bcoowoookw0co4cok4sgc4k8',
|
'uuid' => 'bcoowoookw0co4cok4sgc4k8',
|
||||||
'repository_project_id' => 603035348,
|
'repository_project_id' => 603035348,
|
||||||
@@ -81,7 +68,7 @@ beforeEach(function () {
|
|||||||
'git_branch' => 'main',
|
'git_branch' => 'main',
|
||||||
'base_directory' => '/docker-compose-test',
|
'base_directory' => '/docker-compose-test',
|
||||||
'docker_compose_location' => 'docker-compose.yml',
|
'docker_compose_location' => 'docker-compose.yml',
|
||||||
'docker_compose_raw' => $this->applicationComposeFileString,
|
'docker_compose_raw' => $this->applicationYaml,
|
||||||
'build_pack' => 'dockercompose',
|
'build_pack' => 'dockercompose',
|
||||||
'ports_exposes' => '3000',
|
'ports_exposes' => '3000',
|
||||||
'environment_id' => 1,
|
'environment_id' => 1,
|
||||||
@@ -90,101 +77,77 @@ beforeEach(function () {
|
|||||||
'source_id' => 1,
|
'source_id' => 1,
|
||||||
'source_type' => GithubApp::class,
|
'source_type' => GithubApp::class,
|
||||||
]);
|
]);
|
||||||
|
$this->serviceYaml = '
|
||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
activepieces:
|
||||||
|
image: ghcr.io/activepieces/activepieces:latest
|
||||||
|
environment:
|
||||||
|
- SERVICE_FQDN_ACTIVEPIECES
|
||||||
|
- AP_ENCRYPTION_KEY=$SERVICE_PASSWORD_ENCRYPTIONKEY
|
||||||
|
- AP_EXECUTION_MODE=UNSANDBOXED
|
||||||
|
- AP_FRONTEND_URL=$SERVICE_FQDN_ACTIVEPIECES
|
||||||
|
- AP_TEST=${AP_TEST:-test}
|
||||||
|
volumes:
|
||||||
|
- "dbdata:/var/lib/postgresql/data"
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
- redis
|
||||||
|
activepieces2:
|
||||||
|
image: ghcr.io/activepieces/activepieces:latest
|
||||||
|
environment:
|
||||||
|
TEST: $SERVICE_FQDN_ACTIVEPIECES
|
||||||
|
volumes:
|
||||||
|
- "dbdata:/var/lib/postgresql/data"
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
- redis
|
||||||
|
postgres:
|
||||||
|
image: postgres:latest
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: activepieces
|
||||||
|
POSTGRES_USER: $SERVICE_USER_POSTGRES
|
||||||
|
POSTGRES_PASSWORD: $SERVICE_PASSWORD_POSTGRES
|
||||||
|
volumes:
|
||||||
|
- "dbdata:/var/lib/postgresql/data"
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
- CMD
|
||||||
|
- pg_isready
|
||||||
|
- "-U"
|
||||||
|
- "postgres"
|
||||||
|
interval: 2s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 10
|
||||||
|
redis:
|
||||||
|
image: redis:latest
|
||||||
|
volumes:
|
||||||
|
- "redis_data:/data"
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
- CMD
|
||||||
|
- redis-cli
|
||||||
|
- ping
|
||||||
|
interval: 2s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 10
|
||||||
|
volumes:
|
||||||
|
dbdata:
|
||||||
|
redis_data:
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
name: something
|
||||||
|
external: true
|
||||||
|
noinet:
|
||||||
|
driver: bridge
|
||||||
|
internal: true';
|
||||||
|
|
||||||
|
$this->serviceComposeFileString = Yaml::parse($this->serviceYaml);
|
||||||
$this->serviceComposeFile = [
|
|
||||||
'services' => [
|
|
||||||
'activepieces' => [
|
|
||||||
'image' => 'ghcr.io/activepieces/activepieces:latest',
|
|
||||||
'environment' => [
|
|
||||||
'SERVICE_FQDN_ACTIVEPIECES_80' => '/app',
|
|
||||||
'AP_API_KEY' => '$SERVICE_PASSWORD_64_APIKEY',
|
|
||||||
'AP_ENCRYPTION_KEY' => '$SERVICE_PASSWORD_ENCRYPTIONKEY',
|
|
||||||
'AP_ENGINE_EXECUTABLE_PATH' => 'dist/packages/engine/main.js',
|
|
||||||
'AP_ENVIRONMENT' => 'prod',
|
|
||||||
'AP_EXECUTION_MODE' => 'UNSANDBOXED',
|
|
||||||
'AP_FRONTEND_URL' => '$SERVICE_FQDN_ACTIVEPIECES',
|
|
||||||
'AP_JWT_SECRET' => '$SERVICE_PASSWORD_64_JWT',
|
|
||||||
'AP_POSTGRES_DATABASE' => 'activepieces',
|
|
||||||
'AP_POSTGRES_HOST' => 'postgres',
|
|
||||||
'AP_POSTGRES_PASSWORD' => '$SERVICE_PASSWORD_POSTGRES',
|
|
||||||
'AP_POSTGRES_PORT' => '5432',
|
|
||||||
'AP_POSTGRES_USERNAME' => '$SERVICE_USER_POSTGRES',
|
|
||||||
'AP_REDIS_HOST' => 'redis',
|
|
||||||
'AP_REDIS_PORT' => '6379',
|
|
||||||
'AP_SANDBOX_RUN_TIME_SECONDS' => '600',
|
|
||||||
'AP_TELEMETRY_ENABLED' => 'true',
|
|
||||||
'AP_TEMPLATES_SOURCE_URL' => 'https://cloud.activepieces.com/api/v1/flow-templates',
|
|
||||||
'AP_TRIGGER_DEFAULT_POLL_INTERVAL' => '5',
|
|
||||||
'AP_WEBHOOK_TIMEOUT_SECONDS' => '30',
|
|
||||||
'AP_TEST' => '${AP_TEST:-test}',
|
|
||||||
|
|
||||||
],
|
|
||||||
'depends_on' => [
|
|
||||||
'postgres' => [
|
|
||||||
'condition' => 'service_healthy',
|
|
||||||
],
|
|
||||||
'redis' => [
|
|
||||||
'condition' => 'service_started',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'healthcheck' => [
|
|
||||||
'test' => [
|
|
||||||
'CMD',
|
|
||||||
'curl',
|
|
||||||
'-f',
|
|
||||||
'http://127.0.0.1:80',
|
|
||||||
],
|
|
||||||
'interval' => '5s',
|
|
||||||
'timeout' => '20s',
|
|
||||||
'retries' => 10,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'postgres' => [
|
|
||||||
'image' => 'postgres:latest',
|
|
||||||
'environment' => [
|
|
||||||
'POSTGRES_DB' => 'activepieces',
|
|
||||||
'POSTGRES_PASSWORD' => '$SERVICE_PASSWORD_POSTGRES',
|
|
||||||
'POSTGRES_USER' => '$SERVICE_USER_POSTGRES',
|
|
||||||
],
|
|
||||||
'volumes' => [
|
|
||||||
'dbdata:/var/lib/postgresql/data',
|
|
||||||
],
|
|
||||||
'healthcheck' => [
|
|
||||||
'test' => [
|
|
||||||
'CMD-SHELL',
|
|
||||||
'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}',
|
|
||||||
],
|
|
||||||
'interval' => '5s',
|
|
||||||
'timeout' => '20s',
|
|
||||||
'retries' => 10,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'redis' => [
|
|
||||||
'image' => 'redis:latest',
|
|
||||||
'volumes' => [
|
|
||||||
'redis_data:/data',
|
|
||||||
],
|
|
||||||
'healthcheck' => [
|
|
||||||
'test' => [
|
|
||||||
'CMD',
|
|
||||||
'redis-cli',
|
|
||||||
'ping',
|
|
||||||
],
|
|
||||||
'interval' => '5s',
|
|
||||||
'timeout' => '20s',
|
|
||||||
'retries' => 10,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
$this->serviceComposeFileString = Yaml::dump($this->serviceComposeFile, 10, 2);
|
|
||||||
$this->jsonServiceComposeFile = json_encode($this->serviceComposeFile, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
|
|
||||||
|
|
||||||
$this->service = Service::create([
|
$this->service = Service::create([
|
||||||
'name' => 'Service for tests',
|
'name' => 'Service for tests',
|
||||||
'uuid' => (string) new Cuid2(),
|
'uuid' => (string) new Cuid2(),
|
||||||
'docker_compose_raw' => $this->serviceComposeFileString,
|
'docker_compose_raw' => $this->serviceYaml,
|
||||||
'environment_id' => 1,
|
'environment_id' => 1,
|
||||||
'server_id' => 0,
|
'server_id' => 0,
|
||||||
'destination_id' => 0,
|
'destination_id' => 0,
|
||||||
@@ -362,23 +325,24 @@ afterEach(function () {
|
|||||||
|
|
||||||
test('ServiceComposeParseNew', function () {
|
test('ServiceComposeParseNew', function () {
|
||||||
ray()->clearAll();
|
ray()->clearAll();
|
||||||
$output = newParser($this->application);
|
$output = newParser($this->service);
|
||||||
ray('New parser');
|
// ray('New parser');
|
||||||
ray($output->toArray());
|
// ray($output->toArray());
|
||||||
|
ray($this->service->environment_variables->pluck('value', 'key')->toArray());
|
||||||
expect($output)->toBeInstanceOf(Collection::class);
|
expect($output)->toBeInstanceOf(Collection::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
// test('ServiceComposeParseOld', function () {
|
// test('ServiceComposeParseOld', function () {
|
||||||
// $output = parseDockerComposeFile($this->service);
|
// $output = parseDockerComposeFile($this->service);
|
||||||
// ray('Old parser');
|
// ray('Old parser');
|
||||||
// ray($output->toArray());
|
// // ray($output->toArray());
|
||||||
// ray($this->service->environment_variables->pluck('value', 'key')->toArray());
|
// // ray($this->service->environment_variables->pluck('value', 'key')->toArray());
|
||||||
// foreach ($this->service->applications as $application) {
|
// // foreach ($this->service->applications as $application) {
|
||||||
// ray($application->persistentStorages->pluck('mount_path', 'name')->toArray());
|
// // ray($application->persistentStorages->pluck('mount_path', 'name')->toArray());
|
||||||
// }
|
// // }
|
||||||
// foreach ($this->service->databases as $database) {
|
// // foreach ($this->service->databases as $database) {
|
||||||
// ray($database->persistentStorages->pluck('mount_path', 'name')->toArray());
|
// // ray($database->persistentStorages->pluck('mount_path', 'name')->toArray());
|
||||||
// }
|
// // }
|
||||||
// expect($output)->toBeInstanceOf(Collection::class);
|
// expect($output)->toBeInstanceOf(Collection::class);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
@@ -387,3 +351,30 @@ test('ServiceComposeParseNew', function () {
|
|||||||
// $output = instant_remote_process(['docker --version'], $server);
|
// $output = instant_remote_process(['docker --version'], $server);
|
||||||
// expect($output)->toContain('Docker version');
|
// expect($output)->toContain('Docker version');
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
// test('ConvertComposeEnvironmentToArray', function () {
|
||||||
|
// ray()->clearAll();
|
||||||
|
// $yaml = '
|
||||||
|
// services:
|
||||||
|
// activepieces:
|
||||||
|
// environment:
|
||||||
|
// - SERVICE_FQDN_ACTIVEPIECES=/app
|
||||||
|
// - AP_API_KEY=$SERVICE_PASSWORD_64_APIKEY
|
||||||
|
// activepieces2:
|
||||||
|
// environment:
|
||||||
|
// - SERVICE_FQDN_ACTIVEPIECES=/v1/realtime
|
||||||
|
// postgres:
|
||||||
|
// environment:
|
||||||
|
// - POSTGRES_DB: activepieces
|
||||||
|
// ';
|
||||||
|
// $parsedYaml = Yaml::parse($yaml);
|
||||||
|
// $output = convertComposeEnvironmentToArray($parsedYaml['services']['activepieces']['environment']);
|
||||||
|
// $output2 = convertComposeEnvironmentToArray($parsedYaml['services']['activepieces2']['environment']);
|
||||||
|
// $dboutput = convertComposeEnvironmentToArray($parsedYaml['services']['postgres']['environment']);
|
||||||
|
// ray($output);
|
||||||
|
// ray($output2);
|
||||||
|
// ray($dboutput);
|
||||||
|
// expect($output)->toBeInstanceOf(Collection::class);
|
||||||
|
// expect($output2)->toBeInstanceOf(Collection::class);
|
||||||
|
// expect($dboutput)->toBeInstanceOf(Collection::class);
|
||||||
|
// });
|
||||||
|
Reference in New Issue
Block a user