Coder Social home page Coder Social logo

vam100000's Introduction

Vam100000 Project

Local setup

  • Create database and populate .env file
  • Run npm install
npm i
  • Run migrations and seed data
 npx knex migrate:latest
 npx knex seed:run
  • To run project locally use
npm run start

Running tests

  • create test db and populate env
  • Run migrations using
npx knex migrate:latest --env test
  • Run tests
npm run test

Performance

Only count endpoint can become bottleneck. Tested it with 10 Lac patients data and response time is close of 65ms. To test, run seed first it will add 10 Lac patients data. Then run endpoint and count time or use below query in psql.

explain analyse
select count(*)
from patients p
where p.weight_kg / ((p.height_cm ^ 2) / 10000) >= 25
  and p.weight_kg / ((p.height_cm ^ 2) / 10000) < 30;

Deployment

  • Added Github workflow to deploy this app, rename file .github/workflows/deploy.yml.example to .github/workflows/deploy.yml
  • Add server's ssh key to Github's deploy keys
  • Create new pair of SSH keys and add private to Github secret with name SSH_KEY and add public key to the server's authorized keys
  • Add server's IP to Github secret's using name SERVER_IP
  • Github will automatically deploy to the server on every commit to master.

Nginx config

limit_req_zone $binary_remote_addr zone=ip:10m rate=5r/s;
server {
    server_name example.com;
    listen  80;
    gzip on;
    gzip_types      text/plain application/json;
    gzip_min_length 128;
    client_max_body_size 1M;
    
        location / {
            proxy_set_header   X-Forwarded-For $remote_addr;
            proxy_set_header   Host $http_host;
            proxy_pass         http://127.0.0.1:4000;
            limit_req zone=ip burst=12 delay=8;
        }
}

vam100000's People

Contributors

pradosh987 avatar

Watchers

James Cloos avatar  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.