Skip to content

Commit

Permalink
add testing helpers.
Browse files Browse the repository at this point in the history
  • Loading branch information
wildone committed Aug 6, 2021
1 parent c310ca2 commit ff14ace
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 121 deletions.
8 changes: 4 additions & 4 deletions automation-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
loop: [
{
debug_hide: "false",
simple_name: "gebaemtesting-showcase",
group_name: "gebaemtesting",
package_version: "1.1.12-SNAPSHOT",
package_name: "gebaemtesting-showcase",
simple_name: "aemdesign-aem-support-deploy",
group_name: "aemdesign",
package_version: "2.0.583",
package_name: "aemdesign-aem-support-deploy",
package_url: "{{ DEPLOY_PACKAGE_URL }}",
url_username: "{{ GIT_PACKAGE_USERNAME }}",
url_password: "{{ GIT_PACKAGE_PASSWORD }}",
Expand Down
59 changes: 36 additions & 23 deletions deploy.ps1
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
Param(
[string]$LOG_PATH = "${PWD}\logs",
[string]$LOG_PATH = "logs",
[string]$LOG_PEFIX = "deploy",
[string]$LOG_SUFFIX = ".log",
[string]$DOCKER_LOGS_FOLDER = "${PWD}\logs\docker",
[string]$DOCKER_LOGS_FOLDER = "logs\docker",
[string]$AEM_SCHEME = "http",
[string]$AEM_HOST = "localhost",
[string]$AEM_PORT = "4502",
[string]$AEM_USERNAME = "admin",
[string]$AEM_PASSWORD = "admin",
[string]$MVN_COMMAND = "mvn -D""vault.useProxy=false"" -DskipTests -e -U -P installdeploymentpackage clean install -D""aem.port=$AEM_PORT"" -D""aem.host=$AEM_HOST"" -D""aem.username=$AEM_USERNAME"" -D""aem.password=$AEM_PASSWORD"" -D""aem.scheme=$AEM_SCHEME"" "
[string]$MVN_COMMAND = "mvn -DskipTests -e -U -P autoInstallPackage clean install -D""aem.port=$AEM_PORT"" -D""aem.host=$AEM_HOST"" -D""aem.username=$AEM_USERNAME"" -D""aem.password=$AEM_PASSWORD"" -D""aem.scheme=$AEM_SCHEME"" ",
[string]$FUNCTIONS_URI = "https://github.com/aem-design/aemdesign-docker/releases/latest/download/functions.ps1",
# Disable services before import
[string[]]$SERVICES_TO_DISABLE = @(
"/system/console/bundles/com.day.cq.cq-mailer",
"/system/console/bundles/com.adobe.granite.workflow.core"
)

)

. ".\scripts\functions.ps1"
$SKIP_CONFIG = $true
$PARENT_PROJECT_PATH = "."

printSectionBanner "Deploying Monolith Package:" "warn"
printSectionLine "mvn -Dvault.useProxy=false -DskipTests -e -U -P installdeploymentpackage clean install"
. ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "${FUNCTIONS_URI}").Content))))

$script:LOG_PATH = $LOG_PATH
$script:TEST_SELENIUM_URL = $TEST_SELENIUM_URL

printSectionBanner "Deploying Monolith Package"
printSectionLine ("$MVN_COMMAND" -replace "$AEM_PASSWORD", "***")

#update host
if ( $TEST_HOST -eq "localhost" )
Expand All @@ -25,32 +36,34 @@ if ( $TEST_HOST -eq "localhost" )
$script:TEST_HOST="${LOCAL_IP}"
}

$script:ADDRESS="${AEM_SCHEMA}://${AEM_HOST}:${AEM_PORT}"
$script:AEM_AVAILABLE=$(testServer "${ADDRESS}")
$script:AEM_AVAILABLE=$(testServer "${AEM_SCHEME}://${AEM_HOST}:${AEM_PORT}")

printSectionLine "Is AEM at ${AEM_SCHEME}://${AEM_HOST}:${AEM_PORT} available? ${AEM_AVAILABLE}"

if ( $AEM_AVAILABLE )
{
printSectionLine "AEM host is available!" "info"

printSectionBanner "Disable Workflows" "warn"
doSlingPost -Method Post -Referer $ADDRESS -UserAgent "curl" -Body $WORKFLOW_ASSET_DISABLE_UPDATE -Url "${ADDRESS}${WORKFLOW_ASSET_MODIFY}" -BasicAuthCreds ${AEM_USERNAME}:${AEM_PASSWORD} -Timeout $TIMEOUT
doSlingPost -Method Post -Referer $ADDRESS -UserAgent "curl" -Body $WORKFLOW_ASSET_DISABLE_CREATE -Url "${ADDRESS}${WORKFLOW_ASSET_CREATE}" -BasicAuthCreds ${AEM_USERNAME}:${AEM_PASSWORD} -Timeout $TIMEOUT

# printSectionBanner "Disable aem mailer bundle" "warn"
# doSlingPost -Method Post -Referer $ADDRESS -UserAgent "curl" -Body $BODY_SERVICE_TO_DISABLE -Url "${ADDRESS}${SERVICE_TO_DISABLE}" -BasicAuthCreds ${AEM_USERNAME}:${AEM_PASSWORD} -Timeout $TIMEOUT
if ($SERVICES_TO_DISABLE)
{
Write-Output "------- Disable Services ----------"
$SERVICES_TO_DISABLE | ForEach-Object {
Write-Output "Stopping service: $_"
doSlingPost -Method Post -Referer $ADDRESS -UserAgent "curl" -Body $BODY_SERVICE_TO_DISABLE -Url "${ADDRESS}$_" -BasicAuthCreds ${AEM_USER}:${AEM_PASSWORD} -Timeout $TIMEOUT
}
}

printSectionLine "Deploying!" "info"
printSectionLine "AEM host is available!" "info"
printSectionLine "Deploying:" "info"
Invoke-Expression -Command "$MVN_COMMAND" | Tee-Object -Append -FilePath "${LOG_FILE}"


printSectionBanner "Enable Workflows" "warn"
doSlingPost -Method Post -Referer $ADDRESS -UserAgent "curl" -Body $WORKFLOW_ASSET_ENABLE_UPDATE -Url "${ADDRESS}${WORKFLOW_ASSET_MODIFY}" -BasicAuthCreds ${AEM_USERNAME}:${AEM_PASSWORD} -Timeout $TIMEOUT
doSlingPost -Method Post -Referer $ADDRESS -UserAgent "curl" -Body $WORKFLOW_ASSET_ENABLE_CREATE -Url "${ADDRESS}${WORKFLOW_ASSET_CREATE}" -BasicAuthCreds ${AEM_USERNAME}:${AEM_PASSWORD} -Timeout $TIMEOUT

# printSectionBanner "Enable aem mailer bundle" "info"
# doSlingPost -Method Post -Referer $ADDRESS -UserAgent "curl" -Body $BODY_SERVICE_TO_DISABLE_ENABLE -Url "${ADDRESS}${SERVICE_TO_DISABLE}" -BasicAuthCreds ${AEM_USERNAME}:${AEM_PASSWORD} -Timeout $TIMEOUT
if ($SERVICES_TO_DISABLE)
{
Write-Output "------- Enable Services ----------"
$SERVICES_TO_DISABLE | ForEach-Object {
Write-Output "Stopping service: $_"
doSlingPost -Method Post -Referer $ADDRESS -UserAgent "curl" -Body $BODY_SERVICE_TO_DISABLE_ENABLE -Url "${ADDRESS}$_" -BasicAuthCreds ${AEM_USER}:${AEM_PASSWORD} -Timeout $TIMEOUT
}
}


} else {
Expand Down
94 changes: 0 additions & 94 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,100 +2,6 @@ version: "2.4"

services:

nginx:
extends:
file: ./docker/nginx/docker-compose.yml
service: nginx
volumes:
- ./docker/nginx/content:/content
- ./docker/nginx/config/nginx.conf:/etc/nginx/nginx.conf

createcert:
extends:
file: ./docker/traefik/docker-compose.yml
service: createcert
volumes:
- ./docker/traefik/certs:/root/.local/share/mkcert

createcertpkcs12:
extends:
file: ./docker/traefik/docker-compose.yml
service: createcertpkcs12
depends_on:
- createcert
volumes:
- ./docker/traefik/certs:/export

traefik:
extends:
file: ./docker/traefik/docker-compose.yml
service: traefik
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
# Persist certificates, so we can restart as often as needed
- ./docker/traefik/certs:/letsencrypt
- ./docker/traefik/config/config.yml:/etc/traefik/dynamic_conf/conf.yml:ro
depends_on:
- createcert
- createcertpkcs12

seleniumhub:
extends:
file: ./docker/selenium/docker-compose.yml
service: seleniumhub
depends_on:
- traefik

selenium-node-chrome:
extends:
file: ./docker/selenium/docker-compose.yml
service: selenium-node-chrome
depends_on:
- seleniumhub

author:
extends:
file: ./docker/aem/docker-compose.yml
service: author

authordeploy:
extends:
file: ./docker/aem/docker-compose.yml
service: authordeploy
volumes:
- "./:/build/source"
- "~/.m2:/build/.m2"
profiles:
- dodeploy
depends_on:
- author

publish:
extends:
file: ./docker/aem/docker-compose.yml
service: publish
depends_on:
- author

publishdeploy:
extends:
file: ./docker/aem/docker-compose.yml
service: publishdeploy
volumes:
- "./:/build/source"
- "~/.m2:/build/.m2"
profiles:
- dodeploy
depends_on:
- author

dispatcher:
extends:
file: ./docker/aem/docker-compose.yml
service: dispatcher
depends_on:
- publish

testing:
extends:
file: ./docker/testing/docker-compose.yml
Expand Down

0 comments on commit ff14ace

Please sign in to comment.