CSGY-9223-Group3 / lab1

MIT License
0 stars 0 forks source link

Lab 1: Pastebin Application

This is a simple Pastebin application built with Flask, containerized using Docker and orchestrated with Docker Compose.

Prerequisites

Setup and Running the Application

Using Docker Compose

  1. Clone the Repository:

    git clone <repository_url>
    cd <repository_directory>
  2. Create a .env_file:

    Ensure you have a .env_file in the project root with the necessary environment variables. Example:

    FLASK_APP=pastebin
    FLASK_DEBUG=True
    SECRET_KEY=your_secret_key

    An example file is also available for demonstration purposes, .env_file_example. Flask debug, True for dev and False for otherwise.

  3. Build and Start the Application:

    docker-compose up --build

    This command builds the Docker image and starts the Pastebin service. The application will be accessible at http://localhost:5000.

  4. Stopping the Application:

    Press Ctrl+C in the terminal where docker-compose is running, then execute:

    docker-compose down

Without Docker (Optional)

If you prefer to run the application without Docker, follow these steps:

  1. Install Python 3.

  2. Install virtualenv:

    pip install virtualenv
  3. Create and Activate a Virtual Environment:

    virtualenv venv
    source venv/bin/activate

    On Windows, run:

    .venv\Scripts\activate
  4. Install the Required Dependencies:

    pip install -r requirements.txt
  5. Set Environment Variables from .env_file:

    export $(cat .env_file | xargs)
  6. Run the Flask Application:

    flask --env-file .env_file run

Running the Application

Using Docker Compose

To start the application with Docker Compose:

docker-compose up

Contributing

Please see CONTRIBUTING.md for guidelines on how to contribute to this project.

Security

For more details on secure coding practices, please refer to the OWASP Developer Guide and SECURITY.md.

Additional Documentation