Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions __tests__/flashlight/compose-template.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,16 @@ describe('renderCompose', () => {
expect(yml).toContain('PS_DOMAIN: localhost:8002');
expect(yml).toContain('/w:/var/www/html/themes/t');
});

it('includes a MariaDB sidecar with health check and depends_on', () => {
const yml = renderCompose({
psVersion: '9.0.0', port: 8000,
workspace: '/w', containerPath: '/var/www/html/modules/x',
});
expect(yml).toContain('mysql:');
expect(yml).toContain('image: mariadb:lts');
expect(yml).toContain('healthcheck.sh');
expect(yml).toContain('MYSQL_DATABASE: prestashop');
expect(yml).toMatch(/depends_on:\s*\n\s+mysql:\s*\n\s+condition: service_healthy/);
});
});
20 changes: 19 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119966,6 +119966,9 @@ function renderCompose(p) {
return `services:
prestashop:
image: prestashop/prestashop-flashlight:${p.psVersion}
depends_on:
mysql:
condition: service_healthy
ports:
- "${p.port}:80"
volumes:
Expand All @@ -119974,6 +119977,19 @@ function renderCompose(p) {
PS_DOMAIN: localhost:${p.port}
DEBUG_MODE: 0
INIT_ON_RESTART: 0

mysql:
image: mariadb:lts
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect"]
interval: 10s
timeout: 10s
retries: 5
environment:
MYSQL_USER: prestashop
MYSQL_PASSWORD: prestashop
MYSQL_ROOT_PASSWORD: prestashop
MYSQL_DATABASE: prestashop
`;
}

Expand Down Expand Up @@ -120074,7 +120090,9 @@ async function startFlashlight(p) {
fs.writeFileSync(composePath, p.composeYaml);
await exec.exec('docker', ['compose', '-f', composePath, 'up', '-d']);
const url = `http://localhost:${p.port}`;
await waitFor(url, 120_000);
// 4 min: MySQL healthcheck + PS first-boot install can legitimately take
// 90-150s on cold GitHub Actions runners.
await waitFor(url, 240_000);
const tearDown = async ({ onFailure }) => {
if (onFailure) {
core.startGroup('Flashlight logs');
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions src/flashlight/compose-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export function renderCompose(p: RenderParams): string {
return `services:
prestashop:
image: prestashop/prestashop-flashlight:${p.psVersion}
depends_on:
mysql:
condition: service_healthy
ports:
- "${p.port}:80"
volumes:
Expand All @@ -17,5 +20,18 @@ export function renderCompose(p: RenderParams): string {
PS_DOMAIN: localhost:${p.port}
DEBUG_MODE: 0
INIT_ON_RESTART: 0

mysql:
image: mariadb:lts
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect"]
interval: 10s
timeout: 10s
retries: 5
environment:
MYSQL_USER: prestashop
MYSQL_PASSWORD: prestashop
MYSQL_ROOT_PASSWORD: prestashop
MYSQL_DATABASE: prestashop
`;
}
4 changes: 3 additions & 1 deletion src/flashlight/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export async function startFlashlight(p: StartParams): Promise<FlashlightHandle>
await exec.exec('docker', ['compose', '-f', composePath, 'up', '-d']);

const url = `http://localhost:${p.port}`;
await waitFor(url, 120_000);
// 4 min: MySQL healthcheck + PS first-boot install can legitimately take
// 90-150s on cold GitHub Actions runners.
await waitFor(url, 240_000);

const tearDown = async ({ onFailure }: { onFailure: boolean }): Promise<void> => {
if (onFailure) {
Expand Down
Loading