1

So I have play 2.0.4 project that I am trying to push to heroku. The project uses the play authenticate plugin and everything works as expected locally so I tried to push it to heroku.

I have spent hours trying to get this to work now but with little luck.

So I have modified my application.conf:

#db.default.driver=org.h2.Driver
db.default.url="the url for my postgres database"
# db.default.user=sa
# db.default.password=

Modified my Procfile:

web: target/start -Dhttp.port=${PORT} -Dplay.version=2.0.4 -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=$DATABASE_URL ${JAVA_OPTS}

Included postgresl in my app dependencies:

val appDependencies = Seq(
  "be.objectify"  %%  "deadbolt-2"        % "1.1.3-SNAPSHOT",
  "com.feth"      %%  "play-authenticate" % "0.2.2-SNAPSHOT",
  "postgresql"    %   "postgresql"        % "9.1-901.jdbc4"
)

I have a database evolution in conf/evolutions/1.sql:

# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions

# --- !Ups

create table journey (
  id                        bigint not null,
  s_lat                     varchar(255),
  s_lon                     varchar(255),
  e_lat                     varchar(255),
  e_lon                     varchar(255),
  start_loc                 varchar(255),
  end_loc                   varchar(255),
  participant_type          varchar(255),
  date                      varchar(255),
  time                      varchar(255),
  user                      varchar(255),
  constraint pk_journey primary key (id))
;

create table linked_account (
  id                        bigint not null,
  user_id                   bigint,
  provider_user_id          varchar(255),
  provider_key              varchar(255),
  constraint pk_linked_account primary key (id))
;

create table security_role (
  id                        bigint not null,
  role_name                 varchar(255),
  constraint pk_security_role primary key (id))
;

create table token_action (
  id                        bigint not null,
  token                     varchar(255),
  target_user_id            bigint,
  type                      varchar(2),
  created                   timestamp,
  expires                   timestamp,
  constraint ck_token_action_type check (type in ('EV','PR')),
  constraint uq_token_action_token unique (token),
  constraint pk_token_action primary key (id))
;

create table users (
  id                        bigint not null,
  email                     varchar(255),
  name                      varchar(255),
  last_login                timestamp,
  active                    boolean,
  email_validated           boolean,
  constraint pk_users primary key (id))
;

create table user_permission (
  id                        bigint not null,
  value                     varchar(255),
  constraint pk_user_permission primary key (id))
;


create table users_security_role (
  users_id                       bigint not null,
  security_role_id               bigint not null,
  constraint pk_users_security_role primary key (users_id, security_role_id))
;

create table users_user_permission (
  users_id                       bigint not null,
  user_permission_id             bigint not null,
  constraint pk_users_user_permission primary key (users_id, user_permission_id))
;
create sequence journey_seq;

create sequence linked_account_seq;

create sequence security_role_seq;

create sequence token_action_seq;

create sequence users_seq;

create sequence user_permission_seq;

alter table linked_account add constraint fk_linked_account_user_1 foreign key (user_id) references users (id) on delete restrict on update restrict;
create index ix_linked_account_user_1 on linked_account (user_id);
alter table token_action add constraint fk_token_action_targetUser_2 foreign key (target_user_id) references users (id) on delete restrict on update restrict;
create index ix_token_action_targetUser_2 on token_action (target_user_id);



alter table users_security_role add constraint fk_users_security_role_users_01 foreign key (users_id) references users (id) on delete restrict on update restrict;

alter table users_security_role add constraint fk_users_security_role_securi_02 foreign key (security_role_id) references security_role (id) on delete restrict on update restrict;

alter table users_user_permission add constraint fk_users_user_permission_user_01 foreign key (users_id) references users (id) on delete restrict on update restrict;

alter table users_user_permission add constraint fk_users_user_permission_user_02 foreign key (user_permission_id) references user_permission (id) on delete restrict on update restrict;

# --- !Downs

SET REFERENTIAL_INTEGRITY FALSE;

drop table if exists journey;

drop table if exists linked_account;

drop table if exists security_role;

drop table if exists token_action;

drop table if exists users;

drop table if exists users_security_role;

drop table if exists users_user_permission;

drop table if exists user_permission;

SET REFERENTIAL_INTEGRITY TRUE;

drop sequence if exists journey_seq;

drop sequence if exists linked_account_seq;

drop sequence if exists security_role_seq;

drop sequence if exists token_action_seq;

drop sequence if exists users_seq;

drop sequence if exists user_permission_seq;

I perform the following commands and to try and push to heroku (whilst in my repo directory):

git init
git add .
git commit -m "init"
git push heroku master

The logs look like this when trying to load the application:

2013-05-04T00:57:46.690449+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS:  -Djava.rmi.server.useCodebaseOnly=true
2013-05-04T00:57:47.503897+00:00 app[web.1]: Play server process ID is 2
2013-05-04T00:57:49.206353+00:00 app[web.1]: [[37minfo[0m] play - database [default] connected at jdbc:postgresql://ec2-54-235-155-40.compute-1.amazonaws.com:5432/d8837fesm242q7
2013-05-04T00:57:53.439981+00:00 app[web.1]: Oops, cannot start the server.
2013-05-04T00:57:53.439981+00:00 app[web.1]:   Position: 23 

2013-05-04T00:57:53.439981+00:00 app[web.1]: Query was:

2013-05-04T00:57:53.439981+00:00 app[web.1]: javax.persistence.PersistenceException: Query threw SQLException:ERROR: relation "security_role" does not exist
2013-05-04T00:57:53.439981+00:00 app[web.1]: Bind values:[] 

2013-05-04T00:57:53.439981+00:00 app[web.1]: from security_role t0 

.....MORE LOGS ....

2013-05-04T00:57:53.442045+00:00 app[web.1]: Caused by: org.postgresql.util.PSQLException: ERROR: relation "security_role" does not exist
2013-05-04T00:57:53.442283+00:00 app[web.1]:    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
2013-05-04T00:57:53.442149+00:00 app[web.1]:   Position: 23


.... MORE LOGS .....

2013-05-04T00:57:55.121895+00:00 heroku[web.1]: State changed from starting to crashed
2013-05-04T00:57:55.110448+00:00 heroku[web.1]: Process exited with status 255
2013-05-04T01:01:06.387417+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=serene-crag-5945.herokuapp.com fwd="82.24.103.61" dyno= connect= service= status=503 bytes=

I feel like I have tried everything at this point including resetting the heroku database. I have tried pushing the application without the default evolution and I still get the same error. I'm not sure if it has something do with the play-authenticate module as the error would suggest but I doubt it because it works locally using the H2 database without error.

  • Did you try http://stackoverflow.com/questions/12061881/heroku-app-failing-with-code-255 ? – David Sonnenfeld Jun 26 '13 at 01:32
  • Having the same issue here? Did you find a solution? – cjds Jul 07 '13 at 11:52
  • try this: delete the conf/evolutions/1.sql and do the git push heroku master to let play framework to regenerate the script, because it generates different sqls scripts per database, so maybe that 1.sql works with H2 but not with postgreSQL, the evolution plugin must not be disabled. – Miguel A. Carrasco Jul 16 '13 at 21:23

0 Answers0