A North Yorkshire man who turned to drug dealing and growing cannabis to fund his addiction and clear his debts has been locked up.