[go: up one dir, main page]

Skip to content
forked from usagov/vote-gov

This repository contains the files and infrastructure to run the current vote.gov website.

License

Notifications You must be signed in to change notification settings

Violet26/vote-gov

 
 

Repository files navigation

Vote.gov

This repository contains the files and infrastructure to run the vote.gov website.

Section Description
Federalist staging builds Federalist staging builds
Federalist production builds Federalist production builds
Installation Installing the project locally.
Development Development workflow using gulp.
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

  • Hugo, a static-site generator written in Go.
  • Gulp, an automation tool for asset-pipelines.
  • NodeJS
  • Ruby

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

Installing Hugo

In order to serve the vote.gov site locally, you will need to install the hugo command-line tool. This can be installed easily via Homebrew on Mac OS X with the following command in your Terminal.

brew update && \
brew install hugo

You can also download the latest release and checkout the quick start guide for further instructions.

Installing Gulp

In order to build the assets for the vote.gov site, you will need to install the gulp command-line tool.

npm install --global gulp-cli

Installing SCSS-Lint

The Sass file linter uses the Ruby gem scss_lint. This gem must be installed on your machine in order to run any tasks that depend on the scss-lint binary.

gem install scss_lint

Development

Once gulp is installed globally, navigate to this directory in your Terminal and tell npm to bring in the asset-pipeline's dependencies.

npm install

Once that is complete, run gulp in your Terminal to get a list of tasks.

$ gulp

  Using gulpfile ~/Developer/vote-gov/gulpfile.js
  Starting 'default'...
  v1.0.0 vote-gov
   ______  ______  _____       __   ________  ______  ______
  /\  ___\/\  ___\/\  __-.    /\ \ / /\  __ \/\__  _\/\  ___\
  \ \  __\\ \  __\\ \ \/\ \   \ \ \'/\ \ \/\ \/_/\ \/\ \  __\
   \ \_\   \ \_\   \ \____-    \ \__| \ \_____\ \ \_\ \ \_____\
    \/_/    \/_/    \/____/     \/_/   \/_____/  \/_/  \/_____/

  Available tasks

  ...

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

npm start

Optional: To have gulp watch for changes to the assets and content folder run:

$ gulp watch 

Then open a new terminal, navigate to this directory, and run:

npm start

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

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

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 view the build for another branch, see the links below and replace with the name of the branch. The build for the branch must have completed successfully.

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

For staging builds: https://cg-82f344a8-cccc-4f34-b090-19d55b2b6585.app.cloud.gov/preview/usagov/vote-gov//

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 ‘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.

About

This repository contains the files and infrastructure to run the current vote.gov website.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 54.3%
  • JavaScript 31.6%
  • CSS 14.1%