Giter Club home page Giter Club logo

sails-hook-federalist-ms's Introduction

sails-hook-federalist-ms

npmbadge

This installable hook for Sails.js incorporates both Windows and Microsoft Azure extensibility in to Federalist, a static website management platform built and maintained by 18F. The hook is comprised of two components: build support for Windows (and Azure Web Apps) and static site publishing support for Azure.

New releases of this package will coincide with Federalist's current stage of development; based on 18F's Project Stage Definitions.

Detailed API documentation for this package can be found here: http://microsoft.github.io/sails-hook-federalist-ms/.

Running Federalist on Windows

In order to enable this hook, the FEDERALIST_BUILD_ENGINE environment variable must be set to 'federalist-ms'. By enabling this hook, the build engine will be configured to run tasks on Windows (or Web Apps), and the Azure site publishing feature will be activated.

If Federalist detects that the platform is running on Windows and the FEDERALIST_BUILD_ENGINE environment variable is not set, an error will be logged indicating that builds will fail until the variable is set correctly.

Windows Build Engine

Federalist works by executing a specific set of build tasks for each static site based on whether or not the site's content is built using a content generator (either Jekyll or Hugo). If the site isn't built with a generator, then the build engine simply stages the site's content for publishing as is.

When running Federalist on Windows (or on an Azure Web App as described below), this hook invokes the appropriate build tasks using CMD-based syntax. All task output is redirected to stdout and subsequently attached to the Federalist logging engine.

Jekyll

Jekyll must be installed in order to build sites that are created with it. Instructions for installing Jekyll on Windows can be found here. In addition, you'll want to install additional Ruby gem dependencies which can be done using the following commands:

gem install bundler
bundle install

Hugo

Hugo is required to build sites that depend on it and installation instructions can be found here.

Azure Static Site Publishing

Once a site has been built and staged, the hook will subsequently publish the content to an Azure Web App. In order to publish to Azure, a new Azure Active Directory native client application must be created. Instructions for doing so can be found here. The 'Redirect URI' value is arbitrary and can be set to anything.

In addition, the following environment variables need to be set:

Environment Variable Description
FEDERALIST_BUILD_ENGINE Should be set to 'federalist-ms'
FEDERALIST_AZURE_SUBSCRIPTION_ID Azure Subscription Id
FEDERALIST_AZURE_TENANT_ID Azure Active Directory tenant Id
FEDERALIST_AZURE_CLIENT_ID Azure Active Directory application client Id
FEDERALIST_AZURE_USERNAME Azure Active Directory organizational account username (cannot be a Microsoft Account (e.g. Outlook, Live, etc)
FEDERALIST_AZURE_PASSWORD Azure Active Directory organizational account password
FEDERALIST_AZURE_REGION Azure Region for deployment (for new Web Apps)

The Azure publishing process is based on the following execution sequence:

  1. Retrieve Azure Active Directory authorization token
  2. Check for existence of Azure Web App
  3. If Web App exists, skip to Step 6
  4. Otherwise, provision new Azure Resource Group if one doesn't exist
  5. Deploy template to Resource Group
  6. Retrieve Web App site-level publishing credentials
  7. Publish content to Web App via FTPS

For the intial alpha release, FTPS is used to publish the site content. Future releases of this package will use Git for publishing.

Running Federalist on Azure

TODOs

  • Set environment variables (including RUBY_HOME)
  • Installer bundler gem
  • Execute bundle command at root to install Gem dependencies

Developing on Windows

This hook is developed following the Sails.js hook specification.

In order to install Sails and the required dependencies for contributing to the hook, the following prerequisites must be installed in the following order:

NOTE: In order to avoid Sails npm package name length limitations imposed by Windows, npm v3.x can be used to install the hook's dependencies. Instructions for upgrading npm to v3.x can be found here. Bear in mind that some packages might be incompatible with npm v3.x at the time of this writing. If issues arise during installation, reference the source repositories of the offending packages on GitHub for any open issues.

Execute the following command to install the dependencies for sails-hook-federalist-ms:

npm install

Gulp is used to execute all unit tests and compile the documentation from the code. The command below can be executed to initiate the build tasks.

gulp

NOTE: Only those with push priveleges on the GitHub remote can update the existing gh-pages branch. Any errors in the documentation should be denoted by a new Issue on GitHub.

sails-hook-federalist-ms's People

Contributors

microsoft-github-policy-service[bot] avatar msftgits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sails-hook-federalist-ms's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.