Skip to content

usagov/vote-gov

Repository files navigation

Vote.gov

This repository contains the files and infrastructure to run the vote.gov website. This site is built using Hugo and Federalist.

Section Description
Federalist staging builds Federalist staging builds
Federalist production builds Federalist production builds
Installation Installing the project locally.
Development Development workflow using npm.
Deployment Automated & Manual deployment information on Federalist
Contributing Contributing to the project.
Wiki usagov/vote-gov wiki.

Installation

The development for the vote.gov site has the following dependencies

  • NodeJS (Latest LTS version: 16)

This documentation assumes that you have NodeJS installed on your machine. Instructions for installing node, and npm, can be found here.

Development

To install the dependencies navigate to this directory in your Terminal and tell npm to bring in the asset-pipeline's dependencies.

npm install

To start the local webserver for the English and Spanish site and have hugo watch for changes:

npm start

Optional: To additionally have gulp watch for changes to the theme assets and content folder run this command instead:

npm run dev

The English website is now available at http://localhost:1313/.

The translations are available at http://localhost:1313/<LANGUAGE-CODE>/.

Descriptions for optional gulp [ flags ] task prefixes

These flags are 100% optional and can be omitted from any tasks that are affected by them.

  • no-test This flag disables linters and tests for all assets.
  • production This flag enables minification and compression of all assets in prep for a production environment.

Deployment

The microsite is deployed on Federalist.18f.gov. To read Federalist documentation, click here. The documentation below makes the following assumptions.

Automated deployment

This project uses Federalist for continuous deployment. Our current process deploys our staging branch and our master branch to their own staging and production URLs.

To preview the build for another branch, see the link below and replace <BRANCH> with the name of the branch. Each branch pushed into the usagov/vote-gov repo with a successful build will auto generate a Federalist environment using this preview link.

For preview branch builds: https://cg-9e8debaf-b030-4825-a43c-cb2bc850c96c.app.cloud.gov/preview/usagov/vote-gov/<BRANCH>/

Manual deployment

Using the cf command-line tool, you can run a manual deployment to either staging or production by targeting the corresponding organization / space and as long as you have access to cf push the target. More information on deploying to cloud.gov can be found here and here.

Manual deployments are not necessary as all deployments should go through Federalist.

Information about launching a live site on Federalist can be found at the launch checklist.

To check which space you're targeting using the cf command-line tool, type the following in your terminal.

cf target

Building the vote.gov site locally

To build the vote.gov site locally , run npm start . This command calls the gulp website task and starts the hugo server.

To mimic the Federalist build run npm run federalist. To start the server run npm run hugo server .

Continuous delivery

Federalist is a continuous deployment-like build environment that automatically pushes the vote.gov application for staging and production. Any commits made to staging will be automatically built on Federalist.

Vote.usa.gov redirector

During the re-launch of vote.gov, we realised that there were lingering issues with cached redirects between vote.gov and vote.usa.gov. To fix this, we created a minimal nginx configuration which:

  • redirects front page requests to https://vote.gov/?1 (the query string was added to defeat a previously-cached 301 redirect)
  • redirects all other file requests to the original S3 bucket containing the vote.usa.gov assets

The manifest and configuration for this redirector app can be found in the redirector folder.


Public domain

This project is in the worldwide public domain. As stated in CONTRIBUTING:

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.