Demo app build by Mukesh as a part of LGTS Remote contract job recruitment tests. https://dev.smolr.xyz/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Arya N 8a37dc57e8 Add link to demo 1 year ago
build Add Instructions to readme 1 year ago
public new changes 1 year ago
src final commit, almost all the functionality working 1 year ago
.gitignore Initial commit 1 year ago
README.md Add link to demo 1 year ago
package-lock.json Almost all done 1 year ago
package.json Add Instructions to readme 1 year ago

README.md

Smolr

Visit: https://dev.smolr.xyz/

  • Clone the repo git clone git@git.n4vn33t.com:labrilliant-org/polr-api.git

  • Install nvm and latest version of node nvm install node

  • Install npm dependencies npm i

  • Start project npm start

  • Update scripts to solve erros

"scripts": {
    "start": "react-scripts --openssl-legacy-provider start",
    "build": "react-scripts --openssl-legacy-provider build",

$ npm start

  • Build production npm build

  • Open ports to test externally sudo ufw allow 3000/tcp

  • Remove ports after testing.

sudo ufw status numbered
sudo ufw delete <rule num>

PM2

https://pm2.keymetrics.io/docs/usage/quick-start/

  • Install serve and pm2 npm install -g serve && npm install pm2@latest -g

  • Deploy using pm2 pm2 start "serve -s build"

  • Setup pm2 production pm2 startup sudo env PATH=$PATH:/home/navneet/.nvm/versions/node/v17.2.0/bin /home/navneet/.nvm/versions/node/v17.2.0/lib/node_modules/pm2/bin/pm2 startup systemd -u navneet --hp /home/navneet

  • Remove production setup pm2 unstartup

$ pm2 restart app_name
$ pm2 reload app_name
$ pm2 stop app_name
$ pm2 delete app_name
  • Setup Nginx Reverse proxy && SSL

Setup SSL

acme.sh --issue -d dev.smolr.xyz --dns dns_cf --keylength ec-256

Proxy config

server {
  server_name dev.smolr.xyz;

  location / {
                proxy_pass      http://127.0.0.1:3000; # Localhost:Port of the React App
                proxy_set_header    X-Real-IP $remote_addr;
                proxy_set_header    Host      $http_host;
                proxy_set_header X-Forwarded-Proto https;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /home/navneet/.acme.sh/dev.smolr.xyz_ecc/fullchain.cer; # managed by ACME.sh
    ssl_certificate_key /home/navneet/.acme.sh/dev.smolr.xyz_ecc/dev.smolr.xyz.key; # managed by ACME.sh
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    add_header  Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
    add_header X-Clacks-Overhead "GNU Terry Pratchett";
    add_header X-Powered-By "Nginx";


}

server {
    if ($host = dev.smolr.xyz) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        server_name dev.smolr.xyz;
    listen 80;
    return 404; # managed by Certbot


}
  • Test and Reload nginx sudo nginx -t && sudo systemct reload nginx