Skip to content

Deploy of webapp ended up without couch migrations

bneg test installed leap and ran into an unusable webapp. I tracked this down to a permission error when trying to access the couch. This was caused because the design documents had not yet been copied to the couch. Since they were not present the webapp tried to add them which is not allowed with the permissions the webapp has.

Long term fix for this is to deploy the couch design docs with the couch and not the webapp. But I think it would still be good to investigate this.

Here's the end of my debugging session:

root@leapweb:/srv/leap/webapp# curl -k -X POST https://localhost:4430/1/users.json -d "user[login]=test&user[password_salt]=2941e6422b99f526&user[password_verifier]=d9e07ca7ff0d36e98397d7766451c00bbb4b453e5614efc6fc62eb1d57da76cd530ef03b3cc4cc92553ca0ff3af0fb743fddc4893bb49dad6450d43fc6532300d6f8368139c5d75e8477206e9d79ba19d218d1ba71ae9b2a990fc60847cbc5db10818968f32dbbf559c557351a0284be8696687aee370bba783aeb2a8b844d74"

500

root@leapweb:/srv/leap/webapp# cp config/couchdb.yml.admin config/couchdb.yml

root@leapweb:/srv/leap/webapp# RAILS_ENV=production bundle exec rake couchrest:migrate
Migrating Customer#design_doc... created
Migrating User#design_doc... created
Migrating Token#design_doc... created
Migrating Identity#design_doc... created
Migrating Ticket#design_doc... created

root@leapweb:/srv/leap/webapp# RAILS_ENV=production bundle exec rake couchrest:migrate
Migrating Customer#design_doc... migrated
Migrating User#design_doc... migrated
Migrating Token#design_doc... migrated
Migrating Identity#design_doc... migrated
Migrating Ticket#design_doc... migrated
Activating new design: /customers/_design/Customer
Activating new design: /users/_design/User
Activating new design: /tokens/_design/Token
Activating new design: /identities/_design/Identity
Activating new design: /tickets/_design/Ticket

root@leapweb:/srv/leap/webapp# cp config/couchdb.yml.webapp config/couchdb.yml 
root@leapweb:/srv/leap/webapp# touch tmp/restart.txt 

root@leapweb:/srv/leap/webapp# curl -k -X POST https://localhost:4430/1/users.json -d "user[login]=test&user[password_salt]=2941e6422b99f526&user[password_verifier]=d9e07ca7ff0d36e98397d7766451c00bbb4b453e5614efc6fc62eb1d57da76cd530ef03b3cc4cc92553ca0ff3af0fb743fddc4893bb49dad6450d43fc6532300d6f8368139c5d75e8477206e9d79ba19d218d1ba71ae9b2a990fc60847cbc5db10818968f32dbbf559c557351a0284be8696687aee370bba783aeb2a8b844d74"
root@leapweb:/srv/leap/webapp# cp config/couchdb.yml.webapp config/couchdb.yml

{"login":"test","ok":true}

(from redmine: created on 2013-11-12, closed on 2013-11-12, relates #3771 (closed), relates #3599 (closed), relates #3768 (closed))