Microservice Architecture for Laravel
This project is a microservice-based architecture designed to provide scalable and maintainable solutions. It includes various technologies for managing service discovery, messaging, and data integration.
Ensure you have the following software installed:
To get a local copy of this project up and running, follow these simple steps.
git clone https://github.com/erayaydin/microservice-laravel.git
cd microservice-laravel
.env.example
to .env
:
cp .env.example .env
.env
file as needed.The configuration settings are stored in the .env
file. Customize the necessary parts as needed.
confluentinc/cp-zookeeper
7.6.1
1.1.2
confluentinc/cp-kafka
7.6.1
confluentinc/cp-schema-registry
7.6.1
confluentinc/cp-kafka-connect
7.6.1
1000
1000
[SERVICE]
microservice. Default: 15
[SERVICE]
microservice. It will be increased 1 by 1 starting from8082
.[SERVICE]
microservice. Default: off
-client_host=host.docker.internal
[SERVICE]
microservice's database. It will be increased 1 by 15432
.You need to generate a pair of 4096-bit RSA private and public keys for inter-service authentication and authorization. These keys will be shared between services.
openssl genrsa -out secrets/oauth-private.key 4096
openssl rsa -in secrets/oauth-private.key -pubout -out secrets/oauth-public.key
To start all the services, run:
docker compose up -d
This command will start all the containers defined in the docker-compose.yml file.
Remember to run migrations and necessary adjustments before testing services. Like:
docker compose exec -u app security php artisan migrate
The Security Service is responsible for handling user authentication and authorization. Authentication and authorization will be handled with OAuth2.
GET /health
: Health check endpoint. It'll respond with 200 status code.POST /users
: Create new user. It'll respond with 201 status code if success.GET /oauth/authorize
: Show authorization to the end user.POST /oauth/authorize
: Approve authorization.DELETE /oauth/authorize
: Deny authorization.GET /oauth/clients
: Get oauth clients for the user.POST /oauth/clients
: Create new oauth client.PUT /oauth/clients/{client_id}
: Update an oauth client.DELETE /oauth/clients/{client_id}
: Delete an oauth client.GET /oauth/personal-access-tokens
: Get personal access token oauth clients for the user.POST /oauth/personal-access-tokens
: Create new personal access token oauth client.DELETE /oauth/personal-access-tokens/{token_id}
: Delete a personal access token oauth client.GET /oauth/scopes
: Get all registered scopes.POST /oauth/token
: Issue new token with specified strategy.POST /oauth/token/refresh
: Refresh access token with refresh token.GET /oauth/tokens
: Get authorized access token for the user.DELETE /oauth/tokens/{token_id}
: Delete an access token.The Security Service is responsible for handling user licenses. Auth verification will be handled with JWT key decoding.
GET /health
: Health check endpoint. It'll respond with 200 status code.GET /me
: Get current user license information.GET /users/{user}
: Get user's license information. (need admin.licenses
scope).The File Management Service is responsible for handling file operations. End user can upload and download files.
GET /health
: Health check endpoint. It'll respond with 200 status code.GET /files
: List of current user's uploaded files.POST /files
: Upload new file to user's bucket.GET /files/{file}/download
: Downloads the given file in attachment mode.Kong
api-gateway to single entrypoint./users/{user}
endpoint.docker secret
to share oauth private and public keys.ObjectStorage
service to manage buckets.user.created
and license.updated
kafka messages.services
and kafka
. Use provider to bind instances with values.Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
git checkout -b feature/amazing-feature
)git commit
)git push origin feature/amazing-feature
)Distributed under the MIT License.