Dried herbs really do only last around six months, certainly no longer than a year. They're generally easy to get in small quantities, though.
Spices are trickier. They'll generally last rather longer, but the time will vary. If the spice is used for the colour and/or heat (e.g. turmeric, chilli) it will generally last much, much longer than one used for its smell and/or taste. Whole spices last much, much longer than pre-ground; I generally buy whole spices from asian stores, they sell them in much larger amounts for the same prices as supermarkets; and use a coffee mill to grind the right amount just before cooking (and keep a separate one for coffee!).
If kept in the dark, in a dry, clean, airtight glass container, spices and dried herbs will certainly not become health hazards, and should not pick up unpleasant tastes or odours. The strong-tasting / strong-smelling ones will, however, lose taste and smell, eventually almost completely; since that is the whole point of using them, you might as well not bother once they're off.
There are three major things that will effect the "natural" shelf life of the compote, in that they could extend it considerably past the normal shelf life of the ingredients individually:
How sweet is it? If it is sufficiently sugary, to the level of a jam or jelly, the sugar in the compote will act as a preservative.
This is because any bacteria or mold that try to colonize the product will be dessicated, as water exits their cells into the sugar medium via osmosis.
The problem here is that sugar is hydrophylic, and will easily attract water from the environment when the jar is opened, or when a wet spoon is put into it. If the surface becomes diluted with water, and thus the sugar is less concentrated, mold can get a foothold. So this kind of product is best stored in the refrigerator once opened.
How acid is it? Very, very acidic foods are less hospitable to most pathogens.
How salty is it? This one doesn't usually apply to compote recipes, but high enough salt levels also make foods inhospitable to most pathogens, again due to the dessication of their cells via osmotic pressure.
The specific recipe you linked to--at least the compote portion itself, excluding the vinegar syrup and the rest of the recipe--appears to have none of the characteristics that lead to a long shelf life. It should be held no longer than its most vulnerable ingredient, which would be the weak sugar syrup, so it is probably good for several days to a week in the refrigerator.
Now, in general, things named compotes tend to be far sweeter, and far more acidic than the recipe you have linked to.
In these cases, as ElindilTheTall points out, a very, very sweet recipe (jelly-like or jam-like sweetness) will last for many weeks in the refrigerator, and a couple of weeks at least at normal room temperature.
Finally, many compotes are amenable to home canning, if they are sufficiently acidic.
Canning has risks, especially for botulism, so you should only use recipes and methods from a very reputable source when doing canning, to ensure that the product is sufficiently acidic to be safe for the canning method used. Follow all of the techniques and prescriptions in the methods, as well, but I won't turn this into an essay on canning, which is not my area of expertise.
For those compotes that are properly canned, you should get an indefinite shelf life prior to opening, as long as the seal on the canning jar remains intact.
Best Answer
Firat, first, first : look at your local rules and regulation regarding selling food product in your area.
First first : Decide how long you want to have your product to last, this will put restriction on packaging.
First, you need to do a lot of testing with different kind of packaging and see how your product behave over days, weeks and months (whatever long you want to keep the product)
Find a local food laboratory to test your product for safety (bacteria, mold.... ) at different days, weeks...
If/When the product is safe to eat, you also need to test the product to see if it is still good (not stale, loss of flavour...)
After that, look for different packaging solution for your product, most packaging can be done in-house (heat sealed) so you can buy custom printed bags or pouches (for example for granola melange) or paper packaging (for example for chocolat bars)
I've googled for "commercial food packaging" and there are many solutions for this, just look it up.