hackoregon / civic-devops

Master collection point for issues, procedures, and code to manage the HackOregon Civic platform
MIT License
11 stars 4 forks source link

Container startup error "unbound variable" in CloudWatch logs #156

Closed MikeTheCanuck closed 6 years ago

MikeTheCanuck commented 6 years ago

CloudWatch logs for a newly-deployed API container merely a single log entry, and then the container service exited with exit code 1: /code/bin/production-docker-entrypoint.sh: line 8: POSTGRES_HOST: unbound variable

Problem

The POSTGRES_HOST environment variable wasn't getting set by the time it was being used.

Solution

We moved up the source get-ssm-parameters.sh script ahead of first-use of POSTGRES_HOST - that script includes an export of that env var, and source ensures it persists.

API repo for the current commit

This is the code that led to this error in ECS: https://github.com/hackoregon/housing-2018/commit/28646acde47997a2ac4611d5b5bdd79e0d48d6ff