×
Community Blog How to Build Your Website from Scratch

How to Build Your Website from Scratch

If you want to learn how to deploy different types of website and how to manage them, this article helps you to make a quick start step by step.

Serverless is the buzzword among developers recently, right? Well, do you really know how to take full advantage of it? This tutorial will help you to create a small, serverless personal webpage by using Alibaba Cloud Function Compute. We're going to do this by using the tool "Fun", because this is all about having fun with serverless.

What Is Serverless?

Serverless is a new computing paradigm in which you can build applications composed of micro-services running as a response to events. Under this model the services automatically scales according to the usage. This means that you only get charge when they are executed, becoming the most "Pay-As-You-Go" model ever. Of course, this reduces the overall cost of maintenance for your apps, enabling you to more on the logic, deploying faster.

The classic approach to publish a website by your own is to have a web server, such as an Elastic Computer Service (ECS) instance, running non-stop. This means having an instance 24 hours a day, 7 days per week. Running the numbers that is about 730 hours per month. Or between $5~$15 every month depending on the plan and, on top of that, all the security and software updates involved in managing a server. I'm sure you prefer to spend that time and money on something more enjoyable, like a day on the mountains instead.

What Will We Build in This Tutorial?

For the purpose of learning, we will keep things simple and clear by setting up a simple "About Me" page. For this, we will leverage Object Storage Service (OSS), API Gateway, Function Compute and Table Store. To make that happen, the idea is to host a static HTML file in an OSS bucket with Public Read Permissions. This page will have a visit counter that will communicate via API Gateway with Function Compute, and keeping the visits count on Table Store. Does it sound complex? Keep reading, you will find it easy.

Let's Get Started

To start, create a folder for the project. Once inside it, create the file .env for the credentials and leave it there for now.

Install Fun

We said this tutorial will be based on "Fun". Fun is an official Alibaba Cloud tool to arrange serverless applications resources. Therefore we will use it to deploy our website backend by describing the resources in a template.yml file.

To install Fun, you only need to run in your terminal npm install @alicloud/fun -g. To verify that the installation went ok, type fun -h and see if the output prints the Fun help.

For more details about how to build a low-cost, serverless website using Alibaba Cloud Function Compute.You can refer to Build Your First Serverless Website with Alibaba Cloud.

Related Blogs

How I Built My Personal Website with Alibaba Cloud

In this article, I will be sharing my experience of building a high-performance LEMP stack on Alibaba Cloud for my personal website.

In today's post, I'm going to show you how I deployed my website, sarathy.tech, on Alibaba Cloud.

I built my website using WordPress on Alibaba Cloud Elastic Compute Service (ECS) instance with Nginx, PHP 7.2, FastCGI, MariaDB, and Redis caching for maximum performance.

Before you get started, I'm assuming that you already have a basic understanding of the cloud, networking, and knowledge of Linux command line.

You also need a functional domain name for your website.

Step #1: Create a New Account

If you don't have an account already, you can sign up here. New users can enjoy $300-$1200 worth in free trial, valid for 2 months. If you are not sure how to do this, refer to this tutorial.

After setting up an account, you're ready to deploy a high performance WordPress website!

Step #2: Create a New ECS Instance

Log In into Alibaba Cloud Console by entering your Email and Password. You may need to enter a security code for security purposes.

In the Alibaba Cloud Console, click Products and select Elastic Compute Service from the list.

Click Instances, and choose your Region from top left drop-down menu. A list of available regions will be displayed.

Click Create Instance. For my instance, I have selected the following configurations.

· Billing method: Subscription
· Instance Type: IO Optimized
· vCPU: 1
· RAM: 4GB
· Family: Balanced Type mn4
· Quantity: 1 Units

I have selected an IO Optimized instance with 4GB of physical memory (RAM) and 1 virtual CPU. If your website will be hosting more dynamic content, consider purchasing a higher-spec instance.

Now you have to select an appropriate Image for your instance. I have chosen an Ubuntu 16.04 image for my server.

· Image Type: Public Image
· Operating System (OS): Ubuntu
· OS Version: 16.04 64bit
· Enable Security Enhancements. This feature will add some security features like backdoor detection, remote login alerts, etc.

There are a few other configurations to consider, I have chosen the default settings for the rest.

Website Cloud Architecture Best Practices

This article introduces the technical challenges brought by cloud technology to traditional enterprises, and explains in depth the best practices of website cloud architecture.

Cloud computing has received much attention since its birth as an innovative application model in the field of information technology. Thanks to features such as low costs, elasticity, ease of use, high reliability, and service on demand, cloud computing has been regarded as the core of next-generation information technological reform. Cloud computing has been actively embraced by many businesses, and is transforming industries such as the Internet, gaming, Internet of Things, and other emerging industries. Most enterprise users, however, are often restricted by traditional IT technical architecture and lack the motivation as well as the technical expertise for migration to the cloud.

Technical Features and Problems of Traditional IT Architecture

Typically, the most important element in an enterprise is a database management system that can meet the needs for real-time transactions and analytics. Traditional stand-alone databases use a "scale-up" approach, which usually only supports storage and processing of several terabytes of data, far from being sufficient to satisfy actual needs.

The online transaction processing (OLTP) cluster-based system is gradually becoming the default approach for achieving higher performance and larger data storage capacity. As shown in Figure 1, common enterprise database clusters such as Oracle RAC usually use the Share-Everything (Share-Disk) mode. Database servers share resources such as disks and caches.

When the performance fails to meet requirements, database servers (usually minicomputers) have to be upgraded in terms of CPU, memory, and disk in order to improve the service performance of single-node databases. In addition, the number of database server nodes can be increased to improve performance and overall system availability by implementing parallel multiple nodes and server load balancing. However, when the number of database server nodes increases, the communication between nodes becomes a bottleneck, and the data access control of each node will be subject to the consistency requirements for transaction processing. Actual case studies show that an RAC with more than four nodes is very rare.

In addition, according to Moore's Law, processor performance will be doubled once every 18 months, while DRAM performance will be doubled once every 10 years, creating a gap between processor performance and memory performance. Although processor performance is on a rapid rise, disk storage performance enhancement is slow because of the physical limitation of disks. Factors such as mechanical rotational speed and the seek time of magnetic arms have limited the IOPS performance of hard disks. There has been essentially zero improvement in hard disk performance during the past 10 years; HDD disk rotation speed has been stuck between 7,200-15,000 RPM. HDD-based disk array storage is increasingly becoming a performance bottleneck for centralized storage architecture. Full-flash arrays on the other hand are limited by high costs and short rewriting service life, which is far from meeting the requirements of large-scale commercial applications.

Therefore, IoE's centralized storage (Share-Everything) approach is costly and has restrictions in performance, capacity and scalability. The high concurrency and big data processing requirements brought about by the Internet, the rapid development of x86 and open source database technology, and the increasing maturity of NoSQL, Hadoop and other distributed system technologies drive the evolution from the centralized scale-up system architecture to the distributed scale-out architecture.

Technical Challenges from Networked IT and Countermeasures

Gartner's IT experts placed Web-scale IT as one of the top 10 IT trends in 2015 that would have a significant impact on the industry over the next three years. It is predicted that more and more companies will adopt Web-scale IT by building apps and architecture similar to those of Amazon, Google, and Facebook. This will enable Web-scale IT to become a commercial hardware platform, introducing new development models, cloud optimization methods, and software-defined methods to existing infrastructure. Development-operation collaboration models such as DevOps is the first step towards the development of Web-scale IT. Despite the potential benefits of Web-scale IT, traditional IT systems still face technical constraints from the following aspects.

Create a Serverless Website with Alibaba Cloud Function Compute

In this tutorial, we will look at building a simple website application with Alibaba Cloud's Function Compute in the UI console.

What Is Alibaba Cloud's Function Compute?

Alibaba Cloud's Function Compute is a fully-managed, event-driven compute service for serverless applications. With Function Compute, developers can focus on writing and uploading code without having to worry about building an underlying infrastructure or maintaining complicated server architectures.

Alibaba Cloud's Function Compute event-driven service has near limitless applications, including API gateways, data lake analysis, log stores and backups, web crawlers and image recognition, to name a few. With Function Compute, developing is convenient and reliable. Function Compute supports many different programming languages including Java, Python, PHP, and NodeJS.

Alibaba Cloud's Function Compute provides real-time auto scaling and dynamic load balancing inside millisecond timeframes for managing traffic bursts. The compute resources available make code flexible and reliable. Furthermore, Function Compute offers a Pay-As-You-Go option which means you are charged for consumed resources only. No fee is incurred if the code doesn't run. Moreover, the run duration is measured in milliseconds.

A few common business scenarios for Alibaba Cloud's Function Compute include analysis and management of media assets, for example integrating a range of services that run an elastic and highly available backend video system. Another common scenario is building a serverless backend that triggers Function Compute code to render dynamic webpages. Furthermore, these web applications can hook up to APIs when Function Compute is integrated with Alibaba Cloud's API Gateway. Another interesting business scenario is using Function Compute to manage real time IoT message processing and monitoring of data streams.

What Is Serverless?

Serverless is a new paradigm in cloud computing. Serverless applications running on Alibaba Cloud's Function Compute provide custom code that runs in managed containers so there is no need to maintain costly, always-on, traditional servers. This reduces operational costs and complexity.

The Serverless Framework is an open-source project from MIT supporting the serverless development paradigm. The Serverless Framework allows cloud developers to build BaaS (Backend as a Service) applications comprised of microservices running in response to events. These applications auto-scale and are billed only when they run, which lowers the maintenance costs and enables developers to build applications faster.

The Serverless Framework for well-known cloud services plugs into event-driven cloud compute services such as Alibaba Cloud's Function Compute. It is a command-line tool, providing scaffolding, workflow automation, and best practices for developing and deploying serverless architectures. It also has a plugin architecture for extensibility.

Alibaba Cloud's Serverless Framework API is called Fun. Fun allows you to do everything you can do in the Alibaba Cloud Function Compute UI console but from the command line instead. You can learn more about Fun at https://www.alibabacloud.com/help/doc-detail/64204.htm

In this tutorial, we will look at building a simple website application with Alibaba Cloud's Function Compute in the UI console.

Prerequisites

You will need an Alibaba Cloud account. If you don't already have one, head over to the Free Trial page to get $300-1,200 worth of Alibaba Cloud products to play around with in the Alibaba Cloud Free Trial.

Let's go ahead and set up Function Compute and build a serverless website.

Related Market products

Site.pro Website Builder

Site.pro is a enterprise-grade website builder with a mission to reduce website development costs.

Site.pro Free Website Builder

Site.pro easy to use website builder with drag&drop for Business.

Related Documentation

Build a Drupal website

This topic describes how to use Drupal to deploy an e-commerce website on an ECS instance that runs CentOS 7.

Prerequisites

You must have registered an Alibaba Cloud account before you follow the instructions provided in the tutorial. If not, create a new Alibaba Cloud account first.

Background information

Drupal is a free and open source content management framework (CMF) written in PHP. Drupal consists of a content management system (CMS) and a PHP development framework. You can use Drupal to build dynamic websites that provide various features and services. Drupal is commonly used in a variety of applications, from personal blogs to large communities.

The procedure described in this topic is applicable to users that are familiar with Alibaba Cloud ECS instances and Linux, but new to website construction on ECS instances.

Static website hosting

You can call the PutBucketWebsite operation to configure static website hosting for a bucket and access the static website by using the custom domain name bound to the bucket.

Related Products

Elastic Compute Service

Alibaba Cloud Elastic Compute Service (ECS) provides fast memory and the latest Intel CPUs to help you to power your cloud applications and achieve faster results with low latency. All ECS instances come with Anti-DDoS protection to safeguard your data and applications from DDoS and Trojan attacks.

Deploy ECS instances with just a few clicks from the easy-to-use console and scale capacity up or down based on real-time demands. This means you only pay for the resources you use and avoid the need to procure expensive IT infrastructure and hire large network teams.

Container Service

A high-performance container management service, based on Docker and Kubernetes, providing containerized application lifecycle management

Related Courses

Using ECS to Construct a Dynamic Website

Want to learn how to construct a dynamic website that can actively update its content? In this Clouder lesson, you will learn how to build a WordPress website on Alibaba Cloud.

Quickly Build A WordPress Website Using Resource Template On The Cloud

In this Clouder lesson, you will learn how to conveniently publish a WordPress website with a set of prescribed scripts using Alibaba Cloud ROS service.

0 0 0
Share on

Alibaba Clouder

1,904 posts | 408 followers

You may also like

Comments