This resolves a race condition with unconfigured images attempting to bring up DBs for the first time. This does not affect fully bootstrapped images. Currently, all jobs start at boot - this includes postgres. Issue with the current is - postgres starts and adds the corresponding .s/.pid files to /var/run/postgres. Simultaneously, the unicorn job gets started, checks to see if postgres is running (it is already at this point from boot), and runs install_postgres. Inside the install_postgres script, we mount the shared postgres folder and remove .s/.pid files -- after postgres has already been started. In this case, we remove the (in-use) .s and .pid files. Subsequent unicorn tasks fail, erroring out the service and forcing it into a restart loop. Since postgres never restarts, it never regenerates the .s/.pid files, and unicorn can never run successfully. This proposal moves install_postgres into the postgres job file, eliminating the race condition. Since they are part of the same service, install_postgres will always run before starting postgres - it will no longer be able to remove valid .s and .pid files. Redis has a similar race condition with the creation of its data folder. This isn't as disastrous as the redis service restarts until the folder exists from unicorn run, but it provides better reasoning about the running services. Add early exit from unicorn boot scripts to properly retry migrate as well. Use pg_isready to check if pg is ready directly in create_db. Merge the ready check into create_db. Run create_db in a subshell on postgres job start, rather than in unicorn script. remove postgres-config call |
||
---|---|---|
.. | ||
import | ||
README.md | ||
cache-dns.template.yml | ||
cloudflare.template.yml | ||
cron.template.yml | ||
enable-ruby-yjit.yml | ||
fastly.template.yml | ||
offline-page.template.yml | ||
postgres.9.5.template.yml | ||
postgres.10.template.yml | ||
postgres.12.template.yml | ||
postgres.13.template.yml | ||
postgres.15.template.yml | ||
postgres.template.yml | ||
redis.template.yml | ||
sshd.template.yml | ||
syslog.template.yml | ||
web.china.template.yml | ||
web.ipv6.template.yml | ||
web.letsencrypt.ssl.template.yml | ||
web.onion.template.yml | ||
web.ratelimited.template.yml | ||
web.socketed.template.yml | ||
web.ssl.template.yml | ||
web.template.yml |
README.md
pups-managed templates you may use to bootstrap your environment.