-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Application bootstrap script for Linux and macOS * Windows bootstrap script * Creating random network name during bootstrap Avoiding conflicts if several applications versions should exist on one machine * Celery depends on Redis * Fixed random string generation in PowerShell script * Updated README * Check DC version in GitHub Actions * Special Docker Compose override file for CI * Replaced xxd utility with od xxd seems to be not installed by default in at least some of the major Linux distributions * Stopping containers before removal * od's -w flag is incompatible with macOS version of Bash
- Loading branch information
Showing
11 changed files
with
320 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
JDI_VERSION_LABEL=latest | ||
SELENOID_PARALLEL_SESSIONS_COUNT=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
services: | ||
api: | ||
image: "ghcr.io/jdi-testing/jdi-qasp-ml:${JDI_VERSION_LABEL:?Define JDI QASP ML Docker image tag to use}" | ||
environment: | ||
ENV: LOCAL | ||
depends_on: !override | ||
- selenoid | ||
- celery | ||
- redis | ||
|
||
celery: | ||
image: "ghcr.io/jdi-testing/jdi-qasp-ml:${JDI_VERSION_LABEL:?Define JDI QASP ML Docker image tag to use}" | ||
|
||
mongodb: !reset [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Disclaimer | ||
# We don't need this file basically and could have just used | ||
# docker-compose.override.dev.yaml. But the problem is that _at this moment_ | ||
# Docker Compose in our GitHub Actions runner doesn't know how to deal with | ||
# !reset construct. | ||
|
||
services: | ||
selenoid: | ||
ports: | ||
- "${SELENOID_PORT:-4445}:4444" | ||
|
||
api: | ||
image: !reset null | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
volumes: | ||
- .:/jdi-qasp-ml | ||
environment: | ||
ENV: LOCAL | ||
depends_on: !override | ||
- selenoid | ||
- celery | ||
- redis | ||
|
||
celery: | ||
image: !reset null | ||
build: | ||
context: . | ||
dockerfile: Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
param( | ||
[Parameter(HelpMessage="Branch used as a source for downloading files")] | ||
[string]$Branch = 'master', | ||
[Parameter(HelpMessage="Amount of allowed parallel Selenium sessions")] | ||
[int]$CoresToUse = (Get-WmiObject -Class Win32_Processor).NumberOfLogicalProcessors, | ||
[Parameter(HelpMessage="Docker image label to pull")] | ||
[string]$Label = 'latest', | ||
[Parameter(HelpMessage="Docker Compose pull policy")] | ||
[string]$PullPolicy = 'always', | ||
[Parameter(HelpMessage="Run Docker Compose in 'detached' mode")] | ||
[switch]$Detached, | ||
[Parameter(HelpMessage="Do not remove old Docker resources with the same label")] | ||
[switch]$NoCleanup | ||
) | ||
|
||
function Download-File { | ||
param( | ||
[string]$Url, | ||
[string]$OutputPath | ||
) | ||
$webClient = New-Object System.Net.WebClient | ||
$webClient.DownloadFile($Url, $OutputPath) | ||
} | ||
|
||
# Remove old Docker resources if cleanup flag is not set | ||
if (-not $NoCleanup) { | ||
$labelSelector = "org.jdi-qasp-ml.version_label=$Label" | ||
docker stop $(docker ps -qf "label=$labelSelector") 2>$null | ||
docker container rm -f $(docker ps -qaf "label=$labelSelector") 2>$null | ||
docker volume rm -f $(docker volume ls -qf "label=$labelSelector") 2>$null | ||
docker network rm -f $(docker network ls -qf "label=$labelSelector") 2>$null | ||
Remove-Item -Path "docker-compose.yaml", "docker-compose.override.yaml", "browsers.json", ".env" -ErrorAction SilentlyContinue | ||
} | ||
|
||
$RepoUrl = "https://raw.githubusercontent.com/jdi-testing/jdi-qasp-ml/$Branch" | ||
|
||
Download-File -Url ("$RepoUrl/docker-compose.yaml") -OutputPath "docker-compose.yaml" | ||
Download-File -Url ("$RepoUrl/browsers.json") -OutputPath "browsers.json" | ||
|
||
$randomNumber = Get-Random -Minimum 0 -Maximum 99999999 | ||
$hash = [System.Security.Cryptography.SHA256]::Create().ComputeHash([System.Text.Encoding]::UTF8.GetBytes($randomNumber.ToString())) | ||
$randomString = ([System.BitConverter]::ToString($hash) -replace '-', '').Substring(0, 8) | ||
$NetworkName = ("jdi-qasp-ml-$randomString") | ||
|
||
@" | ||
JDI_VERSION_LABEL=$Label | ||
SELENOID_PARALLEL_SESSIONS_COUNT=$CoresToUse | ||
JDI_DEFAULT_NETWORK_NAME=$NetworkName | ||
"@ | Set-Content -Path ".env" | ||
|
||
if ($Label -ne 'latest') { | ||
Download-File -Url ("$RepoUrl/docker-compose.override.arbitrary-tag.yaml") -OutputPath "docker-compose.override.yaml" | ||
} | ||
|
||
# Start Docker Compose | ||
if ($Detached) { | ||
docker compose up -d --pull $PullPolicy | ||
} else { | ||
docker compose up --pull $PullPolicy | ||
} |
Oops, something went wrong.