16306: Merge branch 'master'
[arvados.git] / lib / boot / seed.go
index 9f086d54451bd5c4297995ca639880eb773cd581..1f6cb764e070af369252cd75a16b12f2666fa0fa 100644 (file)
@@ -8,18 +8,26 @@ import (
        "context"
 )
 
+// Populate a blank database with arvados tables and seed rows.
 type seedDatabase struct{}
 
 func (seedDatabase) String() string {
        return "seedDatabase"
 }
 
-func (seedDatabase) Run(ctx context.Context, fail func(error), boot *Booter) error {
-       err := boot.wait(ctx, runPostgreSQL{}, installPassenger{src: "services/api"})
+func (seedDatabase) Run(ctx context.Context, fail func(error), super *Supervisor) error {
+       err := super.wait(ctx, runPostgreSQL{}, installPassenger{src: "services/api"})
        if err != nil {
                return err
        }
-       err = boot.RunProgram(ctx, "services/api", nil, nil, "bundle", "exec", "rake", "db:setup")
+       if super.ClusterType == "production" {
+               return nil
+       }
+       err = super.RunProgram(ctx, "services/api", nil, railsEnv, "bundle", "exec", "rake", "db:setup")
+       if err != nil {
+               return err
+       }
+       err = super.RunProgram(ctx, "services/api", nil, railsEnv, "bundle", "exec", "./script/get_anonymous_user_token.rb")
        if err != nil {
                return err
        }