This is a template for a static website that is published over a CDN.
After you create a project from this template, change and extend it to fit your specific requirements.
To create an account, simply login to the Altostra Web Console.
# make sure you have Node.js 10 or above installed
$ npm install -g @altostra/cliTo connect an AWS account, click Connect Cloud Account on the Web Console settings page.
If you don't wish to connect your account just yet, you can deploy to the Playground environment that simulates the cloud without creating actual resources.
You have several options to get started with this template:
- Initialize a new project from the Altostra CLI and specify the template:
$ mkdir static-website
$ cd static-website
$ alto init --template static-website-
Create a new project from the Altostra Web Console, you can select the
static-websitetemplate from the list. -
Apply the template to an existing Altostra project from Visual Studio Code by going to the Altostra view in the main toolbar and clicking on
static-websitein the templates list.
Start by logging in from the Altostra CLI:
$ alto loginThe deployment process is simple and involves a few commands. For more information on each command refer to the Altostra CLI documentation.
Create an image of the project:
$ alto push v1.0Deploy the image as a new
deployment named main in the Production environment:
# omit "--new Production" to update rather than create
$ alto deploy main:v1.0 --new ProductionYou have two options, list the deployment details in the terminal or open the Web Console.
- Using the Altostra CLI:
$ alto deployments
# show details for the deployment "main"
$ alto deployments main- Using the Web Console:
# will open the Web Console for the current project
$ alto consoleThe infrastructure of our website is ready, but not the content, such as HTML and CSS files.
To complete our website deployment we need to upload the content files to the bucket, and invalidate the CDN cache.
- Wait for the infrastructure deployment to complete before proceeding. The bucket and CDN must be created on your cloud account before you can upload.
CDN resources can take up to 20 mins to become available on AWS.
- Upload the content files for the
maindeployment:
# uploads files for all buckets and makes the files public
$ alto sync main --all --public- Invalidate the CDN cache for the
maindeployment:
# invalidates the cache for all CDNs
$ alto invalidate main --allTo modify the project, install Altostra Tools for Visual Studio Code:
From the terminal:
$ code --install-extension Altostra.altostraor, search for Altostra Tools in the Visual Studio Code extensions view.
or, directly from the marketplace.
The extension adds an Altostra panel and visual additor that help you modify and design the project infrastructure.
- S3 Bucket
- CloudFront CDN
The template comes with an example website that consists of two files:
- index.html
- style.css
These files are located in the public directory in the project root.
To change the directory that you wish to upload, modify the bucket resource settings using Altostra.
For more information, visit
Altostra's documentation
website.