Skip to content

wajdijurry/restaurant-app

Repository files navigation

Restaurant APP

Description:

The API Gateway for restaurant app.


Installation:

  1. Clone the repository:
git clone git@github.com:wajdijurry/restaurant-app.git
  1. Rename the file “.env.example” under “/” to “.env” then change the parameters to match your preferences, example:
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
...

Using Docker

  1. Build a new image:
docker build -t restaurant-app-image .
  1. Run the containers
docker-compose up -d

If you want to scale up the workers (sync / async), you can simply run this command:

docker-compose up --scale app=num -d

Where “num” is the number of processes to run, example:

docker-compose up --scale app=3 -d

API gateway URL (You are free to change the port through .env file)

http://localhost:1007

FYI: Database (MySQL) info (You are free to change the port through .env file):

Host: localhost:3301 

On host machine

Prerequisites

  • PHP >= 8.0
  • MySQL >= 8.0
  1. Install dependencies
chmod +x utilities/install-dependencies.sh && ./utilities/install-dependencies.sh
  1. Install PHP extensions
chmod +x utilities/install-php-extensions.sh && ./utilities/install-php-extensions.sh
  1. Install composer & APP dependencies
rm -rf vendor composer.lock && \
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
    composer clearcache && \
    composer install
  1. Prepare the app
# Make artisan executable
RUN chmod +x artisan

# Flush all cache
php artisan optimize:clear

# Execute migrations
php artisan migrate

# Seeding data
php artisan db:seed

Unit test

You need to have .env.testing file to get tests run correctly

Using docker

To run the unit test, just run this command:

docker-compose --env-file .env.testing up app-test

On host machine

vendor/bin/phpunit -c tests/phpunit.xml

About

Restaurant App Demo

Resources

Stars

Watchers

Forks