Skip to content

Commit

Permalink
[APPS-4322] ACP local development setup. (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
pushokwhite authored Aug 14, 2024
1 parent 7cc196c commit 72f4a92
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
15 changes: 15 additions & 0 deletions generator/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public function setIsActive(bool $isActive): void
$projectData['_requirementAnalyzerData'] = buildDataForRequirementAnalyzer($projectData);
$projectData['secrets'] = buildSecrets($deploymentDir);
$projectData = buildDefaultCredentials($projectData);
$projectData['_isAcpLocalDevelopmentEnabled'] = isAcpLocalDevelopmentEnabled($projectData);

$dockerVersionObject = json_decode(getenv('DOCKER_VERSION', '{}'));
$skipVersionHeader = version_compare($dockerVersionObject?->Client?->Version, '26.0.0', '>=');
Expand Down Expand Up @@ -1140,6 +1141,20 @@ function isAutoloadCacheEnabled(array $projectData): bool
return $projectData['docker']['cache']['autoload']['enabled'] ?? false;
}

/**
* @param array $projectData
*
* @return bool
*/
function isAcpLocalDevelopmentEnabled(array $projectData): bool
{
if (empty($projectData['image']['environment']['ACP_DOCKER_SDK_FILE'])) {
return false;
}

return true;
}

/**
* @param array $projectData
*
Expand Down
13 changes: 13 additions & 0 deletions generator/src/templates/deploy.bash.twig
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ import service/database/{{ services['database']['engine'] | default('mysql') }}.
import service/broker/{{ services['broker']['engine'] | default('rabbitmq') }}.sh
import service/scheduler/{{ services['scheduler']['engine'] | default('jenkins') }}.sh

{% if _isAcpLocalDevelopmentEnabled %}
# ACP
[[ -f "{{ image['environment']['ACP_DOCKER_SDK_FILE'] }}" ]] && source "{{ image['environment']['ACP_DOCKER_SDK_FILE'] }}"
{% endif %}

# Implementation
import sdk/compose.sh
import sdk/data/demo.sh
Expand Down Expand Up @@ -237,6 +242,14 @@ export TIDEWAYS_ENVIRONMENT_NAME=${TIDEWAYS_ENVIRONMENT_NAME}
{# For avoid https://github.com/docker/compose/issues/9104 #}
export DOCKER_COMPOSE_TTY_DISABLED="$(Environment::getDockerComposeTTY)"

{% if _isAcpLocalDevelopmentEnabled %}
# ACP
export ACP_AWS_ENDPOINT={{ image['environment']['AWS_ENDPOINT'] | default('http://localhost:4566') }}
export ACP_AWS_REGION={{ image['environment']['AWS_DEFAULT_REGION'] | default('eu-central-1') }}
export ACP_AWS_ACCESS_KEY_ID={{ image['environment']['AWS_ACCESS_KEY_ID'] | default('test') }}
export ACP_AWS_SECRET_ACCESS_KEY={{ image['environment']['AWS_SECRET_ACCESS_KEY'] | default('test') }}
{% endif %}

Registry::Flow::runBoot

# Running command
Expand Down

0 comments on commit 72f4a92

Please sign in to comment.