I seem to remember one of the earliest references was for the chantey 'Cheerly Man' used on board the RN revenue cutters on the east coast of England. These smaller ships had smaller crews and not the same restrictions as ships of the line. But even then that was only about 1820.