GithubHelp home page GithubHelp logo

akongstad / devops-group-p Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 0.0 13.83 MB

Twitter Clone which was developed at an unknown time by unknown students at the IT University of Copenhagen (ITU) | Maintenance and Evolution

License: Apache License 2.0

Shell 0.82% CSS 0.52% HTML 1.09% C# 51.18% JavaScript 16.69% TeX 29.70%

devops-group-p's Introduction

Workflow Status:

sonar cloud
release schedule
cluster-deploy codeyml .Net

Minitwit

This is a fork of a Twitter Clone which was developed at an unknown time by unknown students at the IT University of Copenhagen (ITU).

The initial project was a full stack Flask application written in Bash and Python2 with an SQlite database.

In this fork we refactored the project to the three following containerized microservices:

  • C# backend using the ASP.NET web framework and EF Core ORM
  • ReactJS SPA frontend
  • PostgreSQL database

upon which we added monitoring and logging stacks to be served as a multi-container Docker application through a reverse proxy webserver with an auto-renewing SSL certificate.

Branches

As is described in CONTRIBUTE.md, our organization uses a Trunk Based Development branching model. Hence we have two centralized branches which are always debugged, tested and in a working state. Features, patches and bug-fixes are always developed on dedicated temporary branches which are deleted after being merged to its relative centralized branch.

main

The main branch lives on github and is the alpha of our centralized workflow. While we develop features and patches on temporary branches, everything worthwhile is eventually merged to main.

On main we:

  • Store our working source code
  • Make releases
  • Run workflows
  • Build and push docker images

Merge to main requires 2 approvals

production (Deprecated. See deployment submodule instead)

The production branch lives on our production server and is our main branch's lean and automated counterpart. It is developed in a manner such that our multi-container application can be rebuilt and updated on the production server to include updated Docker images and/or changes in configuration files with a single command, minimizing downtime withoud using load-balancers.

On production we:

  • Store configuration-files
  • Pull and run docker images

Merge to production requires 1 approvals

Environments

TBD-MiniTwit has a development environment for developing and testing code before it is deployed to the kubernetes cluster which has the production code.

Development

Prerequisites

Steps to run

1. Clone the repository.

git clone https://github.com/Akongstad/DevOps-group-p.git

2. Cd into the minitwit folder:

cd DevOps-group-p/minitwit

3. Create and polulate the .local folder:

mkdir .local && cd .local

Create database password file (replace MySecretPassword with your desired password)

Touch db_password.txt && echo "MySecretPassword" > db_password.txt

Create database connection string file. (MySecretPassword should be replaced with the content of db_password.txt)

touch connection_string.txt && echo "Host=db;Database=Minitwit;Username=sa;Password=MySecretPassword;" > db_password.txt

Create jwt key file. (MySecretKeyshould be replaced with your desired key)

touch jwt_key.txt && echo "MySecretKey" > jwt_key.txt

Go back to the minitwit folder

cd ..

4. Run the docker compose-file:

a. Run the full development system(Includes logging with elk and monitoring with prometheus/grafana)

chmod u+x setup_elk.sh

./setup_elk.sh

Run the application

docker-compose -f compose.dev.yaml up --build

b. Run the base development system(frontend, backend, database)

docker-compose -f compose.test.dev.yaml up --build

Production

See deployment submodule for instruction on how to deploy and update the MiniTwit-TBD cluster

devops-group-p's People

Contributors

akongstad avatar dependabot[bot] avatar mikaeleythor avatar stribe02 avatar thebaht avatar blyth77 avatar snyk-bot avatar

Stargazers

 avatar  avatar

devops-group-p's Issues

npm start script throws error

Frontend is initialized from DOTnet template which is a fork of create-react-app. Should work out of box and fixing it is out of scope.

MinitwitController.cs BAD need FIX

  • Stop using routes for all parameters -> Take a DTO object instead of a username password and email fx
  • Optional: Split into 2 separate controllers (Message and user)

Remove legacy RawSQL methods

I dont want to remove them yet as it would create annoying merge conflicts, when done before your branches are merged to main

Purge remnants of React app from CS project

Everything mentioning the following does not belong in the backend and could cause problems in the future:

  • SPA (Single Page Application)
  • node
  • npm
  • react (excluding filenames and foldernames written by us and corresponding path-references in source code)

API does not work inside container

When testing the API running inside a container using the following method:

response = requests.get(http://localhost:5229/minitwitsimulation/msgs)

I receive this error:

ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

API however works with dotnet run but with various warnings.

I have a feeling this might this might have something to do with an HTTPS redirection middleware in the backend which caused a similar problem earlier.

Deploy.yml destroys all containers

this line

docker-compose -f compose.prod.yaml down

takes down all containers.

Lets find a way to rebuild only the necessary containers

Increment version on release

something like this in github workflow

- name:  'Automated Version Bump'
  uses:  'phips28/gh-action-bump-version@master'
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    tag-prefix:  'v'

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.