This guide helps you set up the necessary environment to run the project locally.
Follow these steps to set up the PostgreSQL database:
Install PostgreSQL:
Linux:
sudo apt install postgresql postgresql-contrib
Mac (using Homebrew):
brew install postgresql
Windows:
Download PostgreSQL: Download PostgreSQL version 16.2 from EnterpriseDB.
Installation Process:
- Uncheck "Stack Builder" when prompted to select components to save time.
- Use port 5432 when prompted for port selection.
- Set the temporary password for the superuser as "123123123" when prompted.
Start PostgreSQL service:
Linux and Mac:
sudo systemctl start postgresql.service
Windows: Start PostgreSQL service from the Services panel.
Create a PostgreSQL role and database:
Linux and Mac: To create a PostgreSQL role and database on Linux and Mac, execute the following commands in your terminal:
sudo -u postgres psql -c "CREATE ROLE root WITH SUPERUSER CREATEDB CREATEROLE PASSWORD '123123123';”sudo -u postgres createdb -O root resto_dev
Windows: After PostgreSQL installation:
- Create a user/role named "root" with the password "123123123".
- Create a database (not a schema) named "resto_dev".
For detailed instructions, you can refer to this guide: How to Create PostgreSQL Database and Users using psql and pgAdmin.
Follow these steps to set up the application:
Install Node.js version 16.20.2:
Linux:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt-get install -y nodejs | sudo apt-get install -y nodejs=16.20.2
MacOS:
Install Homebrew:
If Homebrew is not already installed on your system, you can install it by running the following command in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install Node.js:
Once Homebrew is installed, you can use it to install Node.js version 16.20.2. Run the following commands in your terminal:
brew install node@16.20.2 brew unlink node brew link node@16.20.2
After installation, verify that Node.js version 16.20.2 is installed by running:
node -v
If needed, you can use the
--overwriteflag withbrew linkto force linking, for example:brew link --overwrite node@16.20.2
Why unlink and then link again?
Unlinking and then linking again is necessary to set Node.js version 16.20.2 as the active version. This ensures that any existing installations of other Node.js versions do not interfere.
If both Node.js and Node.js version 16.20.2 are installed, unlinking the current version and then linking version 16.20.2 ensures that version 16.20.2 becomes the active version.
brew unlink node brew link node@16.20.2
Credit:Stack Overflow
Windows: You can download the Node.js installer directly from the official Node.js website here.
Install LoopBack CLI globally:
npm install -g loopback-cli
Install Ember CLI globally:
npm install -g ember-cli
Install PhantomJS globally:
npm install -g phantomjs phantomjs-rebuilt
Navigate to the project directory:
cd botdistrikt_testRun setup:
npm run setup
Start the backend server:
npm run dev
Navigate to the client directory:
cd clientServe the frontend:
ember serve
Start the application:
npm start
Open your web browser and navigate to:
Frontend:http://localhost:4200
Backend:http://localhost:3000/explorer
To run backend tests:
Linux and Mac:
npm testWindows:
npm run test:windows