If by chance the token already exists then it will not generate the token. This probably would rarely happen on a small app with `SecureRandom.hex`, but on a larger table could be a concern.
Another way to write it could be something like
```
def generate_token
begin
self.token = SecureRandom.hex
end while self.class.exists?(token: token)
end
```
When you ssh into the EC2 instance, try doing this to get the database created.
```
sudo su
bundle exec rails db:create
exit
```
I believe they've changed the permissions of the ec2 user and you cannot login as the www user.