13 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
129691eb6e fix: ensure we continue on with logic if the error returned from fetching all apps is NoAppsExist
This makes it so we don't accidentally skip logic that happens after iterate over the apps.
2025-12-05 20:16:15 -05:00
Jose Diaz-Gonzalez
5d5d56c560 refactor: remove public exposure of DOKKU_APP_TYPE in favor of builder detected property
The DOKKU_APP_TYPE has long since ceased to be the correct way to specify the builder for the application. It's only usage has been during the detection phase, specifically to ensure that the herokuish plugin injects the correct docker arguments during the build. As such, it is safe to migrate away to a property in a patch release.

Users that seek to set a specific builder should use 'dokku builder:set $APP selected' instead.

Refs #7863
2025-08-21 23:59:41 -04:00
Jose Diaz-Gonzalez
097fb4d819 feat: clear out docker builder cache once a day
There have been a number of tickets in the past - most recently #7061 - covering the fact that Dokku doesn't clean up disk utilization. The underlying issue is that Docker uses build cache that cannot be cleaned up in a targeted way - and usually doesn't even respect the builder gc settings in a way that makes sense. In fact, the computed disk space does not line up with actual disk utilization, causing it to be a mystery to anyone investigating the underlying problem.

This change introduces a cron-based mechanism that cleans up disk once a day. Cleaning up more often would potentially cause issues during a build if for some reason the prune and an app deploy happened at the same time - its not clear if there is a lock on build cache usage - so cleaning up after hours once a day is a decent tradeoff.

In the future, this setting may be modifiable, but it works well for now.

Closes #7061
2024-09-22 22:15:08 -04:00
Jose Diaz-Gonzalez
b6425ab431 fix: ensure all copied files always have line endings converted to unix-style
Closes #6490
2024-01-24 23:54:10 -05:00
Eng Zer Jun
1d186a5a81 refactor(plugins): replace deprecated io/ioutil functions
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-12-22 01:59:22 +08:00
Jose Diaz-Gonzalez
64ff701cd8 fix: clean up local build images immediately after an image is released
In some cases, we might hold onto intermediate images until the next deploy. While these images are generally part of newer images - and are therefore cleaned up when the child images are no longer in use - they cruft up the 'docker image ls' output, causing some folks to believe Dokku is not cleaning up images.

Refs #6272
2023-10-14 22:36:31 -04:00
Jose Diaz-Gonzalez
5dc2f20432 fix: remove all containers and images by label on app destroy
Previously, we would filter containers and images by name, which could be fail if the app was renamed or no longer was tagged "correctly" due to a rebuild. Now, we filter by label, ensuring an app is completely cleaned up on deletion.

Also:

- Move docker image cleanup from apps plugin to builder plugin: This isn't where it belongs - images should be cleaned up in a builder plugin (or the builders plugin) and not in the apps plugin, which has nothing to do with docker images anyways.
- Remove the code from the scheduler plugin, as that will only do anything if the scheduler is enabled for the app.
- Bypass image removal if there are no images to remove
- Always delete app containers: The herokuish builder creates intermediate build containers - something that should be refactored - and ideally this gets run in that builder plugin, but keeping the logic here ensures we don't have code duplication. This is otherwise safe as it will be a no-op if there are no containers to clean up.
2023-08-05 10:58:57 -04:00
Jose Diaz-Gonzalez
87828515a1 fix: respect the build-dir in app-json extraction
Because the app-json extraction happens before the build-dir is set, it doesn't end up respecting the value, and thus the user might get the wrong app.json file.

This takes advantage of path.Join()'s default of ignoring empty paths.
2023-02-14 03:56:28 -05:00
Jose Diaz-Gonzalez
c2ebf48524 refactor: use a single implementation for checking cnb/herokuish images
Also use a plugin trigger for testing whether an image is herokuish or not rather than trying to mess around with sourced files.
2022-12-02 15:54:48 -05:00
Jose Diaz-Gonzalez
fddf130abd fix: add missing clone/rename setup code for golang plugins 2021-10-09 23:49:46 -04:00
Jose Diaz-Gonzalez
377ca5ca22 fix: properly handle directory replacement
The previous version _also_ deleted the temp working dir, causing issues with subsequent directory access.
2021-07-10 14:57:58 -04:00
Jose Diaz-Gonzalez
6d40d52d7d feat: add ability to specify a custom build directory for an app 2021-07-10 14:57:55 -04:00
Jose Diaz-Gonzalez
8c34cfe64e feat: implement builder plugin
This plugin will allow users to override the builder used for their application, enabling users to use custom builders if desired.
2021-02-28 17:25:03 -05:00