staticsite v1.0.0
Static Site - CLI to Set Up Static Hosting on AWS, Rackspace and Azure.
Automates the process of creating a storage bucket and configuring it for static hosting across all the major cloud platforms. Uploads a local directory containing your site files.
Can be used as a command line tool or programatically as a node module.
Installation
Tested on the latest stable LTS version of Node (v4.4.5).
npm install staticsite -g
CLI Usage
To get started you just have to specify a cloud (aws, rkp, azure) along with a domain name you'd like to use and your authentication details for the cloud platform. If you don't specify a local directoy it uploads the contents of default_site_files which contains a simple hello world index.html file and 404.html.
AWS Basic Example
staticsite aws new-site.com -k aws-secret-key -p aws-secret-password (region default is us-east-1)
AWS with Region and Local Directory Upload
staticsite aws new-site.com -k aws-secret-key -p aws-secret-password -r us-west-2 -d ./path-to-local-site-files
Rackspace Basic Example
staticsite rkp new-site.com -u rkp-username -k rkp-api-key (region default is DFW)
Rackspace with Region and Local Directory Upload
staticsite rkp new-site.com -u rkp-username -k rkp-api-key -r IAD -d ./path-to-local-site-files
Azure Example
Please note: Azure currently doesn't have the capability to specify a default file i.e. index.html so it's currently not an ideal solution for hosting traditional websites.
staticsite azure new-site.com -u storage-account -k azure-api-key -d ./path-to-local-site-files
Help Documentation & Complete List of Options
staticsite --help
Programmatic Usage
AWS Example
var aws = require("staticsite").clouds.aws;
aws.createSite({
awsKey: "aws-secret-key",
awsPass: "aws-secret-password",
domain: "new-site.com",
region: "us-west-1",
directory: "./path-to-site-files",
callback: function() {
console.log("successfully created your new site on AWS");
}
});
Rackspace Example
var rkp = require("staticsite").clouds.rkp;
rkp.createSite({
user: "rkp-username",
apiKey: "rkp-api-key",
domain: "new-site.com",
region: "ORD",
directory: "./path-to-site-files",
callback: function() {
console.log("successfully created your new site on Rackspace");
}
});
Azure Example
var azure = require("staticsite").clouds.azure;
azure.createSite({
storageAccount: "storage-account",
apiKey: "azure-api-key",
domain: "new-site.com",
directory: "./path-to-site-files",
callback: function() {
console.log("successfully created your new site on Azure");
}
});
Support
Bug Reports & Feature Requests
Please use the issue tracker to report any bugs or request new features.
Contributing
Developing
Pull requests are welcome. To begin developing, do this:
git clone git@github.com:rawberg/staticsite.git
git checkout -b new-feature-branch
License
GPLv3 License Copyright 2016 David Feinberg
8 years ago