Welcome to Marketplace project, This project involves the following technologies:
- PHP 7.3 - using phalcon framework
- MySQL 8
- Redis
- MongoDB
- GraphQL
- RabbitMQ
- Docker
This service handles categories functionality, including CRUDs, processing and handling all logic related to categories.
- Clone the repository:
git clone [email protected]:Marketplace-Express/shop_categories.git
2- Rename file “config.example.php” under “app/config” to “config.php” then change the parameters to match your preferences, example:
return new \Phalcon\Config([
'database' => [
'adapter' => 'Mysql',
'host' => 'marketplace-mysql container ip',
'port' => 3306,
'username' => 'mysql-username',
'password' => 'mysql-password',
'dbname' => 'shop_categories',
'charset' => 'utf8'
],
'mongodb' => [
'host' => 'marketplace-mongo container ip',
'port' => 27017,
'username' => null,
'password' => null,
'dbname' => 'shop_categories'
],
...
]);
And so on for Redis and RabbitMQ ...
Note: You can use network (marketplace-network) gateway ip instead of providing each container ip
- Build a new image:
docker-compose build
5- Run docker-compose up -d
, This command will create new containers:
- shop_categories_categories-sync_1:
- This will declare a new queue “categories_sync” in RabbitMQ queues list
- shop_categories_categories-async_1:
- This will declare a new queue “categories_async” in RabbitMQ queues list
- shop_categories_categories-api_1:
- This will start a new application server listening on a specific port specified in
docker-compose.yml
file, you can access it by going to this URL: http://localhost:port - As a default, the port value is 1000.
- You can use Postman with the collections provided to test micro service APIs.
- shop_categories_categories-unit-test_1:
- This will run the unit test for this micro-service
If you want to scale up the workers (sync / async), you can simply run this command:
docker-compose up --scale categories-{sync/async}=num -d
Where “num” is the number of processes to run, {sync/async} is the service which you want to scale up, example:
docker-compose up --scale categories-async=3 -d
To run the unit test, just run this command:
docker-compose up categories-unit-test