Skip to content
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

Service receives shutdown signal if env vars are not set #1853

Closed
cedrichopf opened this issue Nov 29, 2024 · 1 comment
Closed

Service receives shutdown signal if env vars are not set #1853

cedrichopf opened this issue Nov 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@cedrichopf
Copy link

Describe the bug

Auth container keeps restarting in Kubernetes if the following environment variables are not set:

{
	Name:  "GOTRUE_API_PORT",
	Value: "9999",
},
{
	Name:  "GOTRUE_API_HOST",
	Value: "0.0.0.0",
},

If they are missing, the container doesn't throw any error but keeps shutting down with the following info message:

{"level":"info","msg":"Go runtime metrics collection started","time":"2024-11-29T09:45:06Z"}
{"component":"pop","level":"info","msg":"Migrations already up to date, nothing to apply","time":"2024-11-29T09:45:06Z"}
{"args":[0.009035875],"component":"pop","level":"info","msg":"%.4f seconds","time":"2024-11-29T09:45:06Z"}
{"level":"info","msg":"GoTrue migrations applied successfully","time":"2024-11-29T09:45:06Z"}
{"level":"info","msg":"GoTrue API started on: :8081","time":"2024-11-29T09:45:06Z"}
{"component":"api","level":"warning","msg":"DEPRECATION NOTICE: GOTRUE_JWT_ADMIN_GROUP_NAME not supported by Supabase's GoTrue, will be removed soon","time":"2024-11-29T09:45:06Z"}
{"level":"info","msg":"received graceful shutdown signal","time":"2024-11-29T09:45:21Z"}

Expected behavior

Print an information that the auth service stopped based on the missing environment variable.

System information

  • Image: supabase/gotrue:v2.164.0

Additional context

Hard to add an example deployment or pod template to reproduce since the service also needs database configuration. But if you got a running setup somehow, it could be easily reproduced by removing the environment variables. Probably also works with the official docker compose setup.
Not really a bug but after I cleaned up several environment variables, it took some time until I figured why the pod keeps restarting. I guess this would be easier for everyone if the logs just say that this env var is missing.

The mentioned environment variables are also missing in the Auth Self-hosting documentation and should be marked as required as well: https://supabase.com/docs/guides/self-hosting/auth/config

@cedrichopf cedrichopf added the bug Something isn't working label Nov 29, 2024
@cstockton
Copy link
Contributor

When those environment variables are missing we set defaults. I imagine what is happening is that gotrue starts up listening on the default port of 8081. Then K8S probes the expected port which fails the health check so K8S then sends a SIGINT / SIGHUP to terminate and the auth server abides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants