ERPNext Environment Setup:






















What is Frappe Framework ?


    • Web Application Framework

    • Rapid Application Deployment

    • Used Python,MariaDB,Javascript,Radis,Node

    • Deployement on any Operating System


Multi telent provide feature:


1) Site:

    • Database

    • Your Domain

    • File and backups

    • Apps

2) App:


    • User functionality

    • Model,View and Controller

    • APIs


Bench:


    • Command line tools

    • Manage site

    • Manage apps (Create and download apps)

    • Deployment

    • Virtual Environment


ERPNext Installation steps:


1. Install Pre-requisites


    • Python 2.7

    • MariaDB 10+

    • Nginx (for production)

    • Nodejs (Latest Version)

    • Redis

    • cron (crontab is required)

    • wkhtmltopdf with patched Qt (for pdf generation)


Performed below command :


sudo apt-get update && sudo apt-get install mariadb-server nginx redis-server python-dev libmysqlclient-dev


2. Install Bench


Install bench as a *non root* user,


git clone https://github.com/frappe/bench bench-repo




pip install --user -e bench-repo




3. Create a new bench


    • The init command will create a bench directory with frappe framework


bench init frappe-bench --frappe-branch master

cd frappe-bench


4. Add a custom apps: Create custom apps for your site. 

frappe-bench$ bench new-app trackoo








5. Create a custom site


Frappe apps are run by frappe sites and you will have to create at least one site. The new-site command allows you to do that.


frappe-bench$ bench new-site site.dev






6. Add a frappe apps


Note: This steps perform only one time when first time site a created.


The get-app command gets remote frappe apps from a remote git repository and installs them.


frappe-bench$ bench get-app erpnext https://github.com/frappe/erpnext --branch master



7. Install frappe apps


To install an app on your new site, use the bench `install-app` command.


frappe-bench$ bench --site site.dev install-app erpnext







8. Configure developer mode


To install an app on your new site, use the bench `install-app` command.


frappe-bench$ bench --site site.dev set-config developer_mode 1




9. Configure host name


frappe-bench$ sudo gedit /etc/hosts



Add a host file: 127.0.0.1 site.dev











10. Start bench


To start using the bench, use the `bench start` command


frappe-bench$ bench start



















To login to Frappe / ERPNext, open your browser and go to access through URL localhost:8000 OR site.dev:8000


The default username is "Administrator" and password is what you set when you created the new site.













































































































































































































































































More Information


Help

===


For bench help, you can type


bench –help


Updating

=======


To manually update the bench, run `bench update` to update all the apps, run

patches, build JS and CSS files and restart supervisor (if configured to).


You can also run the parts of the bench selectively.


`bench update --pull` will only pull changes in the apps


`bench update --patch` will only run database migrations in the apps


`bench update --build` will only build JS and CSS files for the bench


`bench update --bench` will only update the bench utility (this project)


`bench update --requirements` will only update dependencies (python packages) for the apps installed



Some other command

============



    • bench --site site_name serve --port port_number

      Exam: bench --site site.dev serve --port 8585

    • bench use sitename

    • bench start



MySQL Database server

================



If You want to check your database in the sql server then you have to login in your mariadb server.

So, You can easily login in your mariadb server with the using of following commands:

frappe-bench$ mysql -u root -p “password”




  • SHOW DATABASES lists the databases on the MariaDB server host.














Short steps for Build site and apps:


1) Create a new apps:

frappe-bench$ bench new-app <<apps name>>


2) Create a new site:

frappe-bench$ bench new-site <<site name>>


3) Add a frappe apps:

frappe-bench$ bench get-app erpnext https://github.com/frappe/erpnext –branch master


4) Install site:

frappe-bench$ bench --site <<site name>> install-app erpnext


5) Configure developer mode:

frappe-bench$ bench --site <<site name>> set-config developer_mode 1


6) Configure host name:

frappe-bench$ sudo gedit /etc/hosts

Add a line: 127.0.0.1 <<site name>


7) Start bench:

frappe-bench$ bench start


Build apps after creating site:


1) Create a new apps:

frappe-bench$ bench new-app <<apps name>>


2) Install site:

frappe-bench$ bench --site <<site name>> install-app erpnext


3) Start bench:

frappe-bench$ bench start



Help full Command :

=============


General Usage

    • bench –version - Show bench version

    • bench src- Show bench repo directory

    • bench --help- Show all commands and help

    • bench [command] --help- Show help for command

    • bench init [bench-name]- Create a new bench (Run from home dir)

    • bench --site [site-name] COMMAND- Specify site for command

    • bench update- Pulls changes for bench-repo and all apps, applies patches, builds JS and CSS, and then migrates.

        • --pull Pull changes in all the apps in bench

        • --patch Run migrations for all sites in the bench

        • --build Build JS and CSS artifacts for the bench

        • --bench Update bench

        • --requirements Update requirements

        • --restart-supervisor restart supervisor processes after update

        • --upgrade Does major upgrade

        • --no-backup Don't take a backup before update

    • bench restart Restart all bench services

    • bench backup Backup

    • bench backup-all-sites Backup all sites

        • --with-files Backup site with files

    • bench restore Restore

        • --with-private-files Restore site with private files (Path to tar file)

        • --with-public-files Restore site with public files (Path to tar file)

    • bench migrate Will read JSON files and make changes to the database accordingly



Config

    • bench config - Change bench configuration

        • auto_update [on/off] Enable/Disable auto update for bench

        • dns_multitenant [on/off] Enable/Disable DNS Multitenancy

        • http_timeout Set http timeout

        • restart_supervisor_on_update Enable/Disable auto restart of supervisor

        • serve_default_site Configure nginx to serve the default site on

        • update_bench_on_update Enable/Disable bench updates on running bench...

    • bench setup - Setup components

        • auto-update Add cronjob for bench auto update

        • backups Add cronjob for bench backups

        • config overwrite or make config.json

        • env Setup virtualenv for bench

        • nginx generate config for nginx

        • procfile Setup Procfile for bench start

        • production setup bench for production

        • redis generate config for redis cache

        • socketio Setup node deps for socketio server

        • sudoers Add commands to sudoers list for execution...

        • supervisor generate config for supervisor

        • add-domain add custom domain for site

        • firewall setup firewall and block all ports except 22, 80 and 443

        • ssh-port change the default ssh connection port


Development

    • bench new-app [app-name] Creates a new app

    • bench get-app [repo-link] - Downloads an app from a git repository and installs it

    • bench install-app [app-name] Installs existing app

    • bench remove-from-installed-apps [app-name] Remove app from the list of apps

    • bench uninstall-app [app-name] Delete app and everything linked to the app (Bench needs to be running)

    • bench remove-app [app-name] Remove app from the bench entirely

    • bench --site [sitename] --force reinstall Reinstall with fresh database (Caution: Will wipe out old database)

    • bench new-site [sitename] - Creates a new site

        • --db-name Database name

        • --mariadb-root-username Root username for MariaDB

        • --mariadb-root-password Root password for MariaDB

        • --admin-password Administrator password for new site

        • --verbose erbose

        • --force Force restore if site/database already exists

        • --source_sql Initiate database with a SQL file

        • --install-app Install app after installation`

    • bench use [site] Sets a default site

    • bench drop-site Removes site from disk and database completely

        • --root-login

        • --root-password

    • bench set-config [key] [value] Adds a key-value pair to site's config file

    • bench console Opens a IPython console in the bench venv

    • bench execute Execute a method inside any app.

        • Eg : bench execute frappe.utils.scheduler.enqueue_scheduler_events

    • bench mysql Opens SQL Console

    • bench run-tests Run tests

        • --app App Name

        • --doctype DocType to run tests for

        • --test Specific Test

        • --module Run a particular module that has tests

        • --profile Runs a Python profiler on the test

    • bench disable-production Disables production environment

Scheduler

    • bench enable-scheduler - Enables Scheduler that will run scheduled tasks

    • bench doctor - Get diagnostic info about background workers

    • bench show-pending-jobs- Get pending jobs

    • bench purge-jobs - Destroy all pending jobs



Directory Structure :