Let's start from the first stuff you need, the domain. There are many companies which you can purchase a domain name. Here are some very popular companies for registering your domain, such as namecheap.com, godady.com, 1and1.com, whois.com. The domain name you want to register is the one which is not registered yet by anyone. All the domain registration websites can check if the domain name you choose is already registered or not.
After get the valid domain name, you could go ahead to find a place where you can create a website. Most of the domain registration websites have the packages for domain purchasing, they usually supply a friendly graphical user interface to create a website. The price are variable between companies, you may need to shop around to find a good package for your requirements. Now, the cloud technology is very popular, most of the web hosting are based on the cloud platform. Some big companies are not only give a cloud platform, and give you a lot of features and services. Amazon AWS(Amazon Web Services) platform will give you accessing to their web services. The first year on amazon is free, but next year you may get a big bill. Google Cloud platform is another good choice. The first 3 months or two months are free, that depends on the package or products you choose. After the free trial, you can select to stay in Google or move to another platform or company, if you can backup all the data and files. Anyway, there are two to three months free trial, and after that the bill may as low as $2/month. So why not take a look to see if it's a good place to host my stuff.
Joining the Google Cloud platform are pretty simple, open the http://cloud.google.com and select one of the products like Compute Engine and then click on 'Start your free trial'. And then follow the page flow to finish the registration, the credit card information is needed but it won't charge you anything for now. After the registration, on the left side there are a bunch of menu items like most of web applications, select the 'Compute'->'Compute Engine'->'VM instances'. There will be an link or button for 'Google Compute Engine Tutorial', click on that. It will guide you to create your first back-end and front-end instance with an example. It's a good way to get start with Google cloud platform and understand how it works.
The basic tutorial steps looks like these:
- Create back-end instance, back-end means something like a database server.
- create front-end instance, front-end means application server/web server.
- Install and run the back-end database
Update packages and install MongoDB. When asked if you want to continue, type 'Y'.
sudo apt-get update
sudo apt-get install mongodb
The MongoDB service started when you installed it. You must stop it so you can change how it runs.
sudo service mongodb stop
Create a directory for MongoDB and then run the MongoDB service in the background on port 80.
sudo mkdir $HOME/db ; sudo mongod --dbpath $HOME/db --port 80 --fork \
--logpath /var/tmp/mongodb
After you enter the final command, click Done and then confirm that you want to leave the page to close the SSH browser window.
- Install and run the web app on your front-end VM
Update packages and install git, NodeJS and npm. When asked if you want to continue, type 'Y'.
sudo apt-get update
sudo apt-get install git nodejs npm
Clone the sample application and install application dependencies.
git clone https://github.com/GoogleCloudPlatform/todomvc-mongodb.git
cd todomvc-mongodb;npm install
Start the todo web application. Note: The IP addresses below are internal IPs for communication between servers. You can find these IP addresses on each server’s details page.
nohup nodejs server.js --be_ip 10.240.253.122 --fe_ip 10.240.2.76 &
After you enter the final command, click Done and then confirm that you want to leave the page to close the SSH browser window.
But there is a little problem on step 'npm install'. If you just follow the instructions, you will get the following error message on step 'cd todomvc-mongodb; npm install'.
npm WARN package.json mongoose@3.6.20 bugs.email field must be a string email. Deleted.
To fix this problem, first thing is making sure you are in the directory 'todomvc-mongodb' on the SSH window. If not, just navigate to the directory by 'cd todomvc-mongodb', and then use the command 'vi package.json' to edit the file package.json. On the line 10 change the content from
"mongoose" : "~3.6.2", to "mongoose" : "~3.8.1",
And then rerun the command 'npm install', it will work fine. At the end of the tutorial, you should see your sample page like this.
Congratulations! You have finished the first sample on Google Cloud.
great
ReplyDeleteA very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article. I am learning a lot from you.
ReplyDeleteDevops Training in Bangalore
Microsoft azure training in Bangalore
Power bi training in Chennai
Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing....
ReplyDeleteData Science course in rajaji nagar
Data Science with Python course in chenni
Data Science course in electronic city
Data Science course in USA
Data science course in pune | Data Science Training institute in Pune
Data science course in bangalore