-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: install root certs correctly by changing how daemonization works #31
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Flake lock file updates: • Updated input 'nixpkgs': 'github:nixos/nixpkgs/f685a63133f8c87962626710f8d7344ae3bcf60a' (2024-04-22) → 'github:nixos/nixpkgs/d372356ff52a6700892638ea3df180b2317af015' (2024-05-07)
Still a problem if you `localias start` and then `localias run`, seeing a weird EOF error in `cntxt.Search()` probably from the ReadPidFile
Close to done here, will release sometime within the next week |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bugfix
Fix #30 by changing how daemonization works.
start
/reload
would apply the latest config in the foreground process, then fork(), then start Caddy.start
/reload
apply the latest config, starts Caddy in the foreground process, then fork()s.Friendlier CLI
This change encouraged me to make the following improvements to the CLI commands:
stop
just kills the daemon, if it's running. If the daemon wasn't running,stop
will now exit cleanly. Previously, it would throw an error, but that's user-hostile because the goal of runningstop
is to ensure no running daemon — if that goal is accomplished by stopping a running daemon, or confirming no daemon was running, doesn't really matter.start
will start a new daemon. If one was already running, it will be killed and replaced by a new one. The user's goal is to ensure a daemon is running, with the latest config, and this is achieved regardless of whether or not there was an existing daemon.reload
becomes an alias forstart
, because they have the exact same behavior — ensure that a daemon is running with the latest configuiration.Get rid of
caddymodules
A while ago, localias was built using
gomod2nix
, and there was an incompatibility between that helper and the opentelemetry modules included in Caddy. To work around this, I created acaddymodules
package that imported all of the Caddy modules except opentelemetry, which was fine because this project doesn't use the opentelemetry modules in any way.Because localias no longer uses
gomod2nix
, this PR gets rid of thecaddymodules
hack entirely. This then allowed me to upgrade the version of Caddy that is being installed, and it will make it easier to stay up to date as Caddy receives further improvements.SSL renewal server
With an upgraded Caddy came a problem — for SSL issuance, Caddy now requires you to implement an "automation policy" server that confirms that it can issue a new certificate for a given domain. This is primarily aimed at issuing certificates for real life domains accessible to the public, not for internal development aliases, but the restriction still stands. To do this, I used Caddy itself to respond to these requests.
For more information, read:
In the future, I could implement this by writing a custom policy module instead of using the HTTP ask, but this works for now.
Dependencies cleanup
flake.nix
andflake.lock
files, switch tobuildGoModule
instead ofbuildGo120Module
to make it easier to use this flake with an overridenixpkgs
upstream.