Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tags to pups templates #751

Merged
merged 6 commits into from
Apr 10, 2024
Merged

Add tags to pups templates #751

merged 6 commits into from
Apr 10, 2024

Conversation

featheredtoast
Copy link
Member

@featheredtoast featheredtoast commented Oct 27, 2023

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 are default 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.

@featheredtoast featheredtoast force-pushed the add-tags branch 2 times, most recently from 90fd0a0 to 3e28261 Compare November 8, 2023 02:11
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.
Copy link
Contributor

@danielwaterworth danielwaterworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this merged!

It would be good to put some description of what the tags mean somewhere in the repo. Perhaps in templates/README.md.

@featheredtoast featheredtoast merged commit 26ae3e7 into main Apr 10, 2024
4 checks passed
@featheredtoast featheredtoast deleted the add-tags branch April 10, 2024 23:29
@mentalstring
Copy link

mentalstring commented Apr 27, 2024

We are still on v3.1.5 as we are waiting for some plugins to be compatible with 3.2.

This PR is preventing us from rebuilding Discourse:

rake aborted!
Don't know how to build task 'assets:precompile:build' (See the list of available tasks with `rake --tasks`)
Did you mean?  assets:precompile
               assets:precompile:css
               assets:precompile:before
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
(See full trace by running task with --trace)
I, [2024-04-27T10:45:53.719449 #1]  INFO -- : 

Any workaround?

@mentalstring
Copy link

In case this is useful for someone in the same situation, I managed to rebuild by checking out discourse/discourse_docker to the commit before this one and (for some other unrelated reason, I guess), commenting DISCOURSE_MAXMIND_LICENSE_KEY or else it was failing at another place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants