GithubHelp home page GithubHelp logo

sawtaytoes / ghadyani-framework-playground Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 801 KB

A playground for me to test out React components with the Ghadyani Framework

License: MIT License

Shell 0.57% CSS 7.49% JavaScript 91.94%
react react-components ghadyani-framework-playground ghadyani-framework redux redux-observable

ghadyani-framework-playground's Introduction

Ghadyani Framework Playground

Playground for testing React components with various tooling using the Ghadyani Framework for Webpack, React, and Redux.

Prerequisites

Required

Optional

  • MailDev Local Mail Server for Testing Email

Setup

Config Settings

Default configs are configSettings.js. Here's an example of what defaults might look like

env: 'production',                            // Can be 'development' or 'production'.

//- Server
protocol: 'http',                             // Using `https` requires valid certificates.
hostname: '0.0.0.0',                          // Can be 0.0.0.0 for binding to all ports.
port: 3000,                                   // Port of webserver.
// proxyPort: 3001,                           // Optional. Will be `port + 1` if not defined.

//- Testing
testsPath: '/tests',                          // Path used when performing unit-tests

//- Email Submission
mailSendPath: '/contact/send',                // Path that's used when doing a POST to send mail.
mailOptions: {                                // Options for Nodemailer.
	from: 'Fake User <[email protected]>', // When sending mail, this appears in the `FROM` field
},
smtpCredentials: {                            // Configuration for a local maildev server.
	host: 'localhost',
	port: 1025,
	tls: {
		rejectUnauthorized: false,
	}
}

To override these configs, either setup Node env vars such as: NODE_ENV, PROTOCOL, HOSTNAME, PORT, etc or create a ./server/configs/config.js file and have it return an object with overrides like so:

module.exports = {
	env: 'development',
	protocol: 'https',
	port: 443,
}

SMTP Configuration

Example using maildev (npm i -g maildev):

smtpCredentials: {
	host: 'localhost',
	port: 1025,
	tls: { rejectUnauthorized: false },
}

Example gmail.com string:

smtpCredentials: 'smtps://user%40gmail.com:[email protected]'

Start the local catch-all SMTP server using the command maildev.

Web Server Setup

Development: Local

yarn start

OR

bash local.sh

OR

node index.js

Production: Hosted VPS

Using PM2

Start the Server

Start a single server for testing:

bash server.sh

Start a cluster of 3 servers for load balancing in production:

bash server.sh 3

The number 3 can be replaced with any number. The default is 0: equal to the number of CPU cores.

Update from Git and Restart

bash update.sh

If you update the update.sh file, make sure to run git pull prior to running the update script.

Stop the Server

bash stopServer.sh

Create SSL Cert

Make sure to run this command to upgrade pip before starting:

pip install --upgrade pip

Optionally, you can upgrade Let's Encrypt:

cd /usr/share/letsencrypt/
git pull

Replace SERVER_NAME with the website address.

service nginx stop

/usr/share/letsencrypt/letsencrypt-auto certonly \
-a standalone \
-d www.SERVER_NAME \
-d SERVER_NAME \
--server https://acme-v01.api.letsencrypt.org/directory

service nginx start

Or try this experimental approach:

/usr/share/letsencrypt/letsencrypt-auto certonly \
-a nginx \
-d www.SERVER_NAME \
-d SERVER_NAME \
--server https://acme-v01.api.letsencrypt.org/directory

When running the Let's Encrypt with, it requires installing the NGINX plugin:

cd /usr/share/letsencrypt/
~/.local/share/letsencrypt/bin/pip install -U letsencrypt-nginx

Let's Encrypt allows renewing using:

/usr/share/letsencrypt/letsencrypt-auto renew

Create & Update Dev SSL Certs

For ServiceWorker compatibility, update or use these certs along with https in network-protocol.

Using ZeroSSL and their FREE SSL Certificate Wizard:

  • Files are located in conf/

Linting

Install packages globally for Sublime Text's SublimeLinter-contrib-eslint plugin.

npm i -g babel-eslint eslint-plugin-react

ghadyani-framework-playground's People

Contributors

dependabot[bot] avatar sawtaytoes avatar

Watchers

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