-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
v4.0.0-beta.392 #5060
v4.0.0-beta.392 #5060
Conversation
- Generate random encryption secret - Generate random web login password - Make TZ show up in the UI
- fix(ui): system-wide GitHub Apps are not shown in the create a new Application dialog - fix: query logic error that shows all system-wide apps, regardless of whether they are public or private. - fix: clicking on a system-wide GitHub app from a team other than the one that created it resulted in a 404 error.
Added grammatical correction to the documentation
Update README.md
fix: pull latest image from registry when using build server
- Add fallback for build server and deployment server selection - Use `ownedByCurrentTeam()` scope when finding servers - Handle cases where server IDs might be null
fix: several knowledge base links
@coderabbitai review |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis change set spans multiple areas of the application. The README and several view files have updated text and documentation links. Job classes now include an extra step to store the server’s private key and add a new Slack payload field. Query logic in the GithubApp, Team, and S3Storage models was refined to incorporate fallback and team-based filters. Configuration templates and environment variables were updated, including version increments. Localization files in Arabic, French, and Italian received new entries for authentication and warning messages, and an obsolete S3 helper file was removed. Changes
Sequence Diagram(s)sequenceDiagram
participant Job as ApplicationDeploymentJob
participant Server as Server (PrivateKey)
participant Deploy as Deployment Process
Job->>Server: privateKey->storeInFileSystem()
Server-->>Job: Key stored confirmation
Job->>Deploy: Proceed with deployment
sequenceDiagram
participant Job as SendMessageToSlackJob
participant Slack as Slack Webhook
Job->>Slack: POST payload with 'text' = message title
Slack-->>Job: Acknowledge receipt
Suggested labels
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (10)
app/Models/S3Storage.php (1)
66-73
: Handle potential null team edge case.
$team = $this->team()->with([...])->first();
could theoretically returnnull
. Accessing$team->members()
on anull
object will throw an error. Consider a defensive check for$team === null
before calling$team->members()
.try { ... } catch (\Throwable $e) { $this->is_usable = false; if ($this->unusable_email_sent === false && is_transactional_emails_enabled()) { ... + if (!$team) { + // Optionally log or handle the missing team scenario. + } else { $users = $team->members()->wherePivotIn('role', ['admin', 'owner'])->get(['users.id', 'users.email']); foreach ($users as $user) { send_user_an_email($mail, $user->email); } } $this->unusable_email_sent = true; } ... }app/Jobs/SendMessageToSlackJob.php (1)
27-27
: Ensure Slack fallback text is necessary.Including
'text' => $this->message->title
is useful as a fallback for older Slack clients or message previews, but note that this replicates the same text in'blocks'
. If duplication is intentional, it’s fine. Otherwise, consider customizing the'text'
field to provide additional or alternative details.app/Models/GithubApp.php (2)
36-39
: Consolidate repeated query logic.You're filtering by
('team_id', currentTeam()->id)
or'is_system_wide', true
in multiple places. Consider extracting a reusable local scope or method to reduce duplication and improve maintainability.-public static function ownedByCurrentTeam() -{ - return GithubApp::where(function ($query) { - $query->where('team_id', currentTeam()->id) - ->orWhere('is_system_wide', true); - }); +public static function scopeTeamOrSystemWide($query) +{ + return $query->where(function ($q) { + $q->where('team_id', currentTeam()->id) + ->orWhere('is_system_wide', true); + }); } public static function ownedByCurrentTeam() { - return GithubApp::where(function ($query) { - $query->where('team_id', currentTeam()->id) - ->orWhere('is_system_wide', true); - }); + return GithubApp::teamOrSystemWide(); }
54-59
: Double-check is_public usage.This query pattern for selecting private GitHub apps parallels the public logic, but make sure your concept of “private” is strictly
is_public == false
. If there's a scenario like “internal” you’d like to capture differently, consider elaborating or renaming the scope for clarity.Do you want me to open a new issue to extend the logic for additional GitHub app states?
app/Jobs/ApplicationDeploymentJob.php (1)
256-258
: LGTM! Consider adding error handling for missing private key.The addition ensures that the server's private key is stored in the filesystem before proceeding with deployment, which is a good practice. However, consider adding explicit error handling for cases where the private key might not be set.
// Make sure the private key is stored in the filesystem -$this->server->privateKey->storeInFileSystem(); +if (!$this->server->privateKey) { + throw new RuntimeException('Server private key is not set.'); +} +$this->server->privateKey->storeInFileSystem();templates/compose/beszel.yaml (1)
23-23
: LGTM! Consider improving documentation.The change correctly enables dynamic key configuration. However, the comment on line 8 could be more specific about the required format and source of the public key.
Consider updating the comment to be more descriptive:
-# Add the public Key in "Key" env variable below +# Add the beszel public key in the KEY environment variable. Generate this key using `beszel generate-key` command.templates/compose/getoutline.yaml (1)
66-74
: Consider adding default values and validation for SMTP configuration.The SMTP configuration lacks default values and validation, which could lead to runtime issues if variables are not set.
Consider adding default values and validation:
- - SMTP_HOST=${SMTP_HOST} - - SMTP_PORT=${SMTP_PORT} - - SMTP_USERNAME=${SMTP_USERNAME} - - SMTP_PASSWORD=${SMTP_PASSWORD} - - SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL} - - SMTP_REPLY_EMAIL=${SMTP_REPLY_EMAIL} - - SMTP_TLS_CIPHERS=${SMTP_TLS_CIPHERS} - - SMTP_SECURE=${SMTP_SECURE} - - SMTP_NAME=${SMTP_NAME} + - SMTP_HOST=${SMTP_HOST:-smtp.example.com} + - SMTP_PORT=${SMTP_PORT:-587} + - SMTP_USERNAME=${SMTP_USERNAME:-} + - SMTP_PASSWORD=${SMTP_PASSWORD:-} + - SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL:[email protected]} + - SMTP_REPLY_EMAIL=${SMTP_REPLY_EMAIL:-${SMTP_FROM_EMAIL}} + - SMTP_TLS_CIPHERS=${SMTP_TLS_CIPHERS:-} + - SMTP_SECURE=${SMTP_SECURE:-true} + - SMTP_NAME=${SMTP_NAME:-Outline}templates/service-templates.json (3)
713-719
: Improve health check configuration and document volume persistence.
- The health check could be more robust by adding the
-f
flag to curl to handle HTTP errors and redirects.- The backup volume persistence should be documented.
Apply this diff to improve the health check:
test: - CMD - curl - - '-f' + - '-f' + - '-L' + - '--retry' + - '3' - 'http://127.0.0.1:8200'
1329-1335
: Consider removing '/latest/' from documentation URL.The documentation URL contains '/latest/' which might break when the documentation structure changes. Consider using a stable URL.
Additionally, the example service URLs in services.yaml use 'localhost' which might be confusing in a containerized environment.
- Update the documentation URL:
- "documentation": "https://gethomepage.dev/latest/?utm_source=coolify.io", + "documentation": "https://gethomepage.dev/?utm_source=coolify.io",
- Consider updating the example service URLs in the configuration to use container names or environment variables instead of 'localhost'.
178-184
:❓ Verification inconclusive
Review Docker socket access and document environment variables.
The beszel-agent service mounts the Docker socket with read-only access (
docker.sock:ro
). While this is a common pattern for monitoring containers, it still poses security risks as it allows the container to inspect all other containers.Additionally, the
KEY
environment variable should be documented in the service's documentation.Consider:
- Using Docker's built-in metrics endpoint instead of socket access
- Adding documentation about required environment variables
Run this script to check if the documentation mentions the KEY variable:
🏁 Script executed:
#!/bin/bash # Description: Check if KEY environment variable is documented curl -s "https://raw.githubusercontent.com/henrygd/beszel/master/README.md" | grep -i "key.*environment.*variable"Length of output: 114
Action Required: Verify Docker Socket Security and KEY Environment Variable Documentation
- The
beszel-agent
service mounts the Docker socket with read-only access, which—while common for monitoring purposes—can expose container internals and thus poses a potential security risk. Consider evaluating alternatives such as Docker's built-in metrics endpoint.- The
KEY
environment variable does not appear to be documented in the upstream README (as evidenced by the executed curl command returning no output). Please manually verify if this variable should be documented or if additional clarification is required.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (29)
README.md
(1 hunks)app/Jobs/ApplicationDeploymentJob.php
(2 hunks)app/Jobs/SendMessageToSlackJob.php
(1 hunks)app/Livewire/Project/Application/DeploymentNavbar.php
(1 hunks)app/Models/GithubApp.php
(1 hunks)app/Models/S3Storage.php
(2 hunks)app/Models/Team.php
(1 hunks)app/Notifications/Server/HighDiskUsage.php
(1 hunks)bootstrap/helpers/s3.php
(0 hunks)config/constants.php
(1 hunks)lang/ar.json
(2 hunks)lang/fr.json
(2 hunks)lang/it.json
(2 hunks)resources/views/components/status/running.blade.php
(1 hunks)resources/views/livewire/layout-popups.blade.php
(1 hunks)resources/views/livewire/project/application/deployment/show.blade.php
(1 hunks)resources/views/livewire/server/cloudflare-tunnels.blade.php
(1 hunks)resources/views/livewire/server/configure-cloudflare-tunnels.blade.php
(1 hunks)resources/views/livewire/storage/create.blade.php
(1 hunks)resources/views/livewire/storage/form.blade.php
(1 hunks)resources/views/livewire/subscription/pricing-plans.blade.php
(1 hunks)resources/views/livewire/team/index.blade.php
(1 hunks)templates/compose/beszel.yaml
(1 hunks)templates/compose/calcom.yaml
(1 hunks)templates/compose/duplicati.yaml
(1 hunks)templates/compose/getoutline.yaml
(1 hunks)templates/compose/homepage.yaml
(5 hunks)templates/service-templates.json
(5 hunks)versions.json
(1 hunks)
💤 Files with no reviewable changes (1)
- bootstrap/helpers/s3.php
✅ Files skipped from review due to trivial changes (13)
- resources/views/livewire/storage/form.blade.php
- resources/views/livewire/team/index.blade.php
- resources/views/livewire/storage/create.blade.php
- resources/views/livewire/server/configure-cloudflare-tunnels.blade.php
- resources/views/livewire/subscription/pricing-plans.blade.php
- config/constants.php
- templates/compose/homepage.yaml
- resources/views/components/status/running.blade.php
- resources/views/livewire/layout-popups.blade.php
- templates/compose/calcom.yaml
- resources/views/livewire/server/cloudflare-tunnels.blade.php
- versions.json
- README.md
🔇 Additional comments (18)
lang/ar.json (2)
3-3
: LGTM! Authentik login translation follows existing patterns.The Arabic translation for Authentik login is consistent with other login method translations in the file.
39-39
: LGTM! SSL warning translation with proper HTML formatting.The Arabic translation for the SSL domain warning maintains proper HTML tag usage for text highlighting, consistent with other entries in the file.
lang/it.json (3)
3-3
: LGTM! Authentik login translation follows existing patterns.The Italian translation for Authentik login is consistent with other login method translations in the file.
32-37
: LGTM! Resource management translations are well-structured.The Italian translations for resource management operations are clear and maintain consistency in terminology.
39-39
: LGTM! SSL warning translation with proper HTML formatting.The Italian translation for the SSL domain warning maintains proper HTML tag usage for text highlighting, consistent with other entries in the file.
lang/fr.json (2)
3-3
: LGTM! Authentik login translation follows existing patterns.The French translation for Authentik login is consistent with other login method translations in the file.
39-39
: LGTM! SSL warning translation with proper HTML formatting.The French translation for the SSL domain warning maintains proper HTML tag usage for text highlighting, consistent with other entries in the file.
app/Models/S3Storage.php (1)
46-57
: Use caution with static endpoint configuration.You have hardcoded
'use_path_style_endpoint' => true
, which works for certain S3-compatible backends (e.g., MinIO) but may cause unexpected issues with AWS if the endpoint is not configured accordingly. Consider making this configurable or documenting the requirement for path-style endpoints.app/Models/GithubApp.php (1)
44-49
: Validate existence of GitHub App ID.
->whereNotNull('app_id')->get()
ensures that only apps with a validapp_id
are retrieved. If non-GitHub items or partial data records exist, they’ll be excluded. Confirm this is intentional.app/Livewire/Project/Application/DeploymentNavbar.php (1)
56-63
: LGTM! Security improvements in server retrieval.The changes enhance security by:
- Adding proper fallback to application's destination server ID
- Ensuring server retrieval is filtered by current team ownership using
ownedByCurrentTeam()
app/Notifications/Server/HighDiskUsage.php (1)
83-83
: LGTM! Correct notification link update.The notification link has been correctly updated to point to Slack settings instead of Discord settings.
resources/views/livewire/project/application/deployment/show.blade.php (1)
111-120
: LGTM! Improved command display logic.The changes enhance the command display logic by:
- Using
isset()
for more accurate command key checks- Ensuring consistent command prefix display
app/Models/Team.php (1)
251-262
: LGTM! Enhanced query logic structure.The changes improve the query logic by:
- Properly grouping conditions using nested closures
- Ensuring correct evaluation order of conditions
- Making the logic consistent between github_apps and gitlab_apps queries
app/Jobs/ApplicationDeploymentJob.php (1)
2287-2287
:❓ Verification inconclusive
LGTM! Note the potential impact on deployment time.
Adding
--pull always
ensures the latest image is used, which is good for consistency. However, be aware that this will increase deployment time as it forces a pull operation on every deployment, even if the image hasn't changed.Consider verifying the impact on deployment time with:
🏁 Script executed:
#!/bin/bash # Description: Compare deployment times with and without --pull always # Test 1: Without --pull always time docker compose --project-name test --project-directory . up --build -d # Test 2: With --pull always time docker compose --project-name test --project-directory . up --pull always --build -dLength of output: 437
LGTM! The change ensuring that
--pull always
is included in the Docker compose command makes sense—it guarantees that the latest image version is used, which enhances consistency. However, be mindful that this will likely slow down deployments due to the additional image pull on every deployment. Since our automated test ran in an environment without Docker (resulting in "docker: command not found"), please manually verify the actual impact on deployment times in an environment where Docker is properly installed.templates/compose/duplicati.yaml (1)
14-16
: LGTM! Environment variables look good.The changes improve configuration flexibility by:
- Using a dynamic timezone with a fallback to 'Europe/London'
- Adding encryption key and web service password configuration
Please ensure that
SERVICE_PASSWORD_ENCRYPT
andSERVICE_PASSWORD_WEB
are properly secured and not exposed in logs or error messages.templates/compose/getoutline.yaml (1)
73-73
: Fix syntax error in SMTP_SECURE default value.There's a syntax error in the SMTP_SECURE environment variable. The variable should have a default value.
templates/service-templates.json (2)
285-289
: Documentation URL improvement.The updated documentation URL now points to a more specific introduction page, which will help users get started more efficiently.
1056-1062
: Well-structured service configuration with comprehensive SMTP support.The configuration is thorough and includes:
- Proper health checks for all services
- Complete SMTP configuration options
- Well-organized environment variables
Changes
ownedByCurrentTeam()
scope when finding serversduplicati.yaml
and fixTZ
varIssues