Addressing the problem of losing access in admin side after a deploy in staging

0 views
Skip to first unread message

Fabio Maia

unread,
Apr 4, 2013, 7:57:01 PM4/4/13
to VilaPinto
Hey guys,

Glauber told me we cannot login in admin side after a deploy.
He said this is happening after we reset the database during the
deploy to the staging environment.

After some digging I realize the entries in user table are wiped out
but the admin user is not created again when we deploy VP.

I fixed the problem adding some code in the seed.rb file. Now the
script checks if we have at least one user, and if not, the script
creates a default admin user.

Also I added two ENV vars in heroku to keep the email and password of
the first user that we need to create.

The variables exists both in staging and production with the following values:

in staging:
FIRST_USER_EMAIL: ad...@example.com
FIRST_USER_PASSWORD: twvilapinto_staging

in production:
FIRST_USER_EMAIL: ad...@example.com
FIRST_USER_PASSWORD: twvilapinto_production

Now when the seed.rb creates all default data for the site we use
these values to save the first user.

If we are in the development mode, I mean, in this mode these
variables are not being defined, the seed.rb file assumes the
following values to the first user:

FIRST_USER_EMAIL: ad...@example.com
FIRST_USER_PASSWORD: password

Let me know if the problem persists.

Regards,

Fabio Maia.
Reply all
Reply to author
Forward
0 new messages