Giter Club home page Giter Club logo

pastebin-copy's Introduction

Pastebin Clone

This repository contains a clone of Pastebin, a web application that allows users to store plain text or code snippets for public viewing. This implementation enhances the standard Pastebin by incorporating modern technologies such as Spring Boot, PostgreSQL, Amazon S3 for storage, and Docker for easy deployment and scalability through load balancing.

Features

  • Text and Code Snippet Storage: Users can store text or code snippets.
  • Hash Generation: Each paste generates a unique hash which can be used to retrieve the stored data.
  • Persistence: Pastes are persistently stored in a PostgreSQL database and Amazon S3.
  • Scalability: Application is containerized using Docker, with nginx used as a load balancer to distribute requests across multiple instances.

Technology Stack

  • Spring Boot: For creating the application framework.
  • PostgreSQL: Database for storing metadata and hashes.
  • Amazon S3: Used for storing the actual text snippets.
  • Docker: For containerizing the application and ensuring consistency across multiple environments.
  • Nginx: As a reverse proxy and load balancer to distribute client requests efficiently.

Local Setup

Prerequisites

  • Docker
  • Docker Compose
  • JDK 21 (Ensure JDK version compatibility with your Spring Boot version)
  • Gradle (Optional: If not using Docker for everything)

Steps to Setup

  1. Clone the repository

    git clone https://github.com/MaksimSinyu/pastebin-copy
    cd pastebin-copy
  2. Build and run the Docker containers

    This command will start all the necessary services defined in docker-compose.yml, including the application servers, load balancer, and the database.

    docker-compose up --build

Environment Configuration

Before running the application, ensure you have the appropriate .env files set up in the project directory for Docker to use. These should contain your environment-specific configurations such as database URLs, credentials, and Amazon S3 access keys.

Usage

Once the application is running, navigate to http://localhost:8080 to access the load balancer, which will redirect you to one of the available application instances.

  • Create Paste:

    curl -X POST http://localhost:8080/api/v1/paste -H 'Content-Type: text/plain' -d 'Hello, Pastebin!'
    
  • Get paste by hash:

    curl http://localhost:8080/api/v1/paste/<paste-hash>

pastebin-copy's People

Contributors

gameusertop4ikf avatar maksimsinyu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.