Skip to content

Conversation

@cdrini
Copy link
Collaborator

@cdrini cdrini commented Aug 21, 2025

Small improvements from #11156 while testing monitoring changes.

New features:

  1. Add a RESET=true environment variable option. When specified, resets the container before applying the patch
  2. Switch eg CONTAINER=openlibrary-web_nginx-1 to SERVICE=web_nginx. This was necessary for the RESET option
  3. Allow passing in a direct diff/patch url. This lets you patch deploy a specific commit within a PR

Technical

Testing

Screenshot

Stakeholders

@Copilot Copilot AI review requested due to automatic review settings August 21, 2025 11:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the patch deployment script by adding container reset functionality and switching from container-specific names to service-based deployment. The changes improve flexibility for testing monitoring changes and allow patching specific commits within PRs.

  • Add RESET=true environment variable to recreate containers before applying patches
  • Replace container names (CONTAINER) with service names (SERVICE) for better Docker Compose integration
  • Support direct diff/patch URLs in addition to PR numbers

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

echo " Default: container unless patching www nginx changes"
echo " CONTAINER=container_name Default: openlibrary-web-1 for ol-web hosts,"
echo " openlibrary-web_nginx-1 for ol-www0"
echo " SERVICE=container_name Default: web for ol-web hosts, web_nginx for ol-www0"
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The help text description 'container_name' is misleading since this parameter now expects service names, not container names. Consider changing to 'SERVICE=service_name' for clarity.

Suggested change
echo " SERVICE=container_name Default: web for ol-web hosts, web_nginx for ol-www0"
echo " SERVICE=service_name Default: web for ol-web hosts, web_nginx for ol-www0"

Copilot uses AI. Check for mistakes.
echo -n " recreating ... "
ssh ${host}.us.archive.org "
export COMPOSE_FILE='/opt/openlibrary/compose.yaml:/opt/openlibrary/compose.production.yaml'
export HOSTNAME=\$HOSTNAME
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The same environment variable exports are duplicated in three locations. Consider extracting these to a variable or function to reduce code duplication and improve maintainability.

Suggested change
export HOSTNAME=\$HOSTNAME
${COMMON_EXPORTS}

Copilot uses AI. Check for mistakes.
ssh ${host}.us.archive.org "
docker exec ${CONTAINER} bash -c '
export COMPOSE_FILE='/opt/openlibrary/compose.yaml:/opt/openlibrary/compose.production.yaml'
export HOSTNAME=\$HOSTNAME
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The same environment variable exports are duplicated in three locations. Consider extracting these to a variable or function to reduce code duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
echo -n '✓ restarting ... '
ssh ${host}.us.archive.org "
export COMPOSE_FILE='/opt/openlibrary/compose.yaml:/opt/openlibrary/compose.production.yaml'
export HOSTNAME=\$HOSTNAME
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The same environment variable exports are duplicated in three locations. Consider extracting these to a variable or function to reduce code duplication and improve maintainability.

Suggested change
export HOSTNAME=\$HOSTNAME
${COMMON_EXPORTS};

Copilot uses AI. Check for mistakes.
@mekarpeles mekarpeles merged commit 4e42cd1 into internetarchive:master Aug 21, 2025
4 checks passed
@cdrini cdrini deleted the feature/patchdeploy-reset branch August 21, 2025 20:59
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