sparse-intern-71089
08/30/2019, 5:27 AMbest-xylophone-83824
08/30/2019, 9:31 AMconst db = new pg.Database('MyCoolDatabase',{},{dependsOn: [pgContainer]});
might help.stocky-spoon-28903
08/30/2019, 11:00 AMambitious-ram-5811
08/30/2019, 2:17 PMdependsOn is the piece I was missingambitious-ram-5811
08/30/2019, 2:18 PMambitious-ram-5811
08/30/2019, 4:06 PMdependsOnambitious-ram-5811
08/30/2019, 4:07 PMsslmode (and strangely, sslMode, both of which are valid), it demands TLS to be set up on my localhost-only databasestocky-spoon-28903
08/30/2019, 10:46 PMstocky-spoon-28903
08/30/2019, 10:48 PMsslmode: "disable" should get rid of the TLS requirement tooambitious-ram-5811
08/30/2019, 11:45 PMhost: pgContainer.ipAddress gets the ordering right but blows up later, because that IP address is only valid from inside the container networkambitious-ram-5811
08/30/2019, 11:46 PM127.0.0.1, we're back to trying to run it too earlyambitious-ram-5811
08/30/2019, 11:48 PMambitious-ram-5811
08/30/2019, 11:49 PMambitious-ram-5811
08/30/2019, 11:49 PMpulumi up it works finesome-doctor-62800
08/31/2019, 12:49 AMsome-doctor-62800
08/31/2019, 12:49 AMsome-doctor-62800
08/31/2019, 12:50 AMsome-doctor-62800
08/31/2019, 12:50 AMambitious-ram-5811
08/31/2019, 1:07 AMwhite-balloon-205
docker.Container not waiting for the container to be fully booted (I don’t even think docker has any robust notion of that). And then the Postgres.Provider not having a built in retry.
Either/both of those could be considered bugs in the providers.
Alternatively, you can manually inject delays if needed - along the lines of this (though can probably be much simpler for your use case):
https://gist.github.com/lukehoban/fd0355ed5b82386bd89c0ffe2a3c916aambitious-ram-5811
08/31/2019, 3:13 AMfunction stallThenReturn<T>(timeout: number, value: T): Promise<T> {
return new Promise((res) => setTimeout(() => res(value), timeout));
}
const pgProvider = new pg.Provider('pg', {
host: pgContainer.ipAddress,
username: cfg.require('pguser'),
password: cfg.requireSecret('pgpass'),
sslmode: stallThenReturn(5 * 1000, 'disable'),
});some-doctor-62800
08/31/2019, 12:45 PMbest-xylophone-83824
09/02/2019, 8:13 AM