Error deploy first time on server with postgresql database

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error deploy first time on server with postgresql database

simon
Hi I wanted to deploy the app (first time ) and created a database on the server. Then I ran bundle exec cap production deploy. I am still in my own repository, but except the addition to the Gemfile "gem 'pg'" its basically like the HEAD of master (deploy:check works).

I get the following error when db:migrate is run:

Exception while executing as simon@xxxxxxx: Exception while executing as simon@xxxxxxx: rake exit status: 1
rake stdout: == 1 CreateUsers: migrating ===================================================
-- create_table(:users)
   -> 0.0039s
-- add_index(:users, :nick, {:unique=>true})
   -> 0.0022s
-- add_index(:users, :email, {:unique=>true})
   -> 0.0018s
Creating user admin with password 'secret'...
rake stderr: rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::UndefinedTable: ERROR:  relation "settings" does not exist
LINE 5:                WHERE a.attrelid = '"settings"'::regclass
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = '"settings"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum



What is the correct workflow when deploying the first time?

- I tried deploy cap production deploy (failed)
- Then created db on server
- Run deploy production again (failed again, s. above)
- Then on server: ENV bundle exec rake db:create (but wont work as db already exist)

Sorry for the newie question, but I after having spent quite some time I hope someone can make me understand... :)

   


 



Reply | Threaded
Open this post in threaded view
|

Re: Error deploy first time on server with postgresql database

wvengen
Administrator
Hi Simon,

Deployment is still a bit under-documented (as you may have understood
from the docs/wiki).
This is the process for updating an existing installation. At the
moment, you may need to load the database schema first as well. So after
you've created the database, load the schema, and seed it (so that you
can login as admin).
RAILS_ENV=production rake db:setup will do all of this when you run it
on the server. Perhaps you need to drop the database first to start from
scratch.

- Willem
Reply | Threaded
Open this post in threaded view
|

Re: Error deploy first time on server with postgresql database

simon
Ah, oh man...

ok I db:setup worked perfectly, now I ve got the db incl. tables and was able to deploy. Hope I can get it running with apache2 now. Finally...

Thanks!!!!!