Skip to content

Commit b7282ad

Browse files
authored
v4.0.0-beta.453 (#7467)
2 parents a528f4c + b3289af commit b7282ad

File tree

162 files changed

+5748
-1145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+5748
-1145
lines changed

.ai/core/application-architecture.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,22 @@ class EnvironmentVariable extends Model
283283

284284
### **Team-Based Soft Scoping**
285285

286-
All major resources include team-based query scoping:
286+
All major resources include team-based query scoping with request-level caching:
287287

288288
```php
289-
// Automatic team filtering
290-
$applications = Application::ownedByCurrentTeam()->get();
291-
$servers = Server::ownedByCurrentTeam()->get();
289+
// ✅ CORRECT - Use cached methods (request-level cache via once())
290+
$applications = Application::ownedByCurrentTeamCached();
291+
$servers = Server::ownedByCurrentTeamCached();
292+
293+
// ✅ CORRECT - Filter cached collection in memory
294+
$activeServers = Server::ownedByCurrentTeamCached()->where('is_active', true);
295+
296+
// Only use query builder when you need eager loading or fresh data
297+
$projects = Project::ownedByCurrentTeam()->with('environments')->get();
292298
```
293299

300+
See [Database Patterns](.ai/patterns/database-patterns.md#request-level-caching-with-ownedbycurrentteamcached) for full documentation.
301+
294302
### **Configuration Inheritance**
295303

296304
Environment variables cascade from:

.ai/patterns/database-patterns.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,59 @@ Server::chunk(100, function ($servers) {
243243
- **Composite indexes** for common queries
244244
- **Unique constraints** for business rules
245245

246+
### Request-Level Caching with ownedByCurrentTeamCached()
247+
248+
Many models have both `ownedByCurrentTeam()` (returns query builder) and `ownedByCurrentTeamCached()` (returns cached collection). **Always prefer the cached version** to avoid duplicate database queries within the same request.
249+
250+
**Models with cached methods available:**
251+
- `Server`, `PrivateKey`, `Project`
252+
- `Application`
253+
- `StandalonePostgresql`, `StandaloneMysql`, `StandaloneRedis`, `StandaloneMariadb`, `StandaloneMongodb`, `StandaloneKeydb`, `StandaloneDragonfly`, `StandaloneClickhouse`
254+
- `Service`, `ServiceApplication`, `ServiceDatabase`
255+
256+
**Usage patterns:**
257+
```php
258+
// ✅ CORRECT - Uses request-level cache (via Laravel's once() helper)
259+
$servers = Server::ownedByCurrentTeamCached();
260+
261+
// ❌ AVOID - Makes a new database query each time
262+
$servers = Server::ownedByCurrentTeam()->get();
263+
264+
// ✅ CORRECT - Filter cached collection in memory
265+
$activeServers = Server::ownedByCurrentTeamCached()->where('is_active', true);
266+
$server = Server::ownedByCurrentTeamCached()->firstWhere('id', $serverId);
267+
$serverIds = Server::ownedByCurrentTeamCached()->pluck('id');
268+
269+
// ❌ AVOID - Making filtered database queries when data is already cached
270+
$activeServers = Server::ownedByCurrentTeam()->where('is_active', true)->get();
271+
```
272+
273+
**When to use which:**
274+
- `ownedByCurrentTeamCached()` - **Default choice** for reading team data
275+
- `ownedByCurrentTeam()` - Only when you need to chain query builder methods that can't be done on collections (like `with()` for eager loading), or when you explicitly need a fresh database query
276+
277+
**Implementation pattern for new models:**
278+
```php
279+
/**
280+
* Get query builder for resources owned by current team.
281+
* If you need all resources without further query chaining, use ownedByCurrentTeamCached() instead.
282+
*/
283+
public static function ownedByCurrentTeam()
284+
{
285+
return self::whereTeamId(currentTeam()->id);
286+
}
287+
288+
/**
289+
* Get all resources owned by current team (cached for request duration).
290+
*/
291+
public static function ownedByCurrentTeamCached()
292+
{
293+
return once(function () {
294+
return self::ownedByCurrentTeam()->get();
295+
});
296+
}
297+
```
298+
246299
## Data Consistency Patterns
247300

248301
### Database Transactions

.github/workflows/coolify-helper-next.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
uses: docker/login-action@v3
4545
with:
4646
registry: ${{ env.DOCKER_REGISTRY }}
47-
username: ${{ secrets.DOCKER_USERNAME }}
48-
password: ${{ secrets.DOCKER_TOKEN }}
47+
username: ${{ secrets.DOCKERHUB_USERNAME }}
48+
password: ${{ secrets.DOCKERHUB_TOKEN }}
4949

5050
- name: Get Version
5151
id: version
@@ -86,8 +86,8 @@ jobs:
8686
uses: docker/login-action@v3
8787
with:
8888
registry: ${{ env.DOCKER_REGISTRY }}
89-
username: ${{ secrets.DOCKER_USERNAME }}
90-
password: ${{ secrets.DOCKER_TOKEN }}
89+
username: ${{ secrets.DOCKERHUB_USERNAME }}
90+
password: ${{ secrets.DOCKERHUB_TOKEN }}
9191

9292
- name: Get Version
9393
id: version

.github/workflows/coolify-helper.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
uses: docker/login-action@v3
4545
with:
4646
registry: ${{ env.DOCKER_REGISTRY }}
47-
username: ${{ secrets.DOCKER_USERNAME }}
48-
password: ${{ secrets.DOCKER_TOKEN }}
47+
username: ${{ secrets.DOCKERHUB_USERNAME }}
48+
password: ${{ secrets.DOCKERHUB_TOKEN }}
4949

5050
- name: Get Version
5151
id: version
@@ -85,8 +85,8 @@ jobs:
8585
uses: docker/login-action@v3
8686
with:
8787
registry: ${{ env.DOCKER_REGISTRY }}
88-
username: ${{ secrets.DOCKER_USERNAME }}
89-
password: ${{ secrets.DOCKER_TOKEN }}
88+
username: ${{ secrets.DOCKERHUB_USERNAME }}
89+
password: ${{ secrets.DOCKERHUB_TOKEN }}
9090

9191
- name: Get Version
9292
id: version

.github/workflows/coolify-production-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
uses: docker/login-action@v3
5252
with:
5353
registry: ${{ env.DOCKER_REGISTRY }}
54-
username: ${{ secrets.DOCKER_USERNAME }}
55-
password: ${{ secrets.DOCKER_TOKEN }}
54+
username: ${{ secrets.DOCKERHUB_USERNAME }}
55+
password: ${{ secrets.DOCKERHUB_TOKEN }}
5656

5757
- name: Get Version
5858
id: version
@@ -91,8 +91,8 @@ jobs:
9191
uses: docker/login-action@v3
9292
with:
9393
registry: ${{ env.DOCKER_REGISTRY }}
94-
username: ${{ secrets.DOCKER_USERNAME }}
95-
password: ${{ secrets.DOCKER_TOKEN }}
94+
username: ${{ secrets.DOCKERHUB_USERNAME }}
95+
password: ${{ secrets.DOCKERHUB_TOKEN }}
9696

9797
- name: Get Version
9898
id: version

.github/workflows/coolify-realtime-next.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
uses: docker/login-action@v3
4949
with:
5050
registry: ${{ env.DOCKER_REGISTRY }}
51-
username: ${{ secrets.DOCKER_USERNAME }}
52-
password: ${{ secrets.DOCKER_TOKEN }}
51+
username: ${{ secrets.DOCKERHUB_USERNAME }}
52+
password: ${{ secrets.DOCKERHUB_TOKEN }}
5353

5454
- name: Get Version
5555
id: version
@@ -90,8 +90,8 @@ jobs:
9090
uses: docker/login-action@v3
9191
with:
9292
registry: ${{ env.DOCKER_REGISTRY }}
93-
username: ${{ secrets.DOCKER_USERNAME }}
94-
password: ${{ secrets.DOCKER_TOKEN }}
93+
username: ${{ secrets.DOCKERHUB_USERNAME }}
94+
password: ${{ secrets.DOCKERHUB_TOKEN }}
9595

9696
- name: Get Version
9797
id: version

.github/workflows/coolify-realtime.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
uses: docker/login-action@v3
4949
with:
5050
registry: ${{ env.DOCKER_REGISTRY }}
51-
username: ${{ secrets.DOCKER_USERNAME }}
52-
password: ${{ secrets.DOCKER_TOKEN }}
51+
username: ${{ secrets.DOCKERHUB_USERNAME }}
52+
password: ${{ secrets.DOCKERHUB_TOKEN }}
5353

5454
- name: Get Version
5555
id: version
@@ -90,8 +90,8 @@ jobs:
9090
uses: docker/login-action@v3
9191
with:
9292
registry: ${{ env.DOCKER_REGISTRY }}
93-
username: ${{ secrets.DOCKER_USERNAME }}
94-
password: ${{ secrets.DOCKER_TOKEN }}
93+
username: ${{ secrets.DOCKERHUB_USERNAME }}
94+
password: ${{ secrets.DOCKERHUB_TOKEN }}
9595

9696
- name: Get Version
9797
id: version

.github/workflows/coolify-staging-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ jobs:
6464
uses: docker/login-action@v3
6565
with:
6666
registry: ${{ env.DOCKER_REGISTRY }}
67-
username: ${{ secrets.DOCKER_USERNAME }}
68-
password: ${{ secrets.DOCKER_TOKEN }}
67+
username: ${{ secrets.DOCKERHUB_USERNAME }}
68+
password: ${{ secrets.DOCKERHUB_TOKEN }}
6969

7070
- name: Build and Push Image (${{ matrix.arch }})
7171
uses: docker/build-push-action@v6
@@ -110,8 +110,8 @@ jobs:
110110
uses: docker/login-action@v3
111111
with:
112112
registry: ${{ env.DOCKER_REGISTRY }}
113-
username: ${{ secrets.DOCKER_USERNAME }}
114-
password: ${{ secrets.DOCKER_TOKEN }}
113+
username: ${{ secrets.DOCKERHUB_USERNAME }}
114+
password: ${{ secrets.DOCKERHUB_TOKEN }}
115115

116116
- name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }}
117117
run: |

.github/workflows/coolify-testing-host.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
uses: docker/login-action@v3
4545
with:
4646
registry: ${{ env.DOCKER_REGISTRY }}
47-
username: ${{ secrets.DOCKER_USERNAME }}
48-
password: ${{ secrets.DOCKER_TOKEN }}
47+
username: ${{ secrets.DOCKERHUB_USERNAME }}
48+
password: ${{ secrets.DOCKERHUB_TOKEN }}
4949

5050
- name: Build and Push Image (${{ matrix.arch }})
5151
uses: docker/build-push-action@v6
@@ -81,8 +81,8 @@ jobs:
8181
uses: docker/login-action@v3
8282
with:
8383
registry: ${{ env.DOCKER_REGISTRY }}
84-
username: ${{ secrets.DOCKER_USERNAME }}
85-
password: ${{ secrets.DOCKER_TOKEN }}
84+
username: ${{ secrets.DOCKERHUB_USERNAME }}
85+
password: ${{ secrets.DOCKERHUB_TOKEN }}
8686

8787
- name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }}
8888
run: |

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5389,7 +5389,6 @@ All notable changes to this project will be documented in this file.
53895389
- Add static ipv4 ipv6 support
53905390
- Server disabled by overflow
53915391
- Preview deployment logs
5392-
- Collect webhooks during maintenance
53935392
- Logs and execute commands with several servers
53945393

53955394
### 🐛 Bug Fixes

0 commit comments

Comments
 (0)