+1 on HRM, or preferably a power meter.
If you go by HRM, realize that your HR will drift up as you get hot, so you may need to raise your HR target for intervals later in the workout. Use your sense of perceived effort to help with this.
As for how long, I find it a hell of a lot easier to do intervals on the trainer for 45 minutes to an hour, as oppossed to longer endurance miles.
So to the extent you can, try setting your schedule up so you do intense interval work on the trainer, and get your long rides in outdoors.
__________________
You could fall off a cliff and die.
You could get lost and die.
You could hit a tree and die.
OR YOU COULD STAY HOME AND FALL OFF THE COUCH AND DIE.