diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9861698..041e9c5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,130 +1,113 @@ -#name: auth-provider-application devsandbox -# -#on: -# push: -# branches: [ "main" ] -# -#jobs: -# build: -# -# runs-on: ubuntu-latest -# permissions: -# contents: read -# packages: write -# -# steps: -# - uses: actions/checkout@v3 -# - name: Set up JDK 17 -# uses: actions/setup-java@v3 -# with: -# java-version: '17' -# distribution: 'temurin' -# server-id: github -# settings-path: ${{ github.workspace }} -# - uses: docker/login-action@v1 -# with: -# username: ${{ secrets.DOCKER_HUB_USERNAME }} -# password: ${{ secrets.DOCKER_HUB_PASSWORD }} -# -# - name: Build with Maven -# run: mvn clean install -# -# - name: Cleaning Docker File -# uses: appleboy/ssh-action@master -# with: -# host: ${{ secrets.V4_HOST }} -# username: ${{ secrets.V4_USERNAME }} -# password: ${{ secrets.V4_VPS_PRIVATE_KEY }} -# port: 22 -# script: | -# cd /root/bloggios-deployment-docker-files -# git stash -# git pull origin main -# -# - name: Cleaning File -# uses: appleboy/ssh-action@master -# with: -# host: ${{ secrets.V4_HOST }} -# username: ${{ secrets.V4_USERNAME }} -# password: ${{ secrets.V4_VPS_PRIVATE_KEY }} -# port: 22 -# script: | -# cd /root/microservices/auth-provider-application -# git stash -# git pull origin main -# -# - name: Add Logback File -# uses: appleboy/ssh-action@master -# with: -# host: ${{ secrets.V4_HOST }} -# username: ${{ secrets.V4_USERNAME }} -# key: ${{ secrets.V4_VPS_PRIVATE_KEY }} -# port: 22 -# script: | -# rm /root/microservices/auth-provider-application/src/main/resources/auth-logback.xml -# cp /root/secrets/logback/auth-logback.xml /root/microservices/auth-provider-application/src/main/resources -# -# - name: Add Keys -# uses: appleby/ssh-action@master -# with: -# host: ${{ secrets.V4_HOST }} -# username: ${{ secrets.V4_USERNAME }} -# key: ${{ secrets.V4_VPS_PRIVATE_KEY }} -# port: 22 -# script: | -# set +e -# rm /root/microservices/auth-provider-application/src/main/resources/security/privkey.pem -# /root/microservices/auth-provider-application/src/main/resources/security/pubkey.pem -# set -e -# cp /root/spring-boot/certificates/privkey.pem /root/microservices/auth-provider-application/src/main/resources/security -# cp /root/spring-boot/certificates/pubkey.pem /root/microservices/auth-provider-application/src/main/resources/security -# -# - name: Stopping Container -# uses: appleboy/ssh-action@master -# with: -# host: ${{ secrets.V4_HOST }} -# username: ${{ secrets.V4_USERNAME }} -# key: ${{ secrets.V4_VPS_PRIVATE_KEY }} -# port: 22 -# script: | -# cd /root/bloggios-deployment-docker-files -# set +e -# docker-compose -f docker-compose-devsandbox.yml stop auth-provider-application -# docker-compose -f docker-compose-devsandbox.yml stop auth-provider-social-application -# docker rmi -f auth-provider-application:1.0 -# set -e -# -# - name: Generating Docker Image -# uses: appleboy/ssh-action@master -# with: -# host: ${{ secrets.V4_HOST }} -# username: ${{ secrets.V4_USERNAME }} -# key: ${{ secrets.V4_VPS_PRIVATE_KEY }} -# port: 22 -# script: | -# cd /root/microservices/auth-provider-application -# chmod +x mvnw -# ./mvnw clean package -# -# - name: Deploy Docker Image -# uses: appleboy/ssh-action@master -# with: -# host: ${{ secrets.V4_HOST }} -# username: ${{ secrets.V4_USERNAME }} -# key: ${{ secrets.V4_VPS_PRIVATE_KEY }} -# port: 22 -# script: | -# cd /root/bloggios-deployment-docker-files -# docker-compose -f docker-compose-devsandbox.yml up -d auth-provider-application -# docker-compose -f docker-compose-devsandbox.yml up -d auth-provider-social-application -# -# - name: Cleaning Targets -# uses: appleboy/ssh-action@master -# with: -# host: ${{ secrets.V4_HOST }} -# username: ${{ secrets.V4_USERNAME }} -# key: ${{ secrets.V4_VPS_PRIVATE_KEY }} -# port: 22 -# script: | -# cd /root/microservices/auth-provider-application -# rm target -r \ No newline at end of file +name: bloggios-mail-service devsandbox + +on: + push: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + server-id: github + settings-path: ${{ github.workspace }} + - uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Build with Maven + run: mvn clean install + + - name: Cleaning Docker File + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.V4_HOST }} + username: ${{ secrets.V4_USERNAME }} + password: ${{ secrets.V4_VPS_PRIVATE_KEY }} + port: 22 + script: | + cd /root/bloggios-deployment-docker-files + git stash + git pull origin main + + - name: Cleaning File + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.V4_HOST }} + username: ${{ secrets.V4_USERNAME }} + password: ${{ secrets.V4_VPS_PRIVATE_KEY }} + port: 22 + script: | + cd /root/microservices/bloggios-mail-service + git stash + git pull origin main + + - name: Add Logback File + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.V4_HOST }} + username: ${{ secrets.V4_USERNAME }} + key: ${{ secrets.V4_VPS_PRIVATE_KEY }} + port: 22 + script: | + rm /root/microservices/bloggios-mail-service/src/main/resources/mail-logback.xml + cp /root/secrets/logback/mail-logback.xml /root/microservices/bloggios-mail-service/src/main/resources + + - name: Stopping Container + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.V4_HOST }} + username: ${{ secrets.V4_USERNAME }} + key: ${{ secrets.V4_VPS_PRIVATE_KEY }} + port: 22 + script: | + cd /root/bloggios-deployment-docker-files + set +e + docker-compose -f docker-compose-devsandbox.yml stop bloggios-mail-service + docker rmi -f bloggios-mail-service:1.0 + set -e + + - name: Generating Docker Image + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.V4_HOST }} + username: ${{ secrets.V4_USERNAME }} + key: ${{ secrets.V4_VPS_PRIVATE_KEY }} + port: 22 + script: | + cd /root/microservices/bloggios-mail-service + chmod +x mvnw + ./mvnw clean package + + - name: Deploy Docker Image + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.V4_HOST }} + username: ${{ secrets.V4_USERNAME }} + key: ${{ secrets.V4_VPS_PRIVATE_KEY }} + port: 22 + script: | + cd /root/bloggios-deployment-docker-files + docker-compose -f docker-compose-devsandbox.yml up -d bloggios-mail-service + + - name: Cleaning Targets + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.V4_HOST }} + username: ${{ secrets.V4_USERNAME }} + key: ${{ secrets.V4_VPS_PRIVATE_KEY }} + port: 22 + script: | + cd /root/microservices/bloggios-mail-service + rm target -r \ No newline at end of file diff --git a/README.md b/README.md index 9e96f71..bcd9a00 100644 --- a/README.md +++ b/README.md @@ -28,16 +28,22 @@ ## πŸ€– Introduction -Built using Java 17 and Spring Boot, the mail is central to all notification functions using mail within a system, ensuring scalability and enhancing user experience through various features. +Bloggios Mail Service, constructed with Java 17, Spring Boot, Java Mail, and Kafka, facilitates seamless email +notifications in HTML format using Thymeleaf. This robust combination allows for efficient handling of email +functionalities, ensuring reliable delivery of messages. Leveraging Kafka enables asynchronous processing, enhancing +performance and scalability. With its integration of Thymeleaf, personalized and visually appealing email templates can +be effortlessly created and dispatched. Bloggios Mail Service simplifies the process of sending dynamic email +notifications, making it an indispensable tool for various applications and businesses. ## Key Features -- **Consuming Kafka Events**: Automatically sending mail as soon as receiving any event from Kafka. -- **Sending HTML Mails**: Sending mails in more user friendly Interface with Thymeleaf. -- **Persisting Mail Records**: Persisting each and every record of mails in Postgres Database -- **OTP Management**: Handles the generation and validation of one-time passwords for 2FA or account recovery, adding an extra layer of security. +- **HTML Email Support:** Enables sending of visually rich HTML-formatted emails. +- **Thymeleaf Integration:** Utilizes Thymeleaf for easy creation of dynamic and personalized email templates. +- **Asynchronous Processing with Kafka:** Enhances performance by leveraging Kafka for asynchronous message processing. +- **Java Mail API:** Integrates Java Mail API for reliable and efficient email handling. -Join our newly active Discord community for support, bug reporting, and feature requests. Here, we strive to address every issue, and developers and testers can collaborate and assist each other effectively. +Join our newly active Discord community for support, bug reporting, and feature requests. Here, we strive to address +every issue, and developers and testers can collaborate and assist each other effectively. Discord @@ -48,13 +54,13 @@ Join our newly active Discord community for support, bug reporting, and feature - Java 17 - Spring Boot - PostgreSQL -- Elasticsearch -- OAuth2.0 - Kafka ## πŸ”‹ API Documentation -To help you get started with our API and understand all its features and endpoints, we have created detailed documentation available on Postman. This documentation includes comprehensive information about each endpoint, including: +To help you get started with our API and understand all its features and endpoints, we have created detailed +documentation available on Postman. This documentation includes comprehensive information about each endpoint, +including: - **Endpoint URLs**: Specific paths to access various functionalities. - **HTTP Methods**: The method type (GET, POST, PUT, DELETE, etc.) for each endpoint. @@ -66,12 +72,16 @@ To help you get started with our API and understand all its features and endpoin To access the documentation: 1. **Visit our Postman Documentation Page**: [Visit Documentation](https://www.postman.com/rohit-zip/workspace/bloggios) -2. **Explore the Collection**: Navigate through the collection to find detailed descriptions and examples for each endpoint. -3. **Run Requests Directly in Postman**: Use the "Run in Postman" button to directly import the collection into your Postman workspace for testing and exploration. +2. **Explore the Collection**: Navigate through the collection to find detailed descriptions and examples for each + endpoint. +3. **Run Requests Directly in Postman**: Use the "Run in Postman" button to directly import the collection into your + Postman workspace for testing and exploration. -By leveraging the Postman documentation, you can quickly integrate our API into your application and take full advantage of its capabilities. +By leveraging the Postman documentation, you can quickly integrate our API into your application and take full advantage +of its capabilities. -For any further assistance, feel free to contact our support team or refer to the additional resources section in the documentation. +For any further assistance, feel free to contact our support team or refer to the additional resources section in the +documentation. ## 🀸 Quick Start @@ -101,6 +111,7 @@ We recommended Intellij Idea Make sure you have Java 17 Installed in your system Please execute the below command to check installed version of Java in your system + ```bash java --version ``` @@ -110,6 +121,7 @@ java --version Navigate to `src/main/resources/application.yml` and add the required environment variables If you are new at setting environment variables the please go through the below videos + - Intellij Idea [See Video](https://www.youtube.com/watch?v=jNOh4jQJG2U) - Eclipse or STS [See Video](https://www.youtube.com/watch?v=ypvGDkbp8Ac) @@ -119,6 +131,10 @@ POSTGRES_DATABASE -> Postgresql Database name POSTGRES_HOST -> Postgres Database Host POSTGRES_PASSWORD -> Postgres Database Password POSTGRES_USERNAME -> Postgresq Database Username +MAIL_HOST -> Mail Host +MAIL_PORT +MAIL_USERNAME -> Username of Mail +MAIL_PASSWORD -> Password of Mail ``` Replace the placeholder values with your actual credentials @@ -141,9 +157,11 @@ If you wish to contribute, you can, - Improve documentation. - Create content about Bloggios and share it with the world. -> Please read [`CONTRIBUTING`](CONTRIBUTING.md) for details on our [`CODE OF CONDUCT`](CODE_OF_CONDUCT.md), and the process for submitting pull requests to us. +> Please read [`CONTRIBUTING`](CONTRIBUTING.md) for details on our [`CODE OF CONDUCT`](CODE_OF_CONDUCT.md), and the +> process for submitting pull requests to us. -πŸ†• New to Open Source? πŸ’‘ Follow this [guide](https://opensource.guide/how-to-contribute/) to jumpstart your Open Source journey πŸš€. +πŸ†• New to Open Source? πŸ’‘ Follow this [guide](https://opensource.guide/how-to-contribute/) to jumpstart your Open Source +journey πŸš€. ## πŸ”— Links @@ -156,7 +174,8 @@ If you wish to contribute, you can, ## πŸ™Support -We all need support and motivation. `Bloggios` is not an exception. Please give this project repositories a ⭐️ to encourage and show that you liked it. Don't forget to leave a star ⭐️ before you move away. +We all need support and motivation. `Bloggios` is not an exception. Please give this project repositories a ⭐️ to +encourage and show that you liked it. Don't forget to leave a star ⭐️ before you move away. If you found the app helpful, consider supporting us with a coffee. diff --git a/pom.xml b/pom.xml index a2b7524..9cb8d1e 100644 --- a/pom.xml +++ b/pom.xml @@ -9,10 +9,10 @@ com.bloggios.email - bloggios-email-service + bloggios-mail-service 1.0 - bloggios-email-service - bloggios-email-service + bloggios-mail-service + bloggios-mail-service 17 2021.0.3