Update database config
This commit is contained in:
parent
90e02c5624
commit
414f3f9b73
11
README.md
11
README.md
|
@ -35,10 +35,12 @@ call the new file ``app.py``.
|
||||||
Create a PostgreSQL database called *devicehub* by running
|
Create a PostgreSQL database called *devicehub* by running
|
||||||
[create-db](examples/create-db.sh):
|
[create-db](examples/create-db.sh):
|
||||||
|
|
||||||
- In a Debian 9 terminal, execute the following two commands:
|
- In a Debian 9 bash terminal, execute the following two commands:
|
||||||
1. `sudo su - postgres`.
|
1. `sudo su - postgres`.
|
||||||
2. `bash examples/create-db.sh devicehub`.
|
2. `bash examples/create-db.sh devicehub dhub`,
|
||||||
- In MacOS: `examples/create-db.sh devicehub`.
|
and password `ereuse`.
|
||||||
|
- In MacOS: `bash examples/create-db.sh devicehub dhub`,
|
||||||
|
and password `ereuse`.
|
||||||
|
|
||||||
Create the tables in the database by executing in the same directory
|
Create the tables in the database by executing in the same directory
|
||||||
where `app.py` is:
|
where `app.py` is:
|
||||||
|
@ -85,7 +87,8 @@ To run the tests you will need to:
|
||||||
1. `git clone` this project.
|
1. `git clone` this project.
|
||||||
2. Create a database for testing executing `create-db.sh` like
|
2. Create a database for testing executing `create-db.sh` like
|
||||||
the normal installation but changing the first parameter
|
the normal installation but changing the first parameter
|
||||||
from `devicehub` to `dh_test`: `create-db.sh dh_test`.
|
from `devicehub` to `dh_test`: `create-db.sh dh_test dhub` and
|
||||||
|
password `ereuse`.
|
||||||
3. Execute at the root folder of the project `python3 setup.py test`.
|
3. Execute at the root folder of the project `python3 setup.py test`.
|
||||||
|
|
||||||
## Generating the docs
|
## Generating the docs
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Creates a database, user, and extensions to use Devicehub
|
# Creates a database, user, and extensions to use Devicehub
|
||||||
|
# $1 is the database to create
|
||||||
|
# $2 is the user to create and give full permissions on the database
|
||||||
|
# This script asks for the password of such user
|
||||||
|
|
||||||
|
read -s -p "Password for $2": pass
|
||||||
createdb $1 # Create main database
|
createdb $1 # Create main database
|
||||||
psql -d $1 -c "CREATE USER dhub WITH PASSWORD 'ereuse';" # Create user Devicehub uses to access db
|
psql -d $1 -c "CREATE USER $2 WITH PASSWORD '$pass';" # Create user Devicehub uses to access db
|
||||||
psql -d $1 -c "GRANT ALL PRIVILEGES ON DATABASE $1 TO dhub;" # Give access to the db
|
psql -d $1 -c "GRANT ALL PRIVILEGES ON DATABASE $1 TO $2;" # Give access to the db
|
||||||
psql -d $1 -c "CREATE EXTENSION pgcrypto SCHEMA public;" # Enable pgcrypto
|
psql -d $1 -c "CREATE EXTENSION pgcrypto SCHEMA public;" # Enable pgcrypto
|
||||||
psql -d $1 -c "CREATE EXTENSION ltree SCHEMA public;" # Enable ltree
|
psql -d $1 -c "CREATE EXTENSION ltree SCHEMA public;" # Enable ltree
|
||||||
psql -d $1 -c "CREATE EXTENSION citext SCHEMA public;" # Enable citext
|
psql -d $1 -c "CREATE EXTENSION citext SCHEMA public;" # Enable citext
|
||||||
|
|
Reference in New Issue