[Tutorial] Step by Step Primer to setup ERPNext on Google Cloud Platform

Word of caution at the beginning here. What follows here is very simplified and long winded, but worth it if you are struggling with setting up and ERPNext test system.

It is not an easy task to create an environment for testing ERPNext and I know I have stumbled many times along the way. To be sure, I am nowhere near understand all of the complexities of the system and just getting a running system was a huge hurdle for me. Now that I have become somewhat practiced in building, tearing down, and building ERPNext from the ground up after many botched starts, I have learned a few things I thought I would pass on to others trying to find a foot hold in their climb to the top of the ERPNext heap. :wink:

NOTICE
This is where I tell you what this post is about and what it is “not” about and what to expect.

  • I am not financially tied to Google or ERPNext developers except that I gladly pay either for their services.
  • I am NOT a developer, I am an implementer trying to figure this all out (just like you).
  • This is just the easiest method I could find to get a running system to evaluate.
  • There may be better ways to do this, but I know this way works, I have done it a lot.
  • This is based on my personal experience (not forum advice or failed google searches).
  • References to free trials at Google are apparently only available to USA accounts but everything still works the same around the world (just maybe not the free trials).

Okay, now that that is out of the way, let me tell you how I came to this solution. I have tried using the VM image downloaded from the ERPnext repository and found it to be old version and difficult to get it to upgrade to the latest. I also tried using the “ready-made” ERPnext image from the Bitmani group and although it was a very recent version, it far too many functional problems and little in the way of support. I had previously made a local plain Debian 8 server and loaded the ERPNext system on it just to have something working experiment on. Then I stumbled across something in the Google Cloud Services documentation that just turned on that idea light above myhead. :wink:

Google Cloud Services has a list of “Virtual Machines” that you can simple click on and start up in your account. In that list of VM images is a whole section of just bare operating systems and you can start them or kill them off with the click of a mouse and no installation headaches! See link:

In my case, I had been working with Debian 8 on my local server box and I had stripped it and reloaded it by hand countless times to keep trying ERPNext. Now I could just spin up a fresh server in less than a minute, configure it or install anything on it I wanted and even save it for reuse. Wow, what a deal.

To make it even better, if you create a Google Cloud Services account (at least here in the USA) they give you $300 of free credit for you to test drive the cloud services. That means you can make and break your installation for quite a long time in testing mode and start over as many times as you need. In my case I think using the service calculator online it looks like my ERPNext sandbox will be free for about 7 or 8 months. (Your mileage may vary) :smiley:

Here is the link to signing up with the Google Cloud:

Go to the link and click on “More Options” to see the “Create Account” option. All you really need is a Gmail account and you must be willing to give them credit card information. They never charge your card and promised to simply suspend your account if you run out of free trial credit. Then you’re supposed to log in and upgrade to paying for it if you still want to keep the account. (The above link may not work outside the US so please just look for the “Try It Free” link on the Google Cloud Services page)

If you want to see what it would cost to run a VM instance on Google Cloud Services, then try using this link to the online “compute engine” pricing tool:

If you go to the calculator and fill in the items there, it will give you an estimate of how much it would cost each month to keep it running. This is where you can see just how long your free trial credit will last.

Ok, so everything up to this point has been to show you how to evaluate your choice of using the Google Cloud Platform to run ERPNext. If you want to go any further you will need to have an account there and be ready to get started. So here we go…

Log into your Google Cloud account and click on the “CONSOLE” link or button in the upper right side of the screen next to your login ID. This will bring you to where everything can be started.

On the left hand side of the screen, scroll down and click on the “Compute Engine” link under the COMPUTE heading. This will take you to another screen level that lists all the things you can do with your Google Cloud virtual computer.

Look for the link listed on the left side again for “Images” and click on it. You will be presented with a long list of “ready-to-launch” operating system images. Scroll down the list and find the Debian images. At the time of this writing there was a version 8 and a version 9 image to choose from. Since I had experimented with version 8 on a local server, I chose that one for my test run.

Be Aware… if you select a Red Hat, Suse, or Microsoft OS image, you will have to pay a premium for it and it is not covered in your free trial credit. So using the Debian images made good financial sense because they are GPL licensed and free to use.

So, if you click on one of the Debian VM image links, you are taken to a screen listing the details of the image, when it was published, and the license details. At the top of that screen there is a “Create Instance” link. Clicking on this will start up a VM Debian operating system right before your eyes. When it is up and running (it takes a few minutes) you will be taken to the “VM Instances” screen where you will see your fresh OS instance listed.

The listing will include the name of your new Debian OS instance, the zone you chose to run your computing environment, an internal IP address, an external IP address, and a connection link. The connection link is how you access your new Debian VM server.

The connection link usually is listed as SSH. Next to it there is a drop-down arrow. Click on the drop-down arrow and select “Open in Browser Window” (Note: you will need to make sure any pop-up blocking is disabled on your browser so it can pop up the console window).

The window that pops up is the command line console for your new server. You will only have to do 2 things here to get your ERPNext server up and running. Don’t be afraid. It really is pretty simple. It’s just typing in the 2 commands. (If you’re really good with keyboard shortcuts you could probably copy the commands from here and paste them on the command line by using the CTRL-V key combination).

Here is the first command, just type or copy it to the command prompt and hit the enter key:

wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py

(Sorry, but the forum wants to make it stupid link. I cant get it to be just text so just type it in and include the wget at the beginning)

This is the command to use at the time of this writing. To be sure though you can copy whatever the current valid command is from the GitHub location at the link below. Just scroll down until you see the heading that says “Easy Install” and the command will be there as the first step for linux users. Here is the link to the GitHub instructions:

Anyway, once you have entered the correct command and hit enter, it takes about 10 seconds or less to copy the install script to your new server. When it finishes, it goes back to a blinking command prompt and you are ready for the next command. So here it is:

sudo python install.py --production

Type in the above command exactly as it appears and hit enter. In case you were wondering, there are 2 dashes before the word production in that command. Sometimes they run together and look like one. Just be sure to use 2. Also if you are unsure and want to see the most current command they recommend to use you will also find it at the same github link above just a little further down the page.

Once you have started the install script, you will see many lines of text fly up the screen as it works to gather all the important stuff to make ERPNext work. Do not fear this. It is normal and it is a good sign that everything is working. However you cannot just walk away from this. After only a minute or 2 or 3, the lines of text will stop. The line at the bottom will be asking for you to enter an administrator password for the database engine. Choose a secure password, type it in, and press enter. You will be asked to verify the same password by typing it again. Please type carefully as the command line hides what you type as a measure of security.

Once you have typed in the database engine password, you will immediately be prompted to choose a secure password for the Administrator account in ERPNext. Again, please type carefully and remember this one as you will need it to log into ERPNext the first time. Remember to also type the same thing to verify this entry just like the previous password.

Once the passwords are entered, the screen will resume streaming lines of text again as it works to complete the setup of your ERPNext system. This process may take another 2 or 3 minutes. Even if it looks like it stopped for a while, don’t interrupt it. It frequently looks like it has paused, but that is just the installer churning through a lot of steps in the background. When the system is finished installing, it will present you with the same blinking command prompt you started with at the very beginning. If you are unsure, you can tap the enter key. If the command prompt advanced a line then you are finished.

Once finished, type the word exit at the command prompt and hit enter. The black console window will disappear and you will be back at your VM Instances screen. At this point your ERPNext sysem is installed and “almost” ready to run. You still have one more important thing to do in order to access your new ERPNext cloud server. So, again, here we go…

Click on the name of your Debain VM Instance on the VM Instance screen. You will be taken to the VM Instance Details screen for your new server. Across the top of the screen are a few links you need to know about. They are Edit, Reset, Clone, Stop, and Delete. You can use some of them to control your running server instance. More on them later.

Right now you need to click on the EDIT link so we can turn on access to your server for the outside world. After you click edit, you will be permitted to alter some of the things that control your server. Right now we are only interested in the items listed under the heading of “Firewalls”.

Under Firewalls heading, click on the boxes next to “Allow HTTP traffic” and “Allow HTTPS traffic” this should put check marks next to them to enable these settings. Scroll to the bottom of the screen and click “Save”. It may take a minute to go out to your server and make those changes. When it finishes, click on the “VM Instances” link on the left column of the screen again to go back to your VM Instances list.

Your ERPNext cloud server is now ready to use. However, we need to talk a bit bout some of the other options you saw across the top of your previous screen. So here is the details:

Edit – of course let you edit the details

Reset – will reset the server and restart everything in the event you got it locked up by accident :astonished:

Clone – this is supposed to allow you to make copies of your running server and add them to your list of VM instances that you can run when you want. HOWEVER… This feature doe NOT work for ERPNext servers we create here. Believe me, I tried. They clone and they appear to start up but no matter what I tried the clones could not be accessed. So, this may be useful for other types of servers you play with in the future, but know that this ERPNExt server you just created will not clone properly. But so what!?! You now have a cool ERPNext cloud server and it didn’t take much effort. So if you need more VM servers, just run through it again. :wink:

Stop – This allows you to stop your server and put it to rest in the event you want to spin up a different server on the list you will eventually create of test servers. Once you use the Stop command, it changes to a Start command at the top of the screen in case you want to restart it now or at a later time. If you are not going to use the server for a while, you can stop it. That will suspend the hourly charge for running it and make your free trial credit last a bit longer. If you are outside the US and are paying for all of this, it just saves you money.

Delete – This option is there to allow you to delete VM server instances you may have created and no longer need, or you accidently corrupted. It removes it from your list permanently.

Okay, I know. You are tired of reading and you just want to start up your server online and see the ERPNext login screen. Well, there are still a few things you need to know before you jump in the deep end of the pool. So get yourself back to the VM Instances screen where you can see your server in the list.

Under the External IP Address column you will see the actual IP address that you could type into a browser and jump right to your new ERPNext cloud server. However, this address can change on you so you really need to understand how this works.

The external IP address listed is call an ephemeral address. Is it only valid as long as your particular VM instance is actually running. If you need to stop your server for any reason and restart it, THIS ADDRESS WILL CHANGE!!!

If you want to get a permanent IP address for your server, you can by looking for the link on the details page to “promote” your address to permanent. This will cost quite a bit extra. If you are only testing the system and using this as a sandbox, then it is not worth the extra cost to get a permanent IP address. So, you just need to be aware that anything that interrupts the normal operation of your VM server will also likely result in being assigned a new external IP address.

If you ever experience a time that you cannot get to your server, just log back into the Google Cloud Platform account and check the VM Instances list to see the new address.

Okay, enough already, let’s go try out your fresh ERPNext cloud server. So, write down the external IP address. You will need it to get to your server. (Note: don’t try to click on the IP address there on the VM Instances list. It will not work) So, log out of the Google Cloud account. You don’t need it open any longer.

Open a fresh browser, and type the IP address complete with the http:// and hit enter. You should see the initial ERPNext login screen. In order to get in you must type the following credentials:

Username: Administrator
Password: (use the password you type in during the install process)

You will have to answer all of the questions to get the system setup the first time. I usually just create the initial user, and only one of everything else just to get the system up and running, then I import data through the import tool.

So, have a go at it and if you like how it worked out you can always do it again, and again. It really is not so scary if you take your time the first few times. Just remember, there are no shortcuts. The prepackaged ERPNext images are difficult to work with, so just make you own fresh ones each time. It’s not worth the headache and wasted time on stuff that doesn’t work right out of the box. Hope this helps someone. It took me long enough to write it :grin:

BKM

UPDATE Wow, this thread has been amazing so far. Thank you all for your responses. Now further down the thread is another post that explains how to create you own CUSTOM IMAGES of the work you created with the above post. This was the piece that I was missing at the time of the original writing, but now thanks to another user I was lead down a path that eventually made working copies of the ERPNext image I created here. Look for my response to user @clarkej for the instructions to create the custom images.
I hope this helps even more folks get started now.:grin: 07/20/2017

BKM

35 Likes

It’s a brezze to work on Digital ocean on their Banglore hosting
I may try amazon for another setup in Mumbai DC,
I have one VPS which uses the API to start the droplet thus conserving my spending when not required

@bkm Thanks for your effort.

If it helps even one person get past the setting up of an ERPNext environment, then it was wort it. :grin:

BKM

7 Likes

I am feeling it costing way above $10 I will take google offer this year and see

@deepakk
I think for my test server supporting about 15 users the cost is going to be about $24/month when my free trial runs out. You can always select less resources to lower the cost, but then it really affects the speed of the system and the user experience overall.

BKM

@bkm Hi
After using Bitnami, I got the same feeling as yours. But there is upside and downside of everything(almost). What will you come up with the downside of hosting ERPNext without using Bitnami image?
And if you could make a video cast of the process. I think it will be much easier for following :smiley: Thanks.

Hmm… So far I have not seen a downside. I have 2 instances running at the same time right now and both have been outstanding with performance. I use one as a testbed/sandbox for learning how to get things done in ERPNext and how to make my custom changes. The other one I use to slowly populate a future live instance with users, data and everything. When that one is complete I will run a backup and save it so that I can swiftly reload all of the client data to get started. The process of manipulating data from older systems and making ready for importing to ERPnext is very tedious work. The 2nd instance running allows me to do that carefully and on my time without the pressure of a tight deadline like you might have on a client live system.

Hmm… an interesting idea, but one that will take me some time to figure out. I have never done that before, but it cannot be that hard. It may take some time because I am so busy with my current projects, but maybe one night when I am unable to sleep I will give it a try. That was how I managed to type out the Step by Step guide in the first place.:rofl: That and a lot of beer.:heart_eyes:

BKM

Hi @bkm Big thanks for such detailed reply on how you correctly set up the environment. And it really really got me thinking of giving up Bitnami image. GCP already gave me some tool to create a snapshot as backup and create a site from snapshot for testing. Do you use the same method?
The last thing keeps me from running original ERPNext is the difficulty of setting up the environment and install it. So…really expect to see your video coming up on Youtube. I found 2 but not so clear and dated too.
HAHA…Beer what a great idea. I think I will need them to loose me up while wring such long tutorials. As to video casting…uhmmm…I wondering if the alcohol will affect your voice :smiley:

Haha… Well if I can get to the screen cast here soon it will probable be a “silent movie”. I am already mildly dyslexic (as you can see in some of my posts) and I easily get tongue tied. Add that to a strange southern accent and you would have more confused people than ever. Since I really want people to adopt ERPNext, I will do my best to leave my voice out if it.:grin:

BKM

haha @bkm I got this bad feeling to grab a cold beer now :drooling_face:
After using ERPNext for couple months from now and then, I really it is well structured and also very flexible to use. Look forward to your 1st video. :slight_smile:

Hmm… No, I have not been able to get a copy of an image to run yet. That is detailed near the end of my Step by Step guide. GCP has the tool built into their environment, and I made 9 or 10 copies trying to get them to work. None of them would ever spin up properly and you could never get the ERPNext login screen on a cloned image. Since the process of making a fresh image is so easy, I have not been worried about cloning yet. It is something I will have to tackle later though so I can clone working, populated systems and run them away from a live environment to do testing or debugging.

At this point I am just doing my best to keep you informed of what little successes I have so that others can find something to work with when they are struggling. When get that figured out I will make sure to detail the fix for that as well.

BKM

1 Like

Yes - I have been struggling with this for weeks now. Yes your tutorial works on Debian 8 - the “simple” version hasn’t worked for me on Googles Ubuntu or other, go figure.

I tried to setup the --develop version and could not see it online once I launched it with bench start. Any ideas? http or https tricks didn’t work with traffic boxes checked.

Great work - finally something that works first try.

If you want I can try setting it for you on a new instance

Hmm… I have not been using developer mode, but I did run it once back in December. If I am not mistaken you are supposed to start the developer edition from the command prompt (console mode) from the ~/frappe-bench directory and run the comand “bench start”.

It would be worth a quick search here in the forums or the github site, but I am pretty sure that is how you start it. You still have to set the flags for the http and https access in the GCP VM instances settings. Hope that helps.

BKM

Well, that would be great. But I did try that with a fresh ERPNext install on a fresh debian instance before ERPNext was ever started. This should have given me a re-usable, bootable, fresh ERPNext VM instance any time i needed one, but the clones did not work. I am not sure what might have to be done to the clones to make them work and I don’t really know where to begin looking.

However, if you have an account, just spin up a Debian 8 machine and use my instructions to load an ERPnext system. Once you have it up, accessing it. If you get the login screen then you know your instance is working. Then, without actually logging in, just close the browser and go back to the CG platform. You now know you have a valid, working instance. If can figure out how to clone that, Come back here and let us all know.

I have tried cloning it while it was running, cloning it while it was stopped, and tried reading the help files for cloning, but I could never get a clone to work. Maybe I missed something somewhere, so by all means give it a try. If you get it to work then we would all know how to make our own.

Thanks,
BKM

1 Like

Robert, What tool are you speaking about here? I (probably wrongly) assumed it was the “CLONE” button on the VM instances page. If this is not correct, please tell me of the tool you found.

I learned something about the “CLONE” tool this morning that really shocked me.:astonished:
I had been using the Debian8 images and then installing ERPNext with the easy method script. Once I had it running the way I wanted I tried to “CLONE” the image and start up a second copy of my new ERPNext instance. What I learned is that the “CLONE” feature only makes a copy of the Debian8 part of the image and does NOT take any of the ERPNext installation with it. So if you go to the bother of building up a running server image the way you want it, the GCP clone feature will not clone the whole thing, just the starting image (which in my case was the clean and blank Debian8 server)

So, if you have found a different tool in GCP that will make a new image that includes all of the additionally installed packages and data, then I would really like to hear about it. It would be a real time saver.

Although I cannot really be super disappointed about GCP because it allowed me to quickly create ERPNext instances that were really difficult before, it would still be nice to have a way to save all of my work.:grin:

Thanks,
BKM

Amazing Stuff

“if you have found a different tool in GCP that will make a new image that includes all of the additionally installed packages and data, then I would really like to hear about it”

BKM first my Disclaimer - I have zero GCP experience only Linux KVM - so your learning benefits all including me!

My guess is you want to use gcloud to make a ‘boot disk’ aka ‘root persistent disk image’ attached to your ‘current’ instance, and from that ‘boot disk’ then create a custom image?

These two pages explain your chicken and egg instances case

이미지 관리 권장사항  |  Compute Engine 문서  |  Google Cloud notes

This is the step I am referring to in particular:

  1. Create a custom image from the boot disk of that instance. This process requires you to delete the instance but keep the boot disk.

Note: If you want to create backups of your persistent disk data, consider using snapshots instead.

Be sure to create a backup copy of any instance you are required to delete!

best wishes

1 Like

Way to go John… you planted that seed in my OCD brain and I couldn’t put it out of my head until I read every last page, all the linked pages, tried all the steps, and figured it out. So, thank you (I think) :wink:

So, after reading for a several hours and trying every rabbit hole the documents led me down, I managed to find the easy route to making a Custom Image on GCP.

The simplified version…

  • Use the post at the top of this thread to make your own customized ERPNext instance on GCP. This will be the basis for your custom image

  • When you are satisfied with the instance and want to preserve it for replication, use the STOP link to stop the instance from running.

  • Click on the now “stopped” instance to go to the instance details page

  • Click the EDIT function so you can change things here

  • Scroll down the page until you find “Delete boot disk when instance is deleted” and UNCHECK the box, then save your changes

  • Now click on the DELETE function to delete the instance. I know this sounds scary because you have already put a lot of work into making this, but you are only deleting the “running instance” and NOT the actual boot disk where the everything starts. You cannot create a custom image unless you disconnect the running instance and the only way to do that is to delete it but leave the boot disk in tact.

  • Once it is deleted, go to the left column of the screen and select “Disks” from the Compute Engine menu

  • Here you will see the boot disk for the instance you just deleted and the far right “In Use By” column will be blank. This is now available for you to create boot disk images similar to the Debian8 image you used to create your ERPNext system. So, Click on the disk name to go to the disk details screen.

  • At the top of the screen click on the “Create Image” function

  • Type in a name for your new custom image and click the “Create” button at the bottom of the screen

  • After a few minutes (2 min in my case), the screen will change to indicate it is finished. Click on the Disks link again to see you disk is still there, then click on the “Images” link and your new custom image should be prominently listed near the top!

  • To start a fresh instance of your customized image, just click on the image (just like you did when you used the Debian8 image but this time use your new customized version), then click “Create Instance” at the top of the page.

  • Change all the important information for the instance you are about to start, like a name, the zone to run it, and the http/https check boxes, then click “Create”. In about 3 minutes your very own personalized ERPNext image will be running. Just use the external IP address to access it like you did with the original before.

So, there you go. I have typed out how to get your first ERPNext instance running at the top of this thread, and now I have typed out the instructions for how to turn it into a re-usable custom image!

In my case I created a re-usable custom image of a fresh ERPNext server that has not yet been started. In other words, I had not done the first administrator login. This way I can spin up a breand new ERPNext system in just a few minutes and then do the first login and make it for anything I want to test.

I think I will do this while building large client systems. I can start with the image I created today, stop once I get the first batch of data entered and make another new image up to that point. Then I can remake new images each step of the way as I modify and populate large client images. This way if I screw up the data at some point during the import process I can go back to my last good image and re-do the import I screwed up without having to scrap the whole system and start over. I like this already!

Ok, Everyone… please thank @clarkej since his post pushed me to go figure it all out and boil it down to the simplest Step-by-Step process. Had he not taken the time to find the right starting point in the reading material and plant that seed in my weird little brain, I might not have bothered to try and figure this out for another month or two.

Kudos John :+1::smiley: and thanks for the push.

BKM

3 Likes