Skip to content

fix: install Runtipi in /opt instead of default location#19

Merged
Mouette03 merged 3 commits into
mainfrom
Fix-install-opt
Jun 11, 2026
Merged

fix: install Runtipi in /opt instead of default location#19
Mouette03 merged 3 commits into
mainfrom
Fix-install-opt

Conversation

@Mouette03

@Mouette03 Mouette03 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Context

Runtipi was being installed in the default directory used by its install
script. This PR explicitly sets /opt as the working directory, which is
the standard Linux convention for third-party software.

Changes

  • Set cwd="/opt" on the Popen call that runs the Runtipi install script

Summary by CodeRabbit

  • Corrections de bugs

    • Amélioration de la fiabilité du processus d'installation système pour garantir une exécution correcte.
  • Chores

    • Optimisations mineures du script de configuration pour renforcer la stabilité globale.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Le script d'installation système setup.py corrige deux aspects critiques du démarrage et de l'exécution. Le shebang est purifié en supprimant le caractère BOM, et le processus bash lancé par install_runtipi() exécute désormais explicitement dans le répertoire /opt via le paramètre cwd.

Changes

Corrections du script d'installation système

Couche / Fichiers Résumé
Corrections du shebang et du contexte d'exécution
stage-tipi/01-config/files/app/setup.py
Le shebang #!/usr/bin/env python3 est débarrassé de son caractère BOM pour une reconnaissance correcte. Le subprocess.Popen qui lance le script bash dans install_runtipi() reçoit désormais un répertoire de travail explicite via cwd="/opt".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

Un petit BOM parti au loin,
Le shebang brille maintenant, loin du soin,
Et bash se tourne vers /opt sans détour,
L'installation suit son chemin d'or,
Plus de pièges, que du court ! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Le titre décrit fidèlement le changement principal : modifier le répertoire d'installation de Runtipi vers /opt au lieu de l'emplacement par défaut.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Fix-install-opt

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
stage-tipi/01-config/files/app/setup.py (1)

384-397: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Risque de fuite de processus si le cwd="/opt" échoue (ordre de lancement).

À la Line 384, curl est lancé avant la création du process bash (Line 389). Si Popen(..., cwd="/opt") échoue à la Line 396 (répertoire absent/inaccessible), curl n’est ni terminé ni attendu dans ce chemin d’erreur, ce qui peut laisser des processus orphelins pendant les retries.

💡 Correctif proposé
 def install_runtipi(max_attempts: int = 3) -> bool:
     step(T["runtipi_step"])
     for attempt in range(1, max_attempts + 1):
         if attempt > 1:
             out(T["runtipi_retry"].format(attempt=attempt, total=max_attempts))
             time.sleep(30)
+        curl = None
         try:
+            if not os.path.isdir("/opt"):
+                err(T["runtipi_err"].format(e="Le répertoire /opt est introuvable"))
+                continue
             curl = subprocess.Popen(
                 ["curl", "-L", "--max-time", "120", "https://setup.runtipi.io"],
                 stdout=subprocess.PIPE,
                 stderr=subprocess.PIPE,
             )
             bash = subprocess.Popen(
                 ["bash"],
                 stdin=curl.stdout,
                 stdout=subprocess.PIPE,
                 stderr=subprocess.STDOUT,
                 text=True,
                 bufsize=1,
                 cwd="/opt",
             )
             curl.stdout.close()
@@
         except Exception as e:
             err(T["runtipi_err"].format(e=e))
+            if curl and curl.poll() is None:
+                curl.terminate()
+                curl.wait(timeout=5)
🤖 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 `@stage-tipi/01-config/files/app/setup.py` around lines 384 - 397, The current
sequence launches curl then attempts to spawn bash with cwd="/opt", which can
raise and leave curl orphaned; wrap the creation of the bash Popen in a
try/except so that if Popen(["bash"], ..., cwd="/opt") fails you immediately
terminate and wait on the previously-started curl (call curl.kill() and
curl.wait()), or alternatively pre-validate/create/access-check the cwd
(os.path.isdir and permissions) before starting either process; reference the
variables curl and bash and the Popen calls so the fix ensures no orphaned curl
processes remain on errors.
🤖 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 `@stage-tipi/01-config/files/app/setup.py`:
- Around line 384-397: The current sequence launches curl then attempts to spawn
bash with cwd="/opt", which can raise and leave curl orphaned; wrap the creation
of the bash Popen in a try/except so that if Popen(["bash"], ..., cwd="/opt")
fails you immediately terminate and wait on the previously-started curl (call
curl.kill() and curl.wait()), or alternatively pre-validate/create/access-check
the cwd (os.path.isdir and permissions) before starting either process;
reference the variables curl and bash and the Popen calls so the fix ensures no
orphaned curl processes remain on errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6cf30413-23da-4cdf-befe-4a4d717cec9e

📥 Commits

Reviewing files that changed from the base of the PR and between 24a2712 and 91ef6c2.

📒 Files selected for processing (1)
  • stage-tipi/01-config/files/app/setup.py

@Mouette03 Mouette03 merged commit c68b435 into main Jun 11, 2026
2 checks passed
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.

1 participant