Sign inSign up

akgarg0472/urlshortener-profile-service

By akgarg0472

Updated over 1 year ago

A Spring Boot-based micro service for managing user profiles in the URL Shortener system.

Image
API management
0

2.2K

akgarg0472/urlshortener-profile-service repository overview

URL Shortener Profile Service

The URL Shortener Profile Service enables users to manage their profiles and shorten URLs. It is built with Spring Boot and JPA, using MySQL for database storage. The service is Dockerized for easy deployment and scalability.

Key Features:

  • URL Shortening: Shortens URLs and stores user profile data.
  • MySQL Integration: Uses MySQL for storing profile and URL data.
  • Kafka Integration: Sends notifications through Kafka topics.
  • Cloudinary Support: Integrates with Cloudinary for media storage.
Prerequisites:
  • Java 21+ (JDK)
  • Maven
  • Docker

Running the Docker Container:

docker run --network=host \
           -e SPRING_DATASOURCE_URL="jdbc:mysql://localhost:3306/db_name?useSSL=false&allowPublicKeyRetrieval=true" \
           -e SPRING_DATASOURCE_USERNAME="root" \
           -e SPRING_DATASOURCE_PASSWORD="root" \
           -e SPRING_PROFILES_ACTIVE="prod" \
           -e SPRING_KAFKA_NOTIFICATION_TOPIC_NAME="urlshortener.notifications.email" \
           -e CLOUDINARY_URL="cloudinary://<your_api_key>:<your_api_secret>@cloud_name" \
           akgarg0472/urlshortener-profile-service:tag
Explanation:
  • -e: The -e flag is used to set environment variables inside the Docker container, which control various application settings.
Environment Variables:
  1. SPRING_DATASOURCE_URL:
    Defines the JDBC URL for connecting to the MySQL database, including details like host, port, database name, and additional connection parameters (e.g., disabling SSL, setting the server timezone).

  2. SPRING_DATASOURCE_USERNAME:
    Specifies the username for accessing the MySQL database.

  3. SPRING_DATASOURCE_PASSWORD:
    Sets the password for the MySQL database connection.

  4. SPRING_PROFILES_ACTIVE:
    Sets the active Spring profile to prod, enabling production-specific configurations, such as database connections, Kafka, and other necessary services.

  5. SPRING_KAFKA_NOTIFICATION_TOPIC_NAME:
    Specifies the Kafka topic name used for sending email notifications (urlshortener.notifications.email).

  6. CLOUDINARY_URL:
    Provides the Cloudinary URL for media storage (e.g., profile images), which is required in the production profile to upload and store media.

Additional Flags:
  • --network=host:
    Configures the container to use the host machine's network, enabling it to directly communicate with services like MySQL and Kafka running on the host machine.

  • akgarg0472/urlshortener-profile-service:tag:
    Refers to the Docker image to be used, with the repository name akgarg0472/urlshortener-profile-service and the specified tag (version) of the image.

For more details or customization, you can refer to the GitHub repository.

Tag summary

Content type

Image

Digest

sha256:f169d28ae

Size

160.2 MB

Last updated

over 1 year ago

docker pull akgarg0472/urlshortener-profile-service