49 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
06de81b61b refactor: allow custom nginx command to be set as an nginx property
This avoids adding a new environment variable in favor of a script that can be called both globally as well as on a per-app basis.
2025-06-30 03:29:43 -04:00
Udi Oron
a331d27945 feat(nginx-vhosts): add support for custom nginx service command 2025-06-30 03:22:07 -04:00
Fabien LEFEBVRE (d1ceward)
1f2ef9874d Fix retrieval of systemctl path in nginx-vhosts plugin 2025-05-22 11:15:06 +02:00
Jose Diaz-Gonzalez
4d7f779c28 feat: add support for various timeout-related functions to nginx, openresty and k3s plugins
Closes #7267
2024-10-16 00:51:01 -04:00
Jose Diaz-Gonzalez
ac56a5ffdd fix: check if nginx is running before reloading during an app deletion
The purpose of the reload is to remove nginx from being loaded. If nginx isn't running, then by definition the config is not loaded.

Closes #6832
2024-09-23 21:25:23 -04:00
Jose Diaz-Gonzalez
5493ca5978 fix: force sv usage in docker container to avoid cases where systemd is used instead
On newer Ubuntu Noble, cron (among other things) has a transitory dependency on systemd, forcing our systemd/runit detection to fail. This change allows overriding the detected init on Ubuntu systems, ensuring we always do the right thing when interacting with init.
2024-09-21 17:20:19 -04:00
Jose Diaz-Gonzalez
d3e5b573d7 feat: add logging when hsts nginx config is not using built-in template
Also updates logging for the app-config template.
2024-07-13 17:10:34 -04:00
Jose Diaz-Gonzalez
db3cfe441c fix: handle case where systemctl isn't in /usr/bin
In most cases, it should be there, but it appears that system upgrades from Ubuntu 16.04 sometimes do not have usr-merge setup. As such, we need to fallback to the /bin/systemctl path if it exists.
2024-03-06 02:02:13 -05:00
Jose Diaz-Gonzalez
b99c25f090 feat: add support for setting underscores-in-headers for nginx, openresty, and k3s
Closes #6627
2024-02-27 13:49:44 -05:00
Jose Diaz-Gonzalez
6f82879a43 Merge pull request #6390 from renweibo/master
Prefer systemctl over sv when both exist while restarting nginx
2024-02-11 20:20:39 -05:00
Jose Diaz-Gonzalez
d4b445985b refactor: consolidate property fetching for nginx plugin into golang codebase
Also update the documentation to include docs for all properties.
2024-02-06 00:42:48 -05:00
renweibo
ff2d60003d fix problem when sv and systemctl exists at the same time in ubuntu, core command related dokku nginx plugin will fail.
This will happend when an ubuntu server upgrade from early version.
2023-12-22 23:08:10 +08:00
Jose Diaz-Gonzalez
3f127a7cc4 feat: inject docker labels when nginx proxy implementation is in use
This will allow users to switch to a docker label-based nginx proxy server transparently without rebuilds (after the first one), which would mimic how the caddy, haproxy, and traefik proxy implementations work.

See https://github.com/dokku/nginx-docker-proxy for an example server implementation.
2023-08-05 10:58:57 -04:00
Jose Diaz-Gonzalez
c44d779695 fix: detect and use systemd on Debian systems
Debian Bookworm completely removes invoke-rc.d, thus breaking interactions with nginx.

Closes #6020
2023-07-11 20:34:50 -04:00
Jose Diaz-Gonzalez
e2d215ab4f fix: do not run enable/disable when using init.d
init.d doesn't support these two commands, causing nginx:stop/nginx:start to fail.
2022-11-30 15:00:05 -05:00
Jose Diaz-Gonzalez
a8bc8044e4 feat: switch to systemctl for interacting with the nginx init process 2022-11-29 01:38:36 -05:00
Jose Diaz-Gonzalez
17814d4847 refactor: only extract the nginx.conf.sigil from the source code and not an app path
The previous method was a bit more difficult for users to interact with as they needed to ensure the file was at a certain path in the built image. This change divorces the file from the built artifact, better aligning the nginx.conf.sigil handling with the rest of Dokku's monorepo support.

A side effect of this is now building proxy configurations does not require access to the built image.

Closes #5207
2022-11-23 19:32:53 -05:00
Jose Diaz-Gonzalez
70fc35c317 chore: drop unsupported operating systems
We will no longer support CentOS, Fedora, and Opensuse as installation targets. These are not actively maintained by anyone with commit rights and occasionally cause issues for users as they are not tested during the release process.

Rather than have subpar support for an untested operating system, we're removing support for them completely. Users of these operating systems should take a look migration to the docker-based installation method, which will always be tested and supported by the project.

Additionally, drop support for Debian 9 as it is now EOL.
2022-08-07 18:36:30 -04:00
Jose Diaz-Gonzalez
6c709f2386 fix: drop which in favor of command -v 2021-10-28 18:22:20 -04:00
Jose Diaz-Gonzalez
57858c1788 fix: ensure installations treat raspbian as similar to debian buster as possible 2021-10-28 02:41:10 -04:00
David Bazile
2577233ff0 Add nascent support for Fedora 2021-06-07 10:18:32 -04:00
Jose Diaz-Gonzalez
5cac43fe55 refactor: fix computation test and remove the app-specific hsts value
The default for an app is empty, meaning it will fallback to the global value (which defaults to true). This will allow users to properly override the global value, regardless of what it is.
2021-01-23 15:49:40 -05:00
Aubrey Hewes
8cc92680c5 feat(nginx-proxy): allow disabling hsts globally and explicitly enabling it per app
https://github.com/dokku/dokku/pull/3843
2021-01-23 15:09:51 -05:00
Jose Diaz-Gonzalez
7bc241dd48 feat: suppress output for nginx init commands
It's not super useful most of the time.
2020-12-20 04:15:42 -05:00
Yihao
30414cbd0c feat: Allow controlling nginx proxy-buffer-size, proxy-buffering, proxy-buffers, proxy-busy-buffers-size 2020-09-19 09:51:55 +09:30
Jose Diaz-Gonzalez
752a0cacd9 fix: clear proxy configs on boot
Unfortunately, Docker does not persist container IPs on boot, so containers may come up with the wrong IP, resulting in proxying to the incorrect app after a server restart. Instead, we should delete the configs and let ps:restore rebuild the proxy config correctly.

Closes #3932
2020-09-10 01:58:45 -04:00
Jose Diaz-Gonzalez
becf7c1f86 feat: allow customizing the various nginx templates
This will let custom distributions of Dokku to override the internal templates without needing to repackage Dokku or overwrite core files.
2020-09-06 13:57:35 -04:00
Jose Diaz-Gonzalez
ee786e1962 feat: add support for outputting the last visited time
This checks the ctime of the log file if available, otherwise returns empty string
2020-04-18 18:15:20 -04:00
Jose Diaz-Gonzalez
94357b961e refactor: deprecate nginx:validate
The command function move was to fix circular import issues...
2020-02-19 01:00:47 -05:00
Jose Diaz-Gonzalez
579d430303 refactor: rename nginx:show-conf to nginx:show-config 2020-02-19 01:00:47 -05:00
Jose Diaz-Gonzalez
e67b96780d refactor: unify command declaration across codebase 2020-02-10 01:40:30 -05:00
Jose Diaz-Gonzalez
ef7894fdfa refactor: standardize help generation 2020-02-10 00:37:00 -05:00
Jose Diaz-Gonzalez
1cb586b2e7 refactor: standardize command naming
This standardization makes it somewhat easier to read stacktraces as the command names are all uniform, so it will be slightly easier to scan trace output.
2020-02-09 22:41:39 -05:00
Jose Diaz-Gonzalez
a8c4065dcf fix: use the correct variable 2020-02-07 02:59:52 -05:00
Jose Diaz-Gonzalez
13be4d07a6 fix: check correct properties 2020-02-06 19:27:14 -05:00
Jose Diaz-Gonzalez
73e7ff7b18 feat: Enable HSTS by default
This enables the HSTS header by default when an SSL certificate is in use. HSTS options can also be managed via the nginx:set command, which also exposes the ability to disable HSTS for your application.
2020-02-06 11:08:13 -05:00
Jose Diaz-Gonzalez
6b431378a1 feat: add ability to set the ipv4/ipv6 bind address for an app
This allows users to handle mulitple interfaces separately or even ensure applications remain accessible only on a local network.

Closes #3805
2019-12-21 18:54:54 -05:00
Jose Diaz-Gonzalez
90681ce475 docs: document nginx:show-conf 2019-12-19 02:24:27 -05:00
Jose Diaz-Gonzalez
cb281e17e6 fix: correct shfmt issues 2019-09-17 02:22:41 -04:00
Jose Diaz-Gonzalez
6e3fddb544 feat: add proper openresty support
This change allows supporting the openresty package as installed on Ubuntu 18.04 from the official openresty package repository, while also returning general nginx support.

Closes #3675
2019-09-16 03:05:35 -04:00
Jose Diaz-Gonzalez
3ca6245b00 fix: use 6 X to support running under busybox
mktemp from busybox requires that all templates end with XXXXXX.
2019-08-12 18:16:16 -04:00
Jose Diaz-Gonzalez
925c6c4c28 feat: inject the dokku PID into temporary files/directories
This will allow background processes to cleanup these files if they were unable to be cleaned up during a run of the dokku binary, as is the case for files copied by the docker binary when running in docker.
2019-08-12 17:56:17 -04:00
Jose Diaz-Gonzalez
1b92f4a97e chore: standardize how temporary files are named 2019-05-20 18:01:17 -07:00
Jose Diaz-Gonzalez
da4361583b fix: reverse quotes for variable expansion
Without reversing quotes, the variables are sometimes improperly expanded, resulting in files not being removed.
2019-05-20 17:56:50 -07:00
Jose Diaz-Gonzalez
67ae374e60 lint: remove whitespaces before redirect 2019-02-02 13:49:24 -05:00
Jose Diaz-Gonzalez
86795ddacc tests: run mvdan/shfmt on test runs
While I do not agree with _every_ style change, this will force Dokku to have consistent formatting across all shell scripts, which is arguably a Good Thing™.

The command used to reprocess everything is:

```shell
shfmt -l -bn -ci -i 2 -w .
```
2019-01-07 01:25:55 -05:00
Jose Diaz-Gonzalez
0909052816 feat: Pull invalid nginx configuration when the nginx configs fail to validate
- expose an nginx:validate command that can be used to show validation information
- properly reference the invalid nginx config, rather than tell the user that another app's nginx config is invalid when deploying their own app
- allow a user to cleanup bad nginx config files out of band when they are blocking a deploy _without_ requiring knowing where that nginx config is

Note that this may have issues with generated nginx.conf files that depend on other apps or other parts of the nginx config. For now, this is acceptable, though it is something that needs to be field tested.

Closes #3162
2018-12-31 11:57:03 -05:00
Jose Diaz-Gonzalez
66b2fb602f feat: implement proxy-clear-config
This will allow us to kill stale proxy configuration within apps, which is critical during application renames.

- redirect rmdir output to dev-null
- trigger a proxy-clear-config (new trigger) when renaming an application
  - The configuration will be rebuilt during the later `ps_rebuild`

Closes #3231
2018-07-28 01:20:06 -04:00
Jose Diaz-Gonzalez
885aa47b18 refactor: move nginx:help to internal-functions 2017-02-20 22:35:52 -07:00