Preheat the smoker per the manufacturer's instructions to 225-250°F (107-121°C).
Line a baking sheet with aluminum foil (easier cleanup), then top it with a wire rack and set it aside.
Heat the oil in a small-medium saucepan over medium heat.
Add the onions, garlic, thyme, and bell pepper. Sauté for a minute or two so the flavors bloom, being careful not to burn it. Set it aside to cool.
Mix the ground beef, breadcrumbs, egg, ketchup, salt, black pepper, Worcestershire sauce, optional bouillon, milk, and cayenne (if using) in a medium bowl.
Add the cooled onion mixture and mix gently until everything is thoroughly combined. Please avoid overmixing.
Form the ground beef mixture into a loaf on a smooth surface, then transfer it to the wire rack.
Place it in the smoker or pellet grill and smoke it until an instant-read thermometer inserted into the center registers 140°F (60°C). It may take 2-3 hours.
Mix the glaze ingredients: ketchup, Dijon mustard, and sugar. Then glaze the meatloaf with about ⅔ of it, and reserve the rest for later.
Continue smoking for 30 minutes more or until the internal temperature reads 150°F (65°C). Brush the meatloaf with the remaining glaze and continue smoking for 10-15 more minutes so the glaze caramelizes and it reaches the desired internal temperature; 165°F (70°C) is standard.
Remove it from the smoker and let it rest for about 10 minutes before slicing and serving.