9 var postgresql = &pgBooter{}
11 type pgBooter struct {}
13 func (pb *pgBooter) Boot(ctx context.Context) error {
14 os.Setenv("LANG", "en_US.utf8")
15 // TODO: return nil if this isn't the database host.
16 if pb.check(ctx) == nil {
19 if err := (&osPackage{
21 }).Boot(ctx); err != nil {
24 if err := command("bash", "-c", "echo ${LANG} UTF-8 | tee -a /etc/locale.gen && locale-gen -a").Run(); err != nil {
27 if err := (&osPackage{
29 }).Boot(ctx); err != nil {
32 if err := command("service", "postgresql", "start").Run(); err != nil {
35 return waitCheck(ctx, 30*time.Second, pb.check)
38 func (pb *pgBooter) check(ctx context.Context) error {
39 return command("pg_isready").Run()