0

I have a really annoying problem with Bamboo how deals with activator (or my ssh? ) when started and there is a evolution for database, its simply consider it as fail and exit the ssh, so I cant hit the button of run evolution script.

I enabled auto apply for evolution in application.conf file with play.evolutions.autoApply=true and in the start command I put play.evolutions.db.default.autoApply with no luck, Anybody can help with how to make bamboo believe that evolution is OK to keep my activator running?

My ci-start-all.sh :

#!/bin/sh

set -e
. ./ci/ci-set-env.sh
./ci/play-start.sh
set +e

and my play-start.sh :

 #!/bin/sh

set -e
echo
echo  '****** PLAY START *******'
echo

nohup ./target/universal/stage/bin/webapp -Dplay.evolutions.db.default.autoApply=true -Dhttp.port=$PLAY_PORT -Dconfig.file=conf/cloud.conf &>play.out &

sleep 10

#look for process listening to port TODO: replace with wget and a url
pid=`lsof -Pi tcp:$PLAY_PORT | grep LISTEN | awk '{print $2}'`

if [ $pid > 0 ];
then
    echo [success] Play! started
else
    echo ERROR: Play! did not start successfully
    #output logfile
    cat play.out
    exit 1
fi

set +e

My logfile :

ERROR: Play! did not start successfully
11-Nov-2015 11:23:20    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
11-Nov-2015 11:23:20    2015-11-11 11:23:12 +0200 1105  INFO  application - Creating Pool for datasource 'default'
11-Nov-2015 11:23:20    2015-11-11 11:23:13 +0200 2166  INFO  play.api.db.DefaultDBApi - Database [default] connected at jdbc:mysql://localhost/timesheets_dev?zeroDateTimeBehavior=convertToNull
11-Nov-2015 11:23:20    2015-11-11 11:23:14 +0200 2889  WARN  p.a.d.e.ApplicationEvolutions - Your production database [default] needs evolutions, including downs! 
11-Nov-2015 11:23:20    
11-Nov-2015 11:23:20    # !!! WARNING! This script contains DOWNS evolutions that are likely destructives
11-Nov-2015 11:23:20    
11-Nov-2015 11:23:20    # --- Rev:3,Downs - 9cadf53
11-Nov-2015 11:23:20    ALTER TABLE ACCOUNTS DROP users_count;
11-Nov-2015 11:23:20    
11-Nov-2015 11:23:20    # --- Rev:3,Ups - 79049fc
11-Nov-2015 11:23:20    ALTER TABLE ACCOUNTS ADD users_count int DEFAULT 0 NULL;
11-Nov-2015 11:23:20    
11-Nov-2015 11:23:20    
11-Nov-2015 11:23:20    UPDATE ACCOUNTS a SET users_count = (SELECT COUNT(*) FROM USERS u WHERE u.account_id = a.id and u.is_active = true);
11-Nov-2015 11:23:20    
11-Nov-2015 11:23:20    2015-11-11 11:23:14 +0200 2896  WARN  p.a.d.e.ApplicationEvolutions - Run with -Dplay.evolutions.db.default.autoApply=true and -Dplay.evolutions.db.default.autoApplyDowns=true if you want to run them automatically, including downs (be careful, especially if your down evolutions drop existing data)
11-Nov-2015 11:23:20    Oops, cannot start the server.
11-Nov-2015 11:23:20    @6o4mnmhf7: Database 'default' needs evolution!
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutions$$anonfun$play$api$db$evolutions$ApplicationEvolutions$$runEvolutions$1.apply$mcV$sp(ApplicationEvolutions.scala:68)
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutions.withLock(ApplicationEvolutions.scala:98)
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutions.play$api$db$evolutions$ApplicationEvolutions$$runEvolutions(ApplicationEvolutions.scala:49)
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutions$$anonfun$start$1.apply(ApplicationEvolutions.scala:42)
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutions$$anonfun$start$1.apply(ApplicationEvolutions.scala:42)
11-Nov-2015 11:23:20            at scala.collection.immutable.List.foreach(List.scala:381)
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutions.start(ApplicationEvolutions.scala:42)
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutions.<init>(ApplicationEvolutions.scala:149)
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutionsProvider.get$lzycompute(EvolutionsModule.scala:53)
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutionsProvider.get(EvolutionsModule.scala:53)
11-Nov-2015 11:23:20            at play.api.db.evolutions.ApplicationEvolutionsProvider.get(EvolutionsModule.scala:44)
11-Nov-2015 11:23:20            at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
11-Nov-2015 11:23:20            at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
11-Nov-2015 11:23:20            at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
11-Nov-2015 11:23:20            at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
11-Nov-2015 11:23:20            at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
11-Nov-2015 11:23:20            at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
11-Nov-2015 11:23:20            at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
11-Nov-2015 11:23:20            at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
11-Nov-2015 11:23:20            at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
11-Nov-2015 11:23:20            at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
11-Nov-2015 11:23:20            at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
11-Nov-2015 11:23:20            at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
11-Nov-2015 11:23:20            at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
11-Nov-2015 11:23:20            at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
11-Nov-2015 11:23:20            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
11-Nov-2015 11:23:20            at com.google.inject.Guice.createInjector(Guice.java:96)
11-Nov-2015 11:23:20            at com.google.inject.Guice.createInjector(Guice.java:73)
11-Nov-2015 11:23:20            at com.google.inject.Guice.createInjector(Guice.java:62)
11-Nov-2015 11:23:20            at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:126)
11-Nov-2015 11:23:20            at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:93)
11-Nov-2015 11:23:20            at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
11-Nov-2015 11:23:20            at play.core.server.ProdServerStart$.start(ProdServerStart.scala:52)
11-Nov-2015 11:23:20            at play.core.server.ProdServerStart$.main(ProdServerStart.scala:27)
11-Nov-2015 11:23:20            at play.core.server.ProdServerStart.main(ProdServerStart.scala)
11-Nov-2015 11:23:20    Failing task since return code of [./ci/ci-start-all.sh] was 1 while expected 0
11-Nov-2015 11:23:20    Finished task 'CI Start All' with result: Failed
11-Nov-2015 11:23:20    Running post build plugin 'npm Cache Cleanup'
11-Nov-2015 11:23:20    Running post build plugin 'NCover Results Collector'
11-Nov-2015 11:23:20    Running post build plugin 'Clover Results Collector'
11-Nov-2015 11:23:20    Running post build plugin 'Artifact Copier'
11-Nov-2015 11:23:20    Publishing an artifact: XXX
11-Nov-2015 11:24:03    Finished publishing of artifact Shared artifact: [XXX], pattern: [**/*] in 43s
11-Nov-2015 11:24:03    Finalising the build...
11-Nov-2015 11:24:03    Stopping timer.
11-Nov-2015 11:24:03    Build XXX-173 completed.
11-Nov-2015 11:24:03    Running on server: post build plugin 'NCover Results Collector'
11-Nov-2015 11:24:03    Running on server: post build plugin 'Clover Delta Calculator'
11-Nov-2015 11:24:03    Running on server: post build plugin 'Maven Dependencies Postprocessor'
11-Nov-2015 11:24:03    Running on server: post build plugin 'Build Hanging Detection Configuration'
11-Nov-2015 11:24:03    All post build plugins have finished
11-Nov-2015 11:24:03    Generating build results summary...
11-Nov-2015 11:24:07    Saving build results to disk...
11-Nov-2015 11:24:07    Indexing build results...
11-Nov-2015 11:24:07    Finished building  XXX-173
Al-Mothafar
  • 7,949
  • 7
  • 68
  • 102

1 Answers1

0

Sometimes when its a destructive evolution it will stop, i just added the following lines inside application.conf to make it run you need to set values from config and force the evolution but be careful, you don't need to lose your data, if you just in development phase and its OK do that, otherwise keep play.evolutions.autoApplyDowns to false, or don't put it at all to keep default value (which is false for production)

# Evolutions
# ~~~~~
# You can disable evolutions if needed
# play.evolutions.enabled=true

# You can disable evolutions for a specific datasource if necessary
play.evolutions.db.default.enabled=true

# this is safe to use if there is no "DOWNS" otherwise it will fail to start
play.evolutions.autoApply = true

# BECAREFUL ITS DANGROUS DON'T USE IN PRODUCTION
play.evolutions.autoApplyDowns = true
Al-Mothafar
  • 7,949
  • 7
  • 68
  • 102