Skip to content

Commit

Permalink
fix(provision): Fix provision script for vagrant env
Browse files Browse the repository at this point in the history
  • Loading branch information
jegj committed Feb 9, 2022
1 parent 9f2d5cd commit 8d2f968
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions vagrant/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ mkdir -p /vagrant/tmp/log
HOSTS=/etc/hosts

print_db_usage() {
echo "Your environment has been setup:"
echo ""
echo " Port: $PGPORT"
echo " Database: $PGDATABASE"
echo " Username: $PGUSER"
echo " Password: $PGPASSWORD"
echo ""
echo "psql access to app database user via VM:"
echo " vagrant ssh"
echo " sudo su - postgres"
echo " PGUSER=$PGUSER PGPASSWORD=$PGPASSWORD psql -h localhost $PGDATABASE"
echo ""
echo "Env variable for application development:"
echo " DATABASE_URL=postgresql://$PGUSER:$PGPASSWORD@*:$PGPORT/$PGDATABASE"
echo ""
echo "Local command to access the database via psql:"
echo " PGUSER=$PGUSER PGPASSWORD=$PGPASSWORD psql -h localhost -p $PGPORT $PGDATABASE"
echo ""
echo " Getting into the box (terminal):"
echo " vagrant ssh"
echo " sudo su - postgres"
echo ""
echo "Your environment has been setup:"
echo ""
echo " Port: $PGPORT"
echo " Database: $PGDATABASE"
echo " Username: $PGUSER"
echo " Password: $PGPASSWORD"
echo ""
echo "psql access to app database user via VM:"
echo " vagrant ssh"
echo " sudo su - postgres"
echo " PGUSER=$PGUSER PGPASSWORD=$PGPASSWORD psql -h localhost $PGDATABASE"
echo ""
echo "Env variable for application development:"
echo " DATABASE_URL=postgresql://$PGUSER:$PGPASSWORD@*:$PGPORT/$PGDATABASE"
echo ""
echo "Local command to access the database via psql:"
echo " PGUSER=$PGUSER PGPASSWORD=$PGPASSWORD psql -h localhost -p $PGPORT $PGDATABASE"
echo ""
echo " Getting into the box (terminal):"
echo " vagrant ssh"
echo " sudo su - postgres"
echo ""
}

export DEBIAN_FRONTEND=noninteractive
Expand All @@ -49,8 +49,8 @@ PROVISIONED_ON=/etc/vm_provision_on_timestamp
echo "install postgresql..."
PG_REPO_APT_SOURCE=/etc/apt/sources.list.d/pgdg.list
if [ ! -f "$PG_REPO_APT_SOURCE" ]; then
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >"$PG_REPO_APT_SOURCE"
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >"$PG_REPO_APT_SOURCE"
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
fi

apt-get update
Expand All @@ -69,7 +69,7 @@ EOF
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" "$PG_CONF"

if [ ! -z "$PGPORT" ]; then
sed -i "/port = /c\port = $PGPORT" "$PG_CONF"
sed -i "/port = /c\port = $PGPORT" "$PG_CONF"
fi

echo "host all all all md5" >>"$PG_HBA"
Expand Down Expand Up @@ -101,7 +101,7 @@ echo "install node version ${NODE_VER}"
sudo apt-get install -y nodejs

echo "install competitors"
pip install pganonymize
sudo pip install pganonymize

# Tag the provision time:
date >"$PROVISIONED_ON"
Expand Down

0 comments on commit 8d2f968

Please sign in to comment.