Skip to content

Commit

Permalink
INSTALL Create db user before db
Browse files Browse the repository at this point in the history
  • Loading branch information
hypsug0 committed Mar 17, 2024
1 parent 16e32df commit f6ec69d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion install/create_db.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
echo "Creating Citizen database..."
echo "SELECT 'CREATE DATABASE $pg_dbname' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$pg_dbname')\gexec" | sudo -u postgres psql
echo "SELECT 'CREATE DATABASE $pg_dbname OWNER $user_pg' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$pg_dbname')\gexec" | sudo -u postgres psql
sudo -u postgres -s psql -d $pg_dbname -c "CREATE EXTENSION IF NOT EXISTS postgis;"
2 changes: 1 addition & 1 deletion install/create_db_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if [ ${user_pg_exists} -eq 0 ]; then
sudo -u postgres -s psql -c "CREATE ROLE $user_pg WITH LOGIN PASSWORD '$user_pg_pass';"
fi
# Always grant ownership on the newly created database
sudo -u postgres psql -c "ALTER DATABASE ${pg_dbname} OWNER TO ${user_pg};"
# sudo -u postgres psql -c "ALTER DATABASE ${pg_dbname} OWNER TO ${user_pg};"
5 changes: 2 additions & 3 deletions install/install_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ sudo apt -y install gcc curl gunicorn python3-setuptools lsb-release \
libxrender-dev postgresql postgis python3 python3-dev python3-venv python3-pip

sudo apt-get clean
# Add a new user in database
. ./install/create_db_user.sh

# Create the database
. ./install/create_db.sh

# Add a new user in database
. ./install/create_db_user.sh


#Installation de nvm / npm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Expand Down

0 comments on commit f6ec69d

Please sign in to comment.