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

Deployment optimizations for reduced time to build and redeploys #739

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

nickdenardis
Copy link
Member

@nickdenardis nickdenardis commented Oct 8, 2024

Reason for change

Build and deploys are now taking 4-5 minutes on average. This is far too much time to wait to install dependencies, test, package and ship the code to the server.

After adding timing to each of the tasks, it was discovered a few tasks were running multiple times, commands on the server were not optimized and the cleanup of previous releases was holding up the deploy from finishing.

The goal is to get deploys to happen in under 1-minute.

Changes

  1. Dependencies are no longer cleared after each release so only incremental changes need to be installed
  2. Composer and npm installs still happen twice (the first time to run the tests, the second time to package the release), this is still an incremental improvement and this will be optimized further in a next update
  3. Moving files on the server uses an optimized rsync command for speed and reduced output noise
  4. Moving previous releases on the server uses mv instead of cp for speed
  5. Packaged releases are named by release hash to detect and skip rebuilds of redeploys
  6. Cleaning up previous releases has been forked to another thread so it isn't blocking the deploy from finishing

This deploy script isn't the easiest to read, so each section modified now includes indentations for formatting.

Demo

  1. First deploy is the previous benchmark
  2. Second deploy is the non-primed cache version of this change
  3. Thirs deploy is the primed cache redeploy

Screenshot 2024-10-08 at 8 54 11 AM

@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same
when pulling 1a01c22 on feature/deploy-optimizations
into a476907 on develop.

@nickdenardis nickdenardis marked this pull request as ready for review October 9, 2024 10:05
@nickdenardis nickdenardis requested a review from a team as a code owner October 9, 2024 10:05
@nickdenardis nickdenardis merged commit 68f29cd into develop Oct 10, 2024
2 checks passed
@nickdenardis nickdenardis deleted the feature/deploy-optimizations branch October 10, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants