# What are all the hook types I can use in app.yml

**URL:** https://meta.discourse.org/t/what-are-all-the-hook-types-i-can-use-in-app-yml/387953
**Category:** Support
**Created:** [November 8, 2025, 8:49pm UTC](https://meta.discourse.org/t/what-are-all-the-hook-types-i-can-use-in-app-yml/387953 "2025-11-08T20:49:01Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [November 8, 2025, 10:54pm UTC](https://meta.discourse.org/t/what-are-all-the-hook-types-i-can-use-in-app-yml/387953/2 "2025-11-08T22:54:06Z")

</div>

There isn’t actually a fixed global list of hook types in `app.yml`.  
Hooks are provided dynamically by **Pups** , and you can only attach to the ones that exist inside the templates you include.

* * *

### 🔍 How it works

When you see something like:

```yaml
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git

```

that works because the templates contain a step like:

```yaml
- hook: code
  run:
    - exec: ...

```

Pups lets you attach commands **before or after** any of those defined hook points.  
So if a template defines `hook: code`, you can use `before_code:` or `after_code:`.  
If it defines `hook: assets_precompile`, you can use `before_assets_precompile:` or `after_assets_precompile:` — and so on.

> If there’s no `hook: restart` (for example), then `after_restart:` simply won’t fire.

* * *

### ✅ Hooks known to exist in the stock templates

From the default `templates/*.yml` shipped with Discourse Docker:

| Hook name | Common usage | Works with |
| --- | --- | --- |
| `code` | Main setup stage for plugin clones, custom file edits, etc. | `before_code:` / `after_code:` |
| `assets_precompile` | After Rails assets are compiled (e.g., upload to S3, clean up) | `after_assets_precompile:` |
| `web` | For last-minute tweaks before the web process boots | `before_web:` |

You’ll often see `after_code:` and `before_code:` used in plugin-install examples — these are the only ones needed in most setups.

* * *

### ❌ Hooks that _don’t_ exist by default

Names like `after_restart` or `after_post_boot` don’t correspond to any `hook:` inside the standard templates, so Pups doesn’t know where to attach them.  
They won’t trigger unless you add a matching `hook: restart` step in a custom template.

* * *

### 🧰 How to find all hooks available on your system

From your `/var/discourse` folder, run:

```bash
grep -R "hook:" -n templates/ samples/

```

That’ll list every hook name supported by the templates you currently include.  
Anything you find there can be used as `before_<name>:` or `after_<name>:` inside your `hooks:` block.

* * *

### 📘 Reference

This behaviour is explained briefly in the **Pups README** (the config-management tool used by Discourse’s Docker setup):

> “Hooks are points in templates that allow commands to be injected before or after a step labelled with `hook:`.”

* * *

### 🧩 In practice

- Use `after_code:` for most custom shell commands (like plugin installs).
- For things that should happen at container boot or restart, use a small startup script or `supervisord` task instead of inventing new hook names.
- To add your own hook type, make a new template with a custom `hook: something` entry, then target it from `app.yml`.

* * *

**TL;DR:**  
Only the hook names that actually appear as `hook:` entries in your templates exist.  
In stock Discourse Docker, that’s basically `code`, `assets_precompile`, and `web`.

---

_[View the full topic](https://meta.discourse.org/t/what-are-all-the-hook-types-i-can-use-in-app-yml/387953)._
