Skip to content

modules/software: add hedgedoc support#718

Open
efectn wants to merge 1 commit intoarmbian:mainfrom
efectn-forks:support-hedgedoc
Open

modules/software: add hedgedoc support#718
efectn wants to merge 1 commit intoarmbian:mainfrom
efectn-forks:support-hedgedoc

Conversation

@efectn
Copy link
Member

@efectn efectn commented Jan 20, 2026

Description

Add support for Hedgedoc using PostgreSQL.

Issue reference:
Related documentation:

Implementation Details

Provide a detailed description of the implementation. Include the following:

  • Key changes introduced by this PR
  • Justification for the changes
  • Confirmation that no new external dependencies or modules have been introduced

Documentation Summary

  • Metadata Included:
    Did you include the metadata (associative arrays) in the code? Ensure that metadata for modules, jobs, and runtime has been updated appropriately.

  • Document Generated:
    Did you generate the updated documentation using armbian-configng --doc? Confirm if the command was run to update README.md and provide any relevant details.

Testing Procedure

Describe the tests you ran to verify your changes. Provide relevant details about your test configuration.

  • Test 1: Description and results
  • Test 2: Description and results

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have ensured that my changes do not introduce new warnings or errors
  • No new external dependencies are included
  • Changes have been tested and verified
  • I have included necessary metadata in the code, including associative arrays

@github-actions github-actions bot added 02 Milestone: First quarter release size/medium PR with more then 50 and less then 250 lines labels Jan 20, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

Walkthrough

This PR introduces HedgeDoc support to the configuration system by adding three new menu entries (HDOC01, HDOC02, HDOC03) in the JSON configuration file for install, remove, and purge operations under WebHosting, along with a corresponding shell module that implements the complete lifecycle management for HedgeDoc deployments via Docker with PostgreSQL backend integration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

05, size/large, Work in progress

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'modules/software: add hedgedoc support' clearly and concisely summarizes the main change: adding HedgeDoc support to the software modules.
Description check ✅ Passed The description is related to the changeset, mentioning HedgeDoc and PostgreSQL support, though it is incomplete with unchecked implementation details, untested changes, and placeholder sections.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@tools/modules/software/module_hedgedoc.sh`:
- Line 46: Line "            # Install postgres if not installed" uses spaces
for indentation; replace the leading spaces with a single tab character so the
comment aligns with the surrounding tab-indented blocks (match the indentation
style used by nearby lines in this file), e.g., update the line containing "#
Install postgres if not installed" to start with a tab instead of spaces.
- Around line 37-39: The snippet uses exit 0 inside the module_hedgedoc check
which will terminate the entire shell instead of just ending the function;
change the behavior to return 0 from the function when HedgeDoc is already
running. Locate the conditional that reads "if module_hedgedoc status; then exit
0 fi" and replace the exit call with a return 0 so only the current function
returns successfully and the caller script continues.
🧹 Nitpick comments (4)
tools/modules/software/module_hedgedoc.sh (4)

18-19: Unused variable condition.

The variable condition is assigned but never referenced anywhere in the function. Consider removing it to avoid confusion.

🔧 Suggested fix
 function module_hedgedoc () {
 	local title="hedgedoc"
-	local condition=$(which "$title" 2>/dev/null)

54-54: Declare session_secret as local.

The variable session_secret is not declared with local, which means it will leak into the outer scope. Other similar variables like DATABASE_PASSWORD are properly declared as local.

🔧 Suggested fix
-			session_secret=$(openssl rand -hex 32)
+			local session_secret=$(openssl rand -hex 32)

70-80: Readiness check only verifies container is running, not application health.

The loop checks State.Running but HedgeDoc might still be initializing (database migrations, etc.). Consider checking for the health status or verifying the HTTP endpoint is responsive for more reliable startup detection.


69-69: Pin HedgeDoc image to a specific version instead of using :latest.

Using :latest can lead to unexpected behavior when the upstream image is updated. Pin to a specific stable version (currently 1.10.5) for reproducibility, similar to PostgreSQL on line 48 which uses postgres:16-alpine.

Comment on lines +37 to +39
if module_hedgedoc status; then
exit 0
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Using exit 0 instead of return 0 will terminate the calling script.

When HedgeDoc is already running, exit 0 terminates the entire shell process rather than just returning from the function. This could cause unexpected behavior if the function is called as part of a larger script.

🐛 Proposed fix
 		# Exit if hedgedoc is already running
 		if module_hedgedoc status; then
-			exit 0
+			return 0
 		fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if module_hedgedoc status; then
exit 0
fi
# Exit if hedgedoc is already running
if module_hedgedoc status; then
return 0
fi
🤖 Prompt for AI Agents
In `@tools/modules/software/module_hedgedoc.sh` around lines 37 - 39, The snippet
uses exit 0 inside the module_hedgedoc check which will terminate the entire
shell instead of just ending the function; change the behavior to return 0 from
the function when HedgeDoc is already running. Locate the conditional that reads
"if module_hedgedoc status; then exit 0 fi" and replace the exit call with a
return 0 so only the current function returns successfully and the caller script
continues.

local DATABASE_NAME="hedgedoc"
local DATABASE_PASSWORD=$(openssl rand -hex 8)

# Install postgres if not installed
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix indentation: spaces instead of tabs.

The pipeline failure indicates that line 46 uses spaces for indentation instead of tabs, which violates the project's editorconfig rules.

🔧 Suggested fix

Replace the leading spaces with tabs on line 46 to match the rest of the file.

🧰 Tools
🪛 GitHub Actions: Maintenance: Check coding style

[error] 46-46: editorconfig-checker: Wrong indentation type (spaces instead of tabs) at line 46.

🤖 Prompt for AI Agents
In `@tools/modules/software/module_hedgedoc.sh` at line 46, Line "            #
Install postgres if not installed" uses spaces for indentation; replace the
leading spaces with a single tab character so the comment aligns with the
surrounding tab-indented blocks (match the indentation style used by nearby
lines in this file), e.g., update the line containing "# Install postgres if not
installed" to start with a tab instead of spaces.

@igorpecovnik igorpecovnik mentioned this pull request Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

02 Milestone: First quarter release size/medium PR with more then 50 and less then 250 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants