From 6b443dd2e1a51dcfbd90d623a29ca692d155e165 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Sun, 8 Dec 2024 19:20:04 +0200 Subject: [PATCH 1/3] refactor(dev-env): make `wordpress` init-only container --- assets/dev-env.lando.template.yml.ejs | 12 ++++++------ src/lib/dev-environment/dev-environment-lando.ts | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/assets/dev-env.lando.template.yml.ejs b/assets/dev-env.lando.template.yml.ejs index ccf72dfd0..2a74244a3 100644 --- a/assets/dev-env.lando.template.yml.ejs +++ b/assets/dev-env.lando.template.yml.ejs @@ -191,8 +191,6 @@ services: type: compose services: image: ghcr.io/automattic/vip-container-images/wordpress:<%= wordpress.tag %> -# command: /usr/local/bin/entrypoint.sh - command: sh -c "rsync -a --chown=www-data:www-data /wp/ /shared/; sleep infinity" volumes: - ./wordpress:/shared - type: volume @@ -200,10 +198,12 @@ services: target: /scripts volume: nocopy: true -# environment: -# LANDO_NO_SCRIPTS: 1 -# LANDO_NEEDS_EXEC: 1 -# initOnly: true + environment: + LANDO_NO_USER_PERMS: 1 + LANDO_NO_SCRIPTS: 1 + LANDO_NEEDS_EXEC: 1 + initOnly: true + entrypoint: /usr/bin/rsync -a --chown=${LANDO_HOST_USER_ID}:${LANDO_HOST_GROUP_ID} /wp/ /shared/ <% if ( muPlugins.mode == 'image' ) { %> vip-mu-plugins: diff --git a/src/lib/dev-environment/dev-environment-lando.ts b/src/lib/dev-environment/dev-environment-lando.ts index 026e976d1..479795094 100644 --- a/src/lib/dev-environment/dev-environment-lando.ts +++ b/src/lib/dev-environment/dev-environment-lando.ts @@ -7,7 +7,7 @@ import landoUtils, { type AppInfo } from 'lando/plugins/lando-core/lib/utils'; import landoBuildTask from 'lando/plugins/lando-tooling/lib/build'; import { lookup } from 'node:dns/promises'; import { mkdir, rename } from 'node:fs/promises'; -import { tmpdir } from 'node:os'; +import { tmpdir, userInfo } from 'node:os'; import path, { dirname } from 'node:path'; import { satisfies } from 'semver'; import xdgBasedir from 'xdg-basedir'; @@ -89,6 +89,10 @@ async function getLandoConfig(): Promise< LandoConfig > { home: fakeHomeDir, domain: 'vipdev.lndo.site', version: 'unknown', + env: { + LANDO_HOST_USER_ID: process.platform === 'win32' ? '1000' : `${ userInfo().uid }`, + LANDO_HOST_GROUP_ID: process.platform === 'win32' ? '1000' : `${ userInfo().gid }`, + }, }; return buildConfig( config ); From 10f17ada228121fcdfeabb92d1ad0e44e1679342 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Sun, 8 Dec 2024 19:41:11 +0200 Subject: [PATCH 2/3] fix: remove `environment` block --- assets/dev-env.lando.template.yml.ejs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/assets/dev-env.lando.template.yml.ejs b/assets/dev-env.lando.template.yml.ejs index 2a74244a3..536cfeaf7 100644 --- a/assets/dev-env.lando.template.yml.ejs +++ b/assets/dev-env.lando.template.yml.ejs @@ -198,10 +198,6 @@ services: target: /scripts volume: nocopy: true - environment: - LANDO_NO_USER_PERMS: 1 - LANDO_NO_SCRIPTS: 1 - LANDO_NEEDS_EXEC: 1 initOnly: true entrypoint: /usr/bin/rsync -a --chown=${LANDO_HOST_USER_ID}:${LANDO_HOST_GROUP_ID} /wp/ /shared/ From 386888f1effaa2a2177143ff4dc47f8da6173d61 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Fri, 13 Dec 2024 00:49:51 +0200 Subject: [PATCH 3/3] fix: update `wordpress` dependency condition to `service_completed_successfully` --- assets/dev-env.lando.template.yml.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/dev-env.lando.template.yml.ejs b/assets/dev-env.lando.template.yml.ejs index 536cfeaf7..bfcc12bed 100644 --- a/assets/dev-env.lando.template.yml.ejs +++ b/assets/dev-env.lando.template.yml.ejs @@ -73,7 +73,7 @@ services: devtools: condition: service_completed_successfully wordpress: - condition: service_started + condition: service_completed_successfully <% if ( muPlugins.mode == 'image' ) { %> vip-mu-plugins: condition: service_started