Skip to content

Commit

Permalink
chore: local dev updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
morganney committed Jan 14, 2024
1 parent 40709bc commit d571453
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ jobs:
steps:
- name: Checkout
uses: actions/[email protected]
- name: Apt Pkgs
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libnss3-tools
version: 1.3.1
- name: Install mkcert
run: |
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
- name: Install Certificates
run: |
mkcert -install
mkcert -key-file busmap.localhost-key.pem -cert-file busmap.localhost.pem busmap.localhost localhost
cp busmap.localhost.pem busmap.localhost localhost packages/web/certs
- name: Setup Node
uses: actions/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ interface AuroraCluster {
engine: string
}

let host = 'db'
let port = '5432'
let host = env.POSTGRES_HOST ?? 'db'
let port = env.POSTGRES_PORT ?? '5432'
let database = env.POSTGRES_DB
let username = env.POSTGRES_USER
let password = env.POSTGRES_PASSWORD
Expand Down
17 changes: 16 additions & 1 deletion packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,20 @@ let redisClient: ReturnType<typeof createClient> | null = null

if (env.BM_SESSION_STORE === 'redis') {
debug('initializing redis store at host', env.BM_REDIS_HOST)
redisClient = createClient({ url: env.BM_REDIS_HOST })
redisClient = createClient({
url: env.BM_REDIS_HOST,
socket: {
reconnectStrategy(retries, cause) {
if (/ENOTFOUND/i.test(cause.message) && retries > 3) {
logger.warn('Redis host not found, done reconnecting.')

return false
}

return Math.min(retries * 50, 1000)
}
}
})
redisClient.on('error', err => {
logger.error(err, 'Redis unexpected error.')
})
Expand All @@ -65,6 +78,8 @@ if (env.BM_SESSION_STORE === 'redis') {
*/
sess.store = new RedisStore({ client: redisClient, disableTouch: true })
} catch (err) {
await sql.end({ timeout: 5 })
logger.info('Database connections closed.')
logger.fatal(err, 'Redis client failed to connect. Exiting.')
exit(1)
}
Expand Down

0 comments on commit d571453

Please sign in to comment.