Cannot run HAT 2.0


#1

Hi,

I used to run the project successfully. After I reset my laptop, clone the project (https://github.com/Hub-of-all-Things/HAT2.0) again, and run it, I got the problem.

What I did is:

  1. install Postgres (used default settings, and set password for postgres)
  2. clone HAT 2.0
    When I run this command line sh deployment/deploy.sh, I got errors
Setting up database user and database
dbuser: hat20, database: hat20
Password: 
createuser: could not connect to database postgres: FATAL:  password authentication failed for user "luongbalinh"
Password: 
createdb: database creation failed: ERROR:  permission denied to create database
Password: ```

Here, **luongbalinh** is my Macbook user. I keyed in password for **luongbalinh** in this case.

I also tried to switch to **postgres** user, I got errors too.

```luongbalinh$ su postgres
Password:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
bash-3.2$ sh deployment/desymlink-hook: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
ploy.sh 
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
Setting up database user and database
dbuser: hat20, database: hat20
could not identify current directory: Permission denied
Password: ```


Last point, I did not see directory **universal** as mentioned in the instruction:

```Execute the following command:

./target/universal/stage/bin/the-hat```

Please give advice. Thank you!

#2

Hi @luongbalinh,

If you take a look at the contents of the script, it fails at:

echo "Setting up database user and database"
echo "dbuser: $DBUSER, database: $DATABASE"
createuser -S -D -R -e $DBUSER
createdb $DATABASE -O $DBUSER
psql $DATABASE -c “ALTER USER $DBUSER WITH PASSWORD ‘$DBPASS’;”

These are completely standard psotgresql utility tools and I can not comment much on the specific configuration you have on your machine. The problem is not specific to the HAT - you will simply need to find a way of properly installing a PostgreSQL server on your development machine, create database and a corresponding role, giving it access to the database. Default name is hat20 for both database name and password, but that can be controlled with environment variables.

Good luck