Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dev-env): make wordpress init-only container #2143

Merged
merged 3 commits into from
Dec 13, 2024

Conversation

sjinks
Copy link
Member

@sjinks sjinks commented Dec 8, 2024

Description

This PR updates the Dev Environment Lando template to make the wordpress service init-only (see #1341 for the background). Because we use wordpress only to provide a volume with WordPress installation, we don't need the container after the initialization stage. Letting the container die peacefully will free up some memory and CPU and reduce the number of mount points.

This PR and #2139 will let us merge the dev-tools and wordpress services into one. We will also be able to replace the dependency condition for wordpress from service_started to service_completed_successfully; this will simplify the WordPress setup script because Docker will start the php service after WordPress files are copied to where they belong.

Pull request checklist

New release checklist

Steps to Test

  1. Check out the PR, npm run build && npm link.
  2. vip dev-env create < /dev/null && vip dev-env start.
  3. vip dev-env logs -S wordpress must show nothing because we bypass Lando.
  4. docker ps -a --no-trunc must show the entry point for the wordpress service as "/usr/bin/rsync -a --chown=1000:1000 /wp/ /shared/" (with the UID and GID of the current user instead of 1000:1000).
  5. The environment must work.

@sjinks sjinks self-assigned this Dec 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 3 changed files in this pull request and generated no suggestions.

Files not reviewed (1)
  • assets/dev-env.lando.template.yml.ejs: Language not supported
Copy link
Contributor

github-actions bot commented Dec 8, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

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/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${LANDO_HOST_USER_ID} and ${LANDO_HOST_GROUP_ID} will be taken directly from the environment; we don't need to spawn a shell to pass the values to the program.

Because the container is init-only, we don't need Lando scripts to manage permissions either; rsync perfectly understands numeric IDs and does not require the presence of /etc/passwd. This allows us to optimize WordPress images.

@sjinks sjinks force-pushed the wordpress-init-only branch from 2d7c9d1 to 5c0d0f8 Compare December 11, 2024 19:27
@rinatkhaziev
Copy link
Contributor

Tested under all platforms (except Linux), works as expected.

@sjinks sjinks force-pushed the wordpress-init-only branch from 5c0d0f8 to 386888f Compare December 12, 2024 22:50
@sjinks sjinks merged commit 11aa1fc into trunk Dec 13, 2024
17 checks passed
@sjinks sjinks deleted the wordpress-init-only branch December 13, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants