Under the Hood of 's the free Static Site Hosting - (r)
-sidebar-toc>
When the "World web" was first made available to the public in 1991 at the time, websites were simply collections made up of static HTML documents - each file containing the markup required to render the entire webpage in the web browser. In a matter of minutes, web's early developers began working on methods to build dynamic web pages, assembled by code running on web servers and taking content from databases.
Although static websites didn't wholly disappear while CMSs came to rule, a new approach to the static-site concept is now gaining popularity among people who value speed and security.
Let's look closer at static sites and what will help you to deploy them on edge servers around the world.
Is an Static Site suitable for your Web Project?
What types of projects are able to be deployed as static sites?
"If you don't have any pages where users have to log in, there is no database, or any other thing that requires dynamic content, then it's probably a good candidate to become a static web page," Fuller says. "This can include things such as portfolios, marketing pages, or even a blog if you're content writing content using a static website generator."
When a site does not have a server or database to connect to, it offers fewer pathways for security breaches.
"For higher-level situations, it is possible to use two approaches," Fuller says. "You can create an static website that utilizes the JavaScript framework that connects to an independent server. So, you will get the speed benefits in your initial load times, combined with the flexibility of the dynamic website."
An Overview of Static Web Hosting
Here's what you will get at no cost on the Static Site Hosting platform:
- 100 static sites per company
- 1 concurrent build per site
- 1 GB image build size per site
- 600 build minutes per month per company
- 100 GB bandwidth per month per company
Installing a Static Site
After you've authorized My's access your Git service, you can begin to create your very first static website by deciding on the repository it is in and its branch:
Above, we've selected Automated deployment after commit, which means will redeploy the site when changes are committed onto the branch of the Git host.
Next, My will attempt to identify the requirements to complete your project.
"If we can detect the package manager and generator that you're using. We'll then fill them with the practices that are used to build them," Fuller says. "For instance, the option used for Node.js-powered builds typically is yarn build or npm run build, and the publish directory usually has an equivalent of build, dist, public and out."
"For the initial release of Static Site Hosting, we support Node.js for creating websites." Fuller says, "but we're currently working on bringing you additional platforms later on."
It is also possible to use static assets which have no build step at all such as plain HTML sites.
"If you're not running a generator, no build command needs to be specified and we presume that your repository contains pre-made files," Fuller says.
Once a deployment is triggered and completed, it's placed in the site's build queue.
"When the deployment starts, we create a build instance in Google Cloud Platform and pull the source code from your repository" Fuller says. "If the build command is specified, we employ an image built on your specified platform that is Node.js at present -- to run that command. After this, we check the size of each file in the publish directory to ensure that it's in line with our limitations."
"The final step is the upload, where we push your files into an Cloudflare R2 bucket."
Maximizing Speed With Increased deployments
The Static Site Hosting deployment process optimizes build times by uploading to the Cloudflare servers only files that have actually changed.
"We save previous uploaded files that were accumulated over several deployments. Therefore, if you want to redeploy previous version, the number of files to be uploaded again are minimal," Fuller says. "To achieve this, we change the names of files to match the hash value for their content and record the paths that were originally used. They are stored files in a map for the particular deployment, using the path as the key and the updated name as the value."
"When a request is sent to the site, we use the map of the current installation to direct the request to the right Version of the document."
Summary
Its Static Website Hosting Platform delivers lightning-fast content delivery on an unparalleled network of cutting-edge servers, backed by My dashboard, which makes deployment easy.
And it's all free.
Steve Bonisteel
Steve Bonisteel is a Technical Editor who started his writing career as newspaper reporter, who was chasing ambulances and fire trucks. The journalist has covered Internet-related technology since the late 1990s.