First it shold come from parents who set rules for behavior, then gradually increases the privileges as the child gets older. School is also a builder of discipline due to homework and deadlines with homework, reports, projects. Gradually as one assumes more and more responsibilities, the child slowly integrates these external boundaries into one's own internal self. Thus self discipline occcurs without any external system.