Skip to content

Commit

Permalink
The /proc/1/cgroup check to set the server_hostname when
Browse files Browse the repository at this point in the history
running under docker is not working in all cases. We verified this by
exec-ing into our running container and checking the proc file contents:

```
❯ docker exec -it our-container sh # on host
$ cat /proc/1/cgroup # in container
0::/
```

This change introduced a a `VITESS_HOST` variable similarly to the
`MYSQL_HOST` variable used for standard MySQL connections. I've left the
original fallback in this case in case anything else was relying on it.
Our use case only calls for connecting to VITESS, but I suspect other DB
types could suffer from the same issue.

GitOrigin-RevId: 83d56771222b1a8601fcd4e8cb3b3849dbebe2ce
  • Loading branch information
mpeyper authored and svc-squareup-copybara committed Feb 20, 2025
1 parent ee8a451 commit 95d5321
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion misk-jdbc/src/main/kotlin/misk/jdbc/DataSourceConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ data class DataSourceConfig @JvmOverloads constructor(
DataSourceType.VITESS_MYSQL -> {
copy(
port = port ?: 27003,
host = host ?: server_hostname,
host = host ?: System.getenv("VITESS_HOST") ?: server_hostname,
database = database ?: "@master"
)
}
Expand Down

0 comments on commit 95d5321

Please sign in to comment.