Sunday, December 1, 2019

Monday, July 22, 2019

Sunday, July 21, 2019

Working on community driven Online E-Commerce Portal!

Why community-driven?

I feel community-driven business is really good to start with where you don't have to worry about building an in-house team of experts. It is like outsourcing someone to do the work and give them loyalty. Building a kind of online artist community, sell their arts and give them loyalty.

What is the name?

ArtSeptor: A community for artist
The name came after Loki's Septor. 

Technology Stack

Python/Django and there is a really very good eCommerce package written in Python/Django called Django-Shuup! It's quite active in terms of development and I've already tested the feature and I feel it's easy to set up and ready to use.

Launch Date and Hiring Developer

Open to talk to contributors and YES, we are about to launch the portal in October 2019.
Contributors can only join if the idea excites you!



Share:

Generate wildcard certificate with Let's Encrypt/Certbot and install on GoDaddy, cPanel.

Why there is a need for an SSL certificate?

SSL is the backbone of our secure Internet and it protects your sensitive information as it travels across the world's computer networks. The primary reason why SSL is used is to keep sensitive information sent across the Internet encrypted so that only the intended recipient can access it.

If you don't have SSL then google-chrome or any browser will flag your website as Not-Secure which means, if you do any kind of transaction then there is a high chance that your data will be compromised.



In this blog, I'm going to generate one wild-card certificate for my blog site, ashishtiwari.me. A WildCard certificate can be used with subdomain as well, for example -
blog.ashishtiwari.me, contact.ashishtiwari.me, tech.ashishtiwari.me

1. Set up your machine to generate the SSL certificate [ Ubuntu ]. 

apt-get update
apt-get install git-core

2. Install Let's Encrypt/Certbot 

apt-get install letsencrypt

3. Generate SSL certificate using Certbot 

Now with the help of Certbot, we will generate wildcard certificate for our test domain ashishtiwari.me

certbot-auto certonly --manual --preferred-challenges=dns --email writetoashishtiwari@gmail.com
--server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d *.ashishtiwari.me

4. Setup DNS TXT record to authenticate Ownership.

For wildcard certificates, the only challenge method Let’s Encrypt accepts is the DNS challenge, which we can invoke via the preferred-challenges=dns flag.

After executing the above command, the Certbot will share a text record to add to your DNS TXT field.


Please deploy a DNS TXT record under the name

_acme-challenge.ashishtiwari.me with the following value:
iroa8XXXhpTah-h4Az4UZuuXslHCdkxIuDiL2XXXv2Y

Create TXT record via DNS console and setup key and value

TXT Record Name  :  _acme-challenge
TXT Record Value  :  iroa8XXXhpTah-h4Az4UZuuXslHCdkxIuDiL2XXXv2Y

4. Finally, Generate the Certificate.

Once you authenticate the domain ownership; by setting up DNS TXT record, Certbot generates the ssl certificate and required keys [ PEM/CERTIFICATE ].


IMPORTANT NOTES:

 - Congratulations! Your certificate and chain have been saved at:
    /etc/letsencrypt/live/ashishtiwari.me/fullchain.pem
    Your key file has been saved at:
    /etc/letsencrypt/live/ashishtiwari.me/privkey.pem

    Your cert will expire on 2019-10-14. To obtain a new or tweaked
    version of this certificate in the future, simply run certbot
    again. To non-interactively renew *all* of your certificates, run
    "certbot renew"

  - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

5. Complete Logs.

Plugins selected: Authenticator manual, Installer None
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for ashishtiwari.me
dns-01 challenge for ashishtiwari.me

-------------------------------------------------------------------------------
Please deploy a DNS TXT record under the name

_acme-challenge.ashishtiwari.me with the following value:
iroa8XXXhpTah-h4Az4UZuuXslHCdkxIuDiL2XXXv2Y

Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------
Press Enter to Continue
-------------------------------------------------------------------------------

Please deploy a DNS TXT record under the name

_acme-challenge.ashishtiwari.me with the following value:
V781k3nW6GaSdpyfbTYJBJpt1IJYBehMQa1je2gFg3Q
Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------

Press Enter to Continue
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:

 - Congratulations! Your certificate and chain have been saved at:
    /etc/letsencrypt/live/ashishtiwari.me/fullchain.pem
    Your key file has been saved at:
    /etc/letsencrypt/live/ashishtiwari.me/privkey.pem
    Your cert will expire on 2019-10-14. To obtain a new or tweaked
    version of this certificate in the future, simply run certbot
    again. To non-interactively renew *all* of your certificates, run
    "certbot renew"

 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

6. Install SSL on cPanel.
Share:

Wednesday, April 17, 2019

Flask Minimal Setup and Hello World with NGROK


Setup VirtualEnv, Flask Installation and Project Directory

pip3 install virtualenv
virtualenv -p /usr/bin/python3 flask-sample
source flask-sample/bin/activate
pip install flask
mkdir flask-demo && cd flask-demo
touch main.py

Edit main.py file

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello():
    return "Hello World!"

if __name__ == '__main__':
    app.run()

Run Flask app and visit localhost:5000

python main.py

Console Log
 * Serving Flask app "main" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

NGROK Setup

Signup for NGROK and get AuthToken

wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
./ngrok authtoken 
./ngrok http 5000
Console Log
ngrok by @inconshreveable                                                                                                                                                                                                                                       (Ctrl+C to quit)                                                                                                                                                                                                                                                                                
Session Status                online                                                                                                                                                                                                                                            
Account                       Ashish Tiwari (Plan: Free)                                                                                                                                                                                                                        
Version                       2.3.25                                                                                                                                                                                                                                            
Region                        United States (us)                                                                                                                                                                                                                                
Web Interface                 http://127.0.0.1:4040                                                                                                                                                                                                                             
Forwarding                    http://b6ad4280.ngrok.io -> http://localhost:5000                                                                                                                                                                                                 
Forwarding                    https://b6ad4280.ngrok.io -> http://localhost:5000                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                                                                                                                                       
                              0       0       0.00    0.00    0.00    0.00         

App is running on http://b6ad4280.ngrok.io
Share:

Tuesday, March 5, 2019

Believe in yourself :Photography In Layman's Voice


First of all, I'm not a professional photographer but I know a few tricks. :)
So, this post is not for professional photographers who have already mastered their camera features.
Let's Start.

Believe In Your Skills.


If you are just starting the Photography Walk then I'm sure you already have an account on Instagram.
If you go through your photographs on Instagram you will see the pattern, the trail of your Photography journey and believe me you are clicking really awesome shots.
Just go through your Instagram feed from the beginning. I knew it! You loved your photographs.

You can learn more about this from Photography Presentation
My Journey as The_Travelling_Monk

“Your first 10,000 photographs are your worst.” - Henri Cartier-Bresson


Read More About Henri At : https://en.wikipedia.org/wiki/Henri_Cartier-Bresson
Share:

Monday, March 4, 2019

Sunday, February 24, 2019

Fuzzy Django Flask App : Django Like Project Structure


While I was going through some legacy system which had 75,000 lines of code written in python/flask. I was wondering why it's not borken up into applications.

After discussion with other developers I came to know about that those codes were written by ex-developers 2 yrs back.

It seems those legends only knew about hello-world-in-flask from documentation because everything is written in myflaskapplication.py file ( 75,000 lines ).
Because, models, controller, blueprints, admin, forms and etc etc were written in myflaskapplication.py file.

Now big pain is to break this system into small application and then into microservices.
Since I've spend so much time working with python/django it wasn't difficult to break system's structure into small application and divide task between other developers.


Sample app can be found at, https://github.com/codetarsier/fuzzy-django-flask
Here is the sample structure.

Project Folders
- common : models and serializer for other application
- <application_structure> : contains, models, views, helpers, serializer, urls and views.
- static : contains all css, js, images
- templates : contains html files and broken into application structure like, templates/portal_setup and templates/common
- config : database, packages, secret settings
Project Structure
├── common
│   ├── __init__.py
│   ├── models.py
│   └── serializers.py
├── config
│   ├── constants.py
│   ├── __init__.py
│   ├── sample_secrets.json
│   └── settings.py
├── config.py
├── manage.py
├── portal_setup
│   ├── admin.py
│   ├── forms.py
│   ├── helpers.py
│   ├── __init__.py
│   ├── models.py
│   ├── serializers.py
│   ├── urls.py
│   └── views.py
├── README.md
├── reports.json
├── requirements.txt
├── static
│   └── portal_setup
│       ├── css
│       └── js
└── templates
    └── portal_setup
        ├── add_portal.html
        ├── base.html
        ├── edit_portal.html
        ├── index.html
        └── portal_details.html













Share: