Skip to content

Startup script#70

Merged
LinusWestling merged 4 commits into
mainfrom
issue/69
Apr 21, 2026
Merged

Startup script#70
LinusWestling merged 4 commits into
mainfrom
issue/69

Conversation

@LinusWestling

@LinusWestling LinusWestling commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Closes #69

Summary by CodeRabbit

  • Documentation
    • Added comprehensive setup guide with prerequisites, step-by-step startup instructions, demo credentials, and troubleshooting for common issues.
    • Added startup script to automate local environment initialization with configurable options for Docker validation and startup mode.

@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@LinusWestling has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 18 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 8 minutes and 18 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5d037f0-2ab8-4bf4-b2e2-f7b70fb5f7bf

📥 Commits

Reviewing files that changed from the base of the PR and between 73480f0 and cc7323b.

📒 Files selected for processing (2)
  • README.md
  • start-local.ps1
📝 Walkthrough

Walkthrough

Added comprehensive documentation and a PowerShell automation script for local development setup. The README documents a Spring Boot case management application with infrastructure requirements, startup procedures, default credentials, and troubleshooting guidance. The accompanying script automates Docker validation and service orchestration for rapid local environment initialization.

Changes

Cohort / File(s) Summary
Documentation & Local Setup
README.md, start-local.ps1
New README documenting Spring Boot case management app architecture, prerequisites, and local startup flow via Windows PowerShell script. Script automates Docker validation with retry logic, infrastructure startup via Docker Compose, Spring Boot launch with local profile, and includes helper functions for output control and browser navigation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A script to hop and Docker to dance,
Setup scripts grant the dev a swift glance!
README laid bare, credentials made clear,
Local environments bloom without fear—
Spring Boot springs forth with compose in hand! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Startup script' is overly vague and generic. While it references a real part of the changeset (the new start-local.ps1 script), it fails to convey the specific purpose or context of the startup automation. Consider a more descriptive title that clarifies the purpose, such as 'Add PowerShell startup script for local development environment' or 'Add local dev environment startup automation with Docker and Spring Boot'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/69

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.

Actionable comments posted: 4

🧹 Nitpick comments (4)
start-local.ps1 (3)

12-18: Minor: PSScriptAnalyzer naming suggestions.

Static analysis flags:

  • Assert-CommandExists — plural noun (PSUseSingularNouns); prefer Assert-CommandExistence or simply Assert-Command.
  • Pause-ForEnjoyment (Line 56) — Pause is not on the approved verbs list (PSUseApprovedVerbs); Wait-ForEnjoyment would satisfy the rule.

Optional cleanup, not a blocker for a local dev script.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@start-local.ps1` around lines 12 - 18, Rename the non-conforming cmdlet names
to follow PSScriptAnalyzer rules: change Assert-CommandExists to a
singular-noun/approved-verb form such as Assert-CommandExistence or
Assert-Command, and change Pause-ForEnjoyment to use an approved verb like
Wait-ForEnjoyment; update every reference/call site to the new names (e.g.,
function definitions and any invocations) so the script continues to work and
PSScriptAnalyzer warnings are resolved.

144-156: Status banner is printed before Spring Boot is actually started.

Lines 144-155 announce "App URL", admin credentials, and "Opening browser..." before mvnw is invoked on Line 163. In quiet mode especially, the user sees these messages immediately and may assume the app is already up, when in fact Maven is still resolving dependencies. Consider moving the "Opening browser..." message into the background job (right before Start-Process) or at least clarifying that startup is still in progress.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@start-local.ps1` around lines 144 - 156, The status banner prints
startup-complete messages (e.g., "App URL", admin credentials, "Opening
browser...") before the Spring Boot start command (mvnw) runs; move or adjust
those messages so they reflect actual startup progress. Specifically, relocate
the "Opening browser at http://localhost:8080 ..." and "Starting web browser..."
Write-Host lines into the background job block right before the Start-Process
call that launches the browser (or emit a new message like "Startup in progress
— opening browser when ready" if you must keep them earlier), and ensure the
quiet-mode notices inside the if (-not $Serious) block remain accurate about
logs being hidden while the app starts. This uses the existing
Pause-ForEnjoyment, mvnw invocation, and Start-Process contexts to gate the
browser/opening message until the background job actually starts the app.

8-10: Add comment explaining --serious workaround to prevent future breakage.

The workaround at lines 8-10 exists because PowerShell parameter binding doesn't natively support the -- prefix; --serious falls into $args instead of binding to the -Serious switch parameter. This works now, but becomes fragile if [CmdletBinding()] is added later (which changes how $args behaves).

Additionally, the README (line 24) and messages (lines 154, 166) advertise --serious as the command form, while idiomatic PowerShell uses -Serious.

Add a comment above lines 8-10 explaining the purpose of this $args check and note the dependency on the absence of [CmdletBinding()]. Alternatively, update the README and messages to document -Serious as the canonical form, though this is less critical than documenting the code intent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@start-local.ps1` around lines 8 - 10, Add a short comment above the $args
check that explains the "--serious" workaround: state that PowerShell's
parameter binding doesn't accept the "--" prefix so the script looks for
"--serious" in $args and sets $Serious=true, and note this relies on NOT having
[CmdletBinding()] (which changes $args behavior); also mention the preferred
idiomatic form is "-Serious" and recommend updating README/messages to advertise
"-Serious" if you want to be idiomatic.
README.md (1)

85-94: Consider noting that seeded credentials are for local development only.

The README documents a hardcoded admin password in plain text. While acceptable for a local profile seed, it's worth explicitly warning readers not to reuse these credentials or enable the local profile in any shared/production environment, to avoid accidental exposure.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 85 - 94, Add a clear warning to the README near the
"local" profile seed info (the block that references data-local.sql and the
seeded admin account admin@traumateam.com / password) stating these credentials
are for local development only and must not be reused in shared or production
environments; advise removing or changing the seed before exposing the
environment, and recommend using secure secrets management or
environment-specific overrides instead of the hardcoded password in
data-local.sql.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 133-136: The Markdown list indentation under the troubleshooting
section is inconsistent: the sub-list items describing how to map Docker
PostgreSQL use 4-space indentation while other list items use 2-space
indentation; update those sub-list lines (the steps referencing
docker-compose.yml ports and src/main/resources/application.properties database
URL and the "Run docker compose up -d again" step) to use 2-space indentation to
match the surrounding list so markdownlint MD005 no longer flags them.

In `@start-local.ps1`:
- Around line 158-163: The Start-Job that sleeps 8s and then calls Start-Process
should be replaced with a polling loop that repeatedly checks
http://localhost:8080 until it returns a healthy response or a timeout is
reached; implement the poll inside the background job created by Start-Job and
use Invoke-WebRequest/Invoke-RestMethod with a short interval and a configurable
timeout to decide readiness. Also ensure the job is stopped/cancelled if the
Maven run fails by checking $mavenExitCode from Invoke-CommandWithMode and
terminating the background job (Stop-Job / Remove-Job) when $mavenExitCode -ne 0
so Start-Process is never invoked for a failed build; locate and update the
Start-Job invocation and the $mavenExitCode handling to wire these behaviors
together.
- Around line 163-167: The current code unconditionally throws when
Invoke-CommandWithMode returns a non-zero $mavenExitCode, which treats a user
Ctrl+C as a startup failure; change the logic around the $mavenExitCode check so
interactive cancellation is handled separately: after calling
Invoke-CommandWithMode (the call that sets $mavenExitCode), if $mavenExitCode is
non-zero, detect common cancellation exit codes (e.g., 130 or 1) and treat those
as user-initiated termination by writing a warning like "Spring Boot terminated
by user (Ctrl+C)" instead of throwing; for any other non-zero code include the
actual exit code in the error and then throw (or fail) with the existing
guidance about re-running with --serious; keep the $mavenExitCode,
Invoke-CommandWithMode and throw symbols to locate and modify the block.
- Around line 20-42: The quiet-mode currently discards both stdout and stderr in
Invoke-CommandWithMode (conditional on the $Serious flag), hiding failures;
change the behavior so non-serious runs either preserve stderr (e.g., redirect
only stdout to $null while leaving 2>&1 to console) or redirect both streams
into a temporary log file (create a temp path, run & $Command *> $tempLog or
similar), returning $LASTEXITCODE and on non-zero exit print a concise failure
header plus the last N lines of that temp log; update Invoke-CommandWithMode to
reference $Serious, $Command and the temp log logic and ensure the finally block
still restores $ErrorActionPreference.

---

Nitpick comments:
In `@README.md`:
- Around line 85-94: Add a clear warning to the README near the "local" profile
seed info (the block that references data-local.sql and the seeded admin account
admin@traumateam.com / password) stating these credentials are for local
development only and must not be reused in shared or production environments;
advise removing or changing the seed before exposing the environment, and
recommend using secure secrets management or environment-specific overrides
instead of the hardcoded password in data-local.sql.

In `@start-local.ps1`:
- Around line 12-18: Rename the non-conforming cmdlet names to follow
PSScriptAnalyzer rules: change Assert-CommandExists to a
singular-noun/approved-verb form such as Assert-CommandExistence or
Assert-Command, and change Pause-ForEnjoyment to use an approved verb like
Wait-ForEnjoyment; update every reference/call site to the new names (e.g.,
function definitions and any invocations) so the script continues to work and
PSScriptAnalyzer warnings are resolved.
- Around line 144-156: The status banner prints startup-complete messages (e.g.,
"App URL", admin credentials, "Opening browser...") before the Spring Boot start
command (mvnw) runs; move or adjust those messages so they reflect actual
startup progress. Specifically, relocate the "Opening browser at
http://localhost:8080 ..." and "Starting web browser..." Write-Host lines into
the background job block right before the Start-Process call that launches the
browser (or emit a new message like "Startup in progress — opening browser when
ready" if you must keep them earlier), and ensure the quiet-mode notices inside
the if (-not $Serious) block remain accurate about logs being hidden while the
app starts. This uses the existing Pause-ForEnjoyment, mvnw invocation, and
Start-Process contexts to gate the browser/opening message until the background
job actually starts the app.
- Around line 8-10: Add a short comment above the $args check that explains the
"--serious" workaround: state that PowerShell's parameter binding doesn't accept
the "--" prefix so the script looks for "--serious" in $args and sets
$Serious=true, and note this relies on NOT having [CmdletBinding()] (which
changes $args behavior); also mention the preferred idiomatic form is "-Serious"
and recommend updating README/messages to advertise "-Serious" if you want to be
idiomatic.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c0f1e31-66a3-44d1-a04e-8cf34cb1942c

📥 Commits

Reviewing files that changed from the base of the PR and between db08130 and 73480f0.

📒 Files selected for processing (2)
  • README.md
  • start-local.ps1

Comment thread README.md
Comment thread start-local.ps1
Comment thread start-local.ps1 Outdated
Comment thread start-local.ps1
@LinusWestling
LinusWestling merged commit 46b18db into main Apr 21, 2026
1 check passed
@LinusWestling
LinusWestling deleted the issue/69 branch April 21, 2026 12:35
@coderabbitai coderabbitai Bot mentioned this pull request Apr 21, 2026
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.

Script för att slippa köra alla kommandon för att starta applikationen. Behöver bara köra scriptet istället

1 participant