Skip to content

Environment Setup: First Run

Sayem Hossain edited this page Nov 20, 2022 · 22 revisions

Clone Project

  • Clone this project

git clone --recursive git@github.com:teambankrupt/open-project-bankrupt.git

If you've already cloned without the --recursive flag, you need to load the submodules by running

git submodule update --init --recursive

This will clone all the submodule repositories to your main git repository.

  • Extra Information (only use when needed)

Update all submodules to the latest revision

git submodule update --remote or git checkout master && git submodule foreach 'git pull'

You can execute any git command individually for each submodule repo using this foreach command Ex, resetting all submodules to HEAD will be like

git submodule foreach 'git reset --hard HEAD'

Database Setup

Postgres

(In case if you intend to use postgres database)

Download and install postgres in your computer. add postgres bin folder to your $PATH if necessary.

  • Switch to postgres user

sudo -i -u postgres

(if you're on windows you won't need to exec above command.)

  • Login to Postgres shell:

psql -U postgres

It will ask you for password for that user. Provide it.

If you are on mac (homebrew) psql postgres

  • Create Database

CREATE DATABASE demodb;

  • Create User and grant that user access to this database

CREATE USER demouser WITH ENCRYPTED PASSWORD 'demopass';

ALTER DATABASE demodb OWNER TO demouser;

GRANT ALL PRIVILEGES ON DATABASE demodb TO demouser;

  • Import baseline Schema File

Now, download baseline schema file from here

baseline.sql

Import this file in your newly created database psql -U demouser demodb < baseline.sql

(Or if it doesn't work full command is psql -h localhost -d demodb -U demouser < baseline.sql)

Now run mvn clean install. it should build the project successfully if everything went okay. 👍


Extra (For convenience)

  • Backup Postgres database

pg_dump -h localhost -U demouser demodb>demodb_backup.sql

  • Restore Postgres Database

psql -h localhost -U demouser demodb < demodb_backup.sql