Add tags to pups templates (#751)
authorJeff Wong <awole20@gmail.com>
Wed, 10 Apr 2024 23:29:57 +0000 (16:29 -0700)
committerGitHub <noreply@github.com>
Wed, 10 Apr 2024 23:29:57 +0000 (16:29 -0700)
commit26ae3e7143019221dabdfd1c408e0e5892f86833
tree9363fe3f1dd23ed60793f46ed288a3b550142eee
parent869cdb3672ab86342944c0c7b915804ed46225c3
Add tags to pups templates (#751)

* Add tags to pups templates

The purpose here is to allow greater flexibility in how and where
docker images are built and run. It achieves this by breaking up
build steps into distinct run steps which can be saved along the way.
Customizable base images may then be prebuilt with as many batteries
included as possible, with zero environment setup so those images
can then be configured at a later stage.

Add the ability to run partial pups configuration:
`build`: build base image with no db - ember build.
`precompile`: precompile stage that requires postgres and redis.
`migrate`: run migration tasks.
`db`: start bundled postgres/redis, if included.

Adds a create_db script in postgres template for creating db on the fly.
Called below in unicorn run:

updates unicorn run command with 3 env flags:
CREATE_DB_ON_BOOT: if 1, creates base db schema, allows for deferral of creation.
MIGRATE_ON_BOOT: if 1, runs db:migrate - allows for deferral of db migration.
PRECOMPILE_ON_BOOT: if 1, precompiles assets (without ember build).

PRECOMPILE_ON_BOOT initially defaults to 1 in base builds (no tags).
During the `precompile` build step, this updates the default to be 0.

All other new flags default to 0 (off). With these three flags, we're now able
to ship and start a container from a base image, and it'll be able to bootstrap
a blank database.

Updates hook to start redis before_db_migrate as before_code hook
is not guaranteed to fire before migrate tasks if pups is filtered by tags.
templates/postgres.template.yml
templates/redis.template.yml
templates/web.template.yml