What would be the best development/production setup?

I am planning to setup an ERPNext V12 instance for a client.
Additionally I would like to develop an app, too.

I was wondering now, what the best setup would be.
Let’s say I run an instance “A” with ERPNext v12 master-branch in production mode.
Obviously, developing an app on the very same instance by switching to developing mode is not the best idea, because I do not want anything to happen to the production environment while developing.

So my idea is to setup another instance “B” (perferably a copy of the prod instance so we have some data) and put it in developer_mode 1. I would then develop the app and the “B” (dev server, master-branch, dev mod to 1).

Question now is:

  1. How do I get that app from “B” to “A”? Just copy the files, or is there a better method?
  2. Is there even a better setup than having two servers(A and B) running?
  3. Should I develop on master-branch or do you suggest to always dev in dev-branch?

Hello @ARAGATO,

Check this for making the customized app and getting the app via bench commands.

And bench cheatsheets to get familiar with bench commands.

Good Luck!

Thanks & Regards,
Kalpit

Thanks, great links.
I just found the frappe tutorial which does not look too shabby as well.

As for the dev/prod setup, I will probably setup a dev environment with the current stable release in developer_mode 1 (do not need the latest features of the dev branch) and then use the git process for app migration.

Just one last question. When using the “easy mode” what are the main differences when using the develop or production option? Are my assumptions correct?
sudo python install.py --develop (dev branch, already in dev mode and need to bench start)?
sudo python install.py --production (stable branch, need to set dev mode and already started/handled by nginx)?

Any other main differences that one needs to be aware off?

You can also check the various Youtube Videos available for making the custom app and how to integrate that app with erpnext.

As stated in this and for Production production-image-guidelines

I assume you are going to setup production in a cloud or a separate server. Here is how I do development and deployment:

I have followed the manual guide to setup two bench environments on my local machine using:
Bench init [bench-name] --frappe-branch [branch-name]

e.g:

  1. Bench init master-frappe-bench --frappe-branch master
  2. Bench init develop-frappe-bench --frappe-branch develop

This creates two folders in the home directory of the user. You can run both environments at the same time or individually by running bench start from the respective frappe-bench folder. You can see the port the web server is running from the terminal and also from the Procfile

e.d
cd /home/username/master-frappe-bench
bench start

Make the custom apps in your local environments and publish them to github. After completing your testing install app on your clients machine/cloud by:

  1. following the instrustions to install app from your github repo
  2. copy you app folder and paste it in the production environment app folder and setup new app “I have not tested this yet”

I hope this helps

Thanks, great reply.

So, due to both environments running seperately, they do not collide when either gets a problem, right?
Let’s say I code some fatal error into the develop-frappe-bench env, the master-frappe-bench will still keep running?

Yes both run independently. It is highly recommended to build custom apps for your customizations and not customize the original code so when you do bench update it doesn’t break your sites
You can change values of the original fields from your custom apps and also add custom fields in the original doc types and connect your custom app with hooks.py file.
I recommend searching some articles on customizations. Also look at that frappe docs

Regards

1 Like

Yeah, that is exactly what I am planning to do. Never touch the core files. :slight_smile:

One more question. I am working through the frappe developing tutorial right now and they mention that one needs to activate the Barracuda file format for the mysqld in the my.cnf.

I was wondering if the tutorial is outdated in that regard since the tutorial videos do not mention it and in the forum couple of people have issues when updating.

Mine is working fine with that guide.