The API Gateway for restaurant app.
- Clone the repository:
git clone [email protected]:wajdijurry/restaurant-app.git
- 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
...
- Build a new image:
docker build -t restaurant-app-image .
- 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
Prerequisites
- PHP >= 8.0
- MySQL >= 8.0
- Install dependencies
chmod +x utilities/install-dependencies.sh && ./utilities/install-dependencies.sh
- Install PHP extensions
chmod +x utilities/install-php-extensions.sh && ./utilities/install-php-extensions.sh
- 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
- 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
You need to have
.env.testing
file to get tests run correctly
To run the unit test, just run this command:
docker-compose --env-file .env.testing up app-test
vendor/bin/phpunit -c tests/phpunit.xml