Skip to content

zaidaiman/cdn

Repository files navigation

Complete Developer Network

Description

This project consists of multiple components to handle different aspects of the Complete Developer Network:

  • CDNAPI: Handles API requests and responses.
  • CDNDomain: A library used by CDNAPI to manage domain definitions.
  • Terraform: Manages EC2 deployment and infrastructure as code.

Table of Contents

Prerequisites

  • .NET SDK 8.0 or later
  • PostgreSQL
  • Terraform
  • AWS CLI (for deployment)

Installation

  1. Clone the repository:

    git clone git@github.com:zaidaiman/cdn.git
    cd cdn
  2. Restore and build solution:

    dotnet restore
    dotnet build
  3. Build webapp:

    cd webapp
    npm i

Notes

  1. With the recent release of Apple Sequoia OS, Apple has changed how it handle certificates, which resulted failure when perform dotnet dev-certs https --trust. The team at Microsoft is working on it and scheduled to release by Oct 2024: dotnet/announcements#324.

  2. I have made the changes so that https redirection only happens when it is not in development environment.

Usage

  1. Run the API in project root directory:

    dotnet run --project CDNAPI/CDNAPI.csproj
  2. Navigate to http://localhost:5007/swagger/index.html to view the API documentation.

  3. Run the webapp in webapp directory:

    npm start
    # default url should be http://localhost:4200

Configuration

  1. For development, create appSettings.Development.json

    {
      "ConnectionStrings": {
        "DefaultConnection": "Host=localhost;Database=freelancer;Username=user;Password=password"
      },
      "Jwt": {
        "Key": "<generate-issuer-key>",
        "Issuer": "Complete Developer Network",
        "Audience": "Complete Developer Network API"
      },
      "Logging": {
        "LogLevel": {
          "Default": "Information",
          "Microsoft.AspNetCore": "None",
          "Microsoft.Hosting.Lifetime": "None"
        }
      }
    }
  2. To generate issuer key, run the following command and replace the value in appSettings.Development.json:

    openssl rand -base64 32

Project Structure

complete-developer-network/
├── CDNAPI/                # API project
├── CDNDomain/             # Domain library
├── terraform/             # Terraform scripts for deployment
├── webapp/                # Simple web app demo
├── docker-compose.yml     # Docker compose file
├── Dockerfile             # Dockerfile for CDNAPI build
├── README.md              # Project documentation
└── LICENSE                # License file

Testing

  1. Run the tests:
    dotnet test --logger "console;verbosity=detailed"

Deployment

  1. Initialize Terraform:
    cd terraform
    terraform init
  2. Plan the deployment and verify the changes to be made (double confirm, as this will create/delete resources in AWS!):
    terraform plan
  3. Apply the changes:
    terraform apply

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors