-
-
Notifications
You must be signed in to change notification settings - Fork 59
Support hedgedoc #741
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
Open
igorpecovnik
wants to merge
5
commits into
main
Choose a base branch
from
support-hedgedoc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Support hedgedoc #741
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
175bf41
modules/software: add hedgedoc support
efectn 53b9b05
Merge branch 'main' into support-hedgedoc
igorpecovnik 276439b
Refactor and improve Hedgedocs
igorpecovnik e77cb58
Merge branch 'main' into support-hedgedoc
igorpecovnik d532756
refactor: improve HedgeDoc module with modern patterns
igorpecovnik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ENABLED=true | ||
| RELEASE="noble" | ||
| TESTNAME="HedgeDoc install" | ||
|
|
||
| testcase() {( | ||
| ./bin/armbian-config --api module_hedgedoc purge | ||
| ./bin/armbian-config --api module_hedgedoc install | ||
| ./bin/armbian-config --api module_hedgedoc status | ||
| )} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| === "Access to the web interface" | ||
|
|
||
| The web interface is accessible via port **3100**: | ||
|
|
||
| - URL: `https://<your.IP>:3100` | ||
|
|
||
| === "Directories" | ||
|
|
||
| - Install directory: `/armbian/hedgedoc` | ||
|
|
||
| === "View logs" | ||
|
|
||
| ```sh | ||
| docker logs -f hedgedoc | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| HedgeDoc is a powerful, locally hosted web-based collaborative Markdown editor. It allows you to create, edit, and share documents in real time, supporting teamwork with live collaboration, version history, and easy publishing. This self-hosted application provides a flexible and secure environment for writing notes, documentation, and knowledge bases, offering a complete solution for collaborative text editing and documentation management. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| module_options+=( | ||
| ["module_hedgedoc,author"]="@armbian" | ||
| ["module_hedgedoc,maintainer"]="@efectn" | ||
| ["module_hedgedoc,feature"]="module_hedgedoc" | ||
| ["module_hedgedoc,example"]="install remove purge status help" | ||
| ["module_hedgedoc,desc"]="Install HedgeDoc container (real-time collaborative markdown editor)" | ||
| ["module_hedgedoc,status"]="Active" | ||
| ["module_hedgedoc,doc_link"]="https://docs.hedgedoc.org/" | ||
| ["module_hedgedoc,group"]="WebHosting" | ||
| ["module_hedgedoc,port"]="3100" | ||
| ["module_hedgedoc,arch"]="x86-64 arm64" | ||
| ["module_hedgedoc,dockerimage"]="quay.io/hedgedoc/hedgedoc:latest" | ||
| ["module_hedgedoc,dockername"]="hedgedoc" | ||
| ) | ||
|
|
||
| # | ||
| # Module hedgedoc | ||
| # | ||
| function module_hedgedoc () { | ||
| local title="HedgeDoc" | ||
| local dockerimage="${module_options["module_hedgedoc,dockerimage"]}" | ||
| local dockername="${module_options["module_hedgedoc,dockername"]}" | ||
| local port="${module_options["module_hedgedoc,port"]}" | ||
| local DATABASE_HOST="hedgedoc-db" | ||
|
|
||
| local commands | ||
| IFS=' ' read -r -a commands <<< "${module_options["module_hedgedoc,example"]}" | ||
|
|
||
| local base_dir="${SOFTWARE_FOLDER}/$dockername" | ||
| local DOMAIN="${2:-$LOCALIPADD}" | ||
| local USE_SSL="${3:-false}" | ||
|
|
||
| case "$1" in | ||
| "${commands[0]}") # install | ||
| # Check if already installed | ||
| if docker_is_installed "$dockername" "$dockerimage"; then | ||
| return 0 | ||
| fi | ||
|
|
||
| # Database configuration | ||
| local DATABASE_USER="hedgedoc" | ||
| local DATABASE_NAME="hedgedoc" | ||
| local DATABASE_IMAGE="postgres" | ||
| local DATABASE_TAG="16-alpine" | ||
| local DATABASE_PASSWORD | ||
| local session_secret | ||
|
|
||
| # Generate secure passwords and secrets | ||
| DATABASE_PASSWORD=$(openssl rand -hex 16) | ||
| session_secret=$(openssl rand -hex 32) | ||
|
|
||
| # Create base directory | ||
| docker_manage_base_dir create "$base_dir" || return 1 | ||
| mkdir -p "${base_dir}/uploads" | ||
|
|
||
| # Remove existing PostgreSQL container if present to ensure fresh installation | ||
| if docker container ls -a --format '{{.Names}}' | grep -q "^${DATABASE_HOST}$"; then | ||
| dialog_msgbox "Existing Database" \ | ||
| "Removing existing PostgreSQL container to ensure clean installation." 6 60 | ||
| module_postgres purge "" "" "" "" "" "$DATABASE_HOST" | ||
| fi | ||
|
|
||
| # Install PostgreSQL | ||
| module_postgres install "$DATABASE_USER" "$DATABASE_PASSWORD" "$DATABASE_NAME" \ | ||
| "$DATABASE_IMAGE" "$DATABASE_TAG" "$DATABASE_HOST" | ||
|
|
||
| # Wait for PostgreSQL to be ready with progress | ||
| local max_wait=30 | ||
| local wait_count=0 | ||
| ( | ||
| while [[ $wait_count -lt $max_wait ]]; do | ||
| if docker exec "$DATABASE_HOST" psql -U "$DATABASE_USER" -d "postgres" -c '\q' &>/dev/null; then | ||
| echo "XXX"; echo "100"; echo "PostgreSQL is ready!"; echo "XXX" | ||
| exit 0 | ||
| fi | ||
| echo "XXX"; echo "$((wait_count * 100 / max_wait))"; \ | ||
| echo "Waiting for PostgreSQL to be ready..."; echo "XXX" | ||
| sleep 2 | ||
| ((wait_count++)) | ||
| done | ||
| echo "XXX"; echo "0"; echo "PostgreSQL ready timeout"; echo "XXX" | ||
| exit 1 | ||
| ) | dialog_gauge "$title" "Waiting for PostgreSQL..." 8 60 | ||
|
|
||
| # Create database - drop if exists to ensure clean installation | ||
| if docker exec "$DATABASE_HOST" psql -U "$DATABASE_USER" -d "postgres" -tAc "SELECT 1 FROM pg_database WHERE datname='$DATABASE_NAME';" 2>/dev/null | grep -q 1; then | ||
| # Database exists, drop it to ensure clean installation | ||
| docker exec "$DATABASE_HOST" psql -U "$DATABASE_USER" -d "postgres" <<-EOT | ||
| DROP DATABASE $DATABASE_NAME; | ||
| EOT | ||
| fi | ||
|
|
||
| # Create fresh database | ||
| docker exec "$DATABASE_HOST" psql -U "$DATABASE_USER" -d "postgres" <<-EOT | ||
| CREATE DATABASE $DATABASE_NAME; | ||
| GRANT ALL PRIVILEGES ON DATABASE $DATABASE_NAME TO $DATABASE_USER; | ||
| EOT | ||
|
|
||
| dialog_msgbox "Database Ready" \ | ||
| "Database '$DATABASE_NAME' is ready for use." 6 50 | ||
|
|
||
|
|
||
| # Pull HedgeDoc image with progress | ||
| docker_operation_progress pull "$dockerimage" | ||
|
|
||
| # Run HedgeDoc container | ||
| docker_operation_progress run "$dockername" \ | ||
| -d \ | ||
| --name "$dockername" \ | ||
| --net lsio \ | ||
| -e CMD_DB_URL="postgresql://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:5432/${DATABASE_NAME}" \ | ||
| -e CMD_DOMAIN="${DOMAIN}" \ | ||
| -e CMD_PROTOCOL_USESSL="${USE_SSL}" \ | ||
| -e CMD_SESSION_SECRET="${session_secret}" \ | ||
| -e CMD_ALLOW_ANONYMOUS=true \ | ||
| -e CMD_URL_ADDPORT=false \ | ||
| -e CMD_ALLOW_EMAIL_REGISTER=true \ | ||
| -p "${port}:3000" \ | ||
| -v "${base_dir}/uploads:/hedgedoc/public/uploads" \ | ||
| --restart unless-stopped \ | ||
| "$dockerimage" | ||
|
|
||
| # Wait for container to be ready | ||
| wait_for_container_ready "$dockername" 30 3 "running" | ||
| ;; | ||
| "${commands[1]}") # remove | ||
| # Remove container and image | ||
| docker_operation_progress rm "$dockername" | ||
| docker_operation_progress rmi "$dockerimage" | ||
| ;; | ||
| "${commands[2]}") # purge | ||
| # Remove container and image first | ||
| if ! ${module_options["module_hedgedoc,feature"]} ${commands[1]}; then | ||
| return 1 | ||
| fi | ||
| # Purge PostgreSQL database | ||
| module_postgres purge "" "" "" "" "" "$DATABASE_HOST" | ||
| # Remove data directory | ||
| docker_manage_base_dir remove "$base_dir" | ||
| ;; | ||
| "${commands[3]}") # status | ||
| # Return 0 if installed, 1 if not (used by menu system) | ||
| docker_is_installed "$dockername" "$dockerimage" | ||
| ;; | ||
| "${commands[4]}") # help | ||
| show_module_help "module_hedgedoc" "$title" \ | ||
| "Docker Image: $dockerimage\nPort: $port\nDatabase: PostgreSQL" | ||
| ;; | ||
| *) | ||
| ${module_options["module_hedgedoc,feature"]} ${commands[4]} | ||
| ;; | ||
| esac | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocol mismatch: documentation shows
httpsbut default ishttp.The URL template uses
https://but the module defaultsUSE_SSLtofalse. Users following this documentation will get connection errors.📝 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents