Coder Social home page Coder Social logo

notes's Introduction

App Details

notes

This is a React app created with:

npx create-react-app notes

npx is a part of npm toolset that comes with node.
App runs on LTS node (18.16.0).
To install correct node version run:

sudo apt install -y nodejs

sudo apt install npm

sudo npm install -g nvm

nvm install --lts

This should update npm to compatible version as well.
To run notes app locally:

npm install

npm start

For more details see notes/README.md

notes_backend

This is a Fast-API (python) app.

Initial setup was done with:

poetry new notes_backend

poetry add fastapi uvicorn sqlalchemy asyncpg python-dotenv

NOTE: using python-dotenv, not dotenv, dotenv is not compatible with pydantic

In order to build project quickly run:

poetry install

Run locally

cd notes; npm start

poetry shell; cd notes_backend; python main.py

Open localhost:3000.

Run with docker-compose

docker-compose up --build

Open localhost:3000.

Run with k8s

cd kubernetes

kubectl apply -f postgres.yml

kubectl apply -f notes_backend.yml

To open a service:

minikube service list

Get IP and port of notes-backend-service and open in the browser. (Frontend is not available yet)

Manual setup of DB

Run psql tool to enter db CLI:

psql -h <postgres_container_ip:172.22.0.2> -p port:5432 -U username:app_user -W -d <db_name:notes>

Create tables:

psql -h 172.22.0.2 -p 5432 -U app_user -W -d notes -f ./modules/note/db/tables.sql

Manual setup of DB with k8s

Copy SQL setup file (tables.sql) to a postgres pod (to main dir):

kubectl cp tables.sql postgres-statefulset-0:/

Login to the pod:

kctl exec -it postgres-statefulset-0 -- /bin/bash

Run psql tool:

psql -U app_user -W -d notes -f tables.sql

Metrics

Go to localhost:9090 where prometheus exposes its interface and type in the field some examples:

increase(http_requests_total[1h])

increase(http_requests_total{handler="/api/v1/note"}[15m])

rate(http_requests_total{handler="/api/v1/notes"}[15m])

Deployment (docker-compose)

Deployment changes must be done in several places:

  • main .env file in main dir (to define IPs)
  • prometheus.yml in main dir (to define targets for metrics scraping)
  • nginx.conf in main dir (to define which services a traffic should be redirected to)

notes's People

Contributors

gszpura 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.