Install v4 and upgrade#1149
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughInstall script now removes stale ondrej/php apt entries, dynamically selects and installs a PHP version and extensions, retargets php-fpm to user vito, adjusts deployment ordering, and installs Composer/redis. Upgrade script tightens execution, prepares a clean repo, safely injects nginx /ws/ with backup/rollback, starts websocket supervisor, and switches to 4.x running update.sh. ChangesDynamic PHP Installation
3.x→4.x Upgrade Process Hardening
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/install.sh (1)
124-124: 💤 Low valueDeclare and assign separately to avoid masking return values.
If the pipeline fails, the non-zero exit status is masked by
export. Split declaration from assignment to preserve the exit status for debugging.🔧 Suggested fix
- export V_PHP_VERSION=$(apt-cache search --names-only '^php[0-9]+\.[0-9]+-fpm$' | grep -oE '^php[0-9]+\.[0-9]+-fpm' | grep -oE '[0-9]+\.[0-9]+' | sort -V | tail -n 1) + V_PHP_VERSION=$(apt-cache search --names-only '^php[0-9]+\.[0-9]+-fpm$' | grep -oE '^php[0-9]+\.[0-9]+-fpm' | grep -oE '[0-9]+\.[0-9]+' | sort -V | tail -n 1) + export V_PHP_VERSION🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/install.sh` at line 124, The current single-line use of export with command substitution masks the command's exit status; split the steps: run the pipeline that computes the PHP version into an assignment to V_PHP_VERSION (using the existing pipeline: apt-cache search ... | grep -oE ... | sort -V | tail -n 1), then check the command/result (e.g., test exit code or check for empty string) and handle failure (log and exit non-zero) before exporting V_PHP_VERSION; ensure you reference the same variable name V_PHP_VERSION so subsequent code uses the exported value.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/install.sh`:
- Line 136: Replace the non-functional "service php${V_PHP_VERSION}-fpm enable"
invocation in scripts/install.sh with a systemd-based call; specifically locate
the occurrence of the string "service php${V_PHP_VERSION}-fpm enable" and change
it to use "systemctl enable" (or "systemctl enable --now" if you want to enable
and start the unit immediately) for the php${V_PHP_VERSION}-fpm unit so the
service is properly enabled under systemd.
---
Nitpick comments:
In `@scripts/install.sh`:
- Line 124: The current single-line use of export with command substitution
masks the command's exit status; split the steps: run the pipeline that computes
the PHP version into an assignment to V_PHP_VERSION (using the existing
pipeline: apt-cache search ... | grep -oE ... | sort -V | tail -n 1), then check
the command/result (e.g., test exit code or check for empty string) and handle
failure (log and exit non-zero) before exporting V_PHP_VERSION; ensure you
reference the same variable name V_PHP_VERSION so subsequent code uses the
exported value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bfd1d4c8-4099-4bb3-8c43-ce879b6ac663
📒 Files selected for processing (2)
scripts/install.shscripts/upgrade-3x-to-4x.sh
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/install.sh (1)
117-125:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDon’t treat probe failures as “codename unsupported.”
A transient DNS/TLS/network failure at Line 117 currently takes the same path as a real missing Release file, so the installer can silently fall back to distro PHP on releases where the rest of the repo still expects ondrej/php + 8.4. That turns a temporary outage into a different runtime selection.
🐛 Proposed fix
-if curl -fsSL "https://ppa.launchpadcontent.net/ondrej/php/ubuntu/dists/${V_DISTRO_CODENAME}/Release" -o /dev/null; then +V_ONDREJ_RELEASE_URL="https://ppa.launchpadcontent.net/ondrej/php/ubuntu/dists/${V_DISTRO_CODENAME}/Release" +V_ONDREJ_RELEASE_STATUS="$(curl -sS -o /dev/null -w '%{http_code}' --retry 3 "${V_ONDREJ_RELEASE_URL}" || true)" + +if [[ "${V_ONDREJ_RELEASE_STATUS}" == "200" ]]; then export V_PHP_VERSION="8.4" add-apt-repository ppa:ondrej/php -y apt update -else +elif [[ "${V_ONDREJ_RELEASE_STATUS}" == "404" ]]; then echo "ondrej/php has no packages for '${V_DISTRO_CODENAME}'; using the distribution's PHP." apt update V_PHP_VERSION=$(apt-cache search --names-only '^php[0-9]+\.[0-9]+-fpm$' | grep -oE '^php[0-9]+\.[0-9]+-fpm' | grep -oE '[0-9]+\.[0-9]+' | sort -V | tail -n 1) export V_PHP_VERSION +else + echo "Error: failed to probe ondrej/php for '${V_DISTRO_CODENAME}' (HTTP ${V_ONDREJ_RELEASE_STATUS:-connection error})." && exit 1 fi🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/install.sh` around lines 117 - 125, The current single curl probe for ondrej/php using V_DISTRO_CODENAME can treat transient network/DNS/TLS failures as "unsupported"; replace that probe with a small retry-and-verify check: run curl in a loop (e.g., 3 attempts with short backoff) using curl -sS -o /dev/null -w '%{http_code}' (or --head -I) to ensure you get an HTTP 200 before deciding the PPA exists; only when all retries complete with a non-200 result should you fall back to computing V_PHP_VERSION from apt. Update the conditional that currently uses curl -fsSL ... to use this retry+status-check logic and keep exporting V_PHP_VERSION and calling add-apt-repository/apt update in the success path, preserving variable names V_DISTRO_CODENAME and V_PHP_VERSION.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@scripts/install.sh`:
- Around line 117-125: The current single curl probe for ondrej/php using
V_DISTRO_CODENAME can treat transient network/DNS/TLS failures as "unsupported";
replace that probe with a small retry-and-verify check: run curl in a loop
(e.g., 3 attempts with short backoff) using curl -sS -o /dev/null -w
'%{http_code}' (or --head -I) to ensure you get an HTTP 200 before deciding the
PPA exists; only when all retries complete with a non-200 result should you fall
back to computing V_PHP_VERSION from apt. Update the conditional that currently
uses curl -fsSL ... to use this retry+status-check logic and keep exporting
V_PHP_VERSION and calling add-apt-repository/apt update in the success path,
preserving variable names V_DISTRO_CODENAME and V_PHP_VERSION.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 74ac68e4-76a5-48e3-96a0-002c1cb715b2
📒 Files selected for processing (1)
scripts/install.sh
| # releases may not be published there yet, so fall back to the distribution's own PHP | ||
| # (e.g. Ubuntu 26.04 ships PHP 8.5, which Vito also supports). | ||
| if curl -fsSL "https://ppa.launchpadcontent.net/ondrej/php/ubuntu/dists/${V_DISTRO_CODENAME}/Release" -o /dev/null; then | ||
| export V_PHP_VERSION="8.4" |
There was a problem hiding this comment.
Wrong comment. PHP 8.4 is the right one
Summary by CodeRabbit
New Features
Bug Fixes
Chores