Heat oil over medium heat. Add the onions and cook until they are softened, sweet, and lightly browned, about 8 minutes. Add the garlic, ginger, red pepper flakes, and allspice and cook, stirring often, for 2 minutes.
Add the tomato paste and cook, stirring around the pan, until it turns red to burnt orange, about 2 minutes.
Add the can of tomatoes with juice, 2 tablespoons brown sugar, cider vinegar, a generous pinch of salt, and a few grinds of black pepper. Stir, and then taste to see if you need to add more sugar (we usually add 3 to 4 tablespoons).
Bring to a simmer, reduce the heat slightly and cook at a low simmer, stirring occasionally, until thickened and shiny, about 20 minutes. Taste then adjust with more sugar, salt or pepper.
Blend until smooth, let cool to room temperature, then refrigerate for up to one month.
