Skip to content

Publishing instructions for CMP standalone site

Billy Charlton edited this page Dec 16, 2017 · 1 revision

After you've built and tested the CMP site locally on your own machine, you probably want to publish your changes! We do this in two phases: first, publish to the internal http://prospector server for testing, and then publish to http://congestion.sfcta.org.

The external CMP site is hosted as a separate Github repository using Github Pages. The basic steps are as follows:

  1. Clone and/or pull from https://github.com/sfcta/cmp

    • git clone git@github.com:sfcta/cmp.git ; cd cmp
  2. Switch to gh-pages branch:

    • git checkout gh-pages
  3. Copy (recursively) the built warehouse/prospector site from your local machine (assuming you're using Git Bash; or just use Windows Explorer):

    • cp -r ~/my-warehouse-repo/prospector/build/* .
  4. Delete lots of extraneous folders that are part of warehouse but aren't part of the CMP site:

    • rm -rf autolos cmp-v0 safety tnc viz-template walkskims
  5. Copy the standalone site HTML to the root index:

    • cp standalone/index.html .
  6. The site is now "allegedly" ready for publishing, but because mistakes often happen, as one final test I always push to a fake site on Surge before going live. Just to be sure. I recommend you do the same!

    • surge -d test-cmp-site.surge.sh .
  7. If it all looks good, great! Add, commit and push! After a minute or so, Github will update the site at http://congestion.sfcta.org

    • git commit -a -m "latest release comment"
    • git push # first time use 'git push origin gh-pages'
  8. Don't forget to delete your surge test site:

    • surge teardown test-cmp-site.surge.sh

TL;DR

Seems like a lot of steps, but after you've cloned and pushed once it just boils down to this one script:

cd ~/my-cmp-repo
cp -r ~/my-warehouse-repo/prospector/build/* .
rm -rf autolos cmp-v0 safety tnc viz-template walkskims
cp standalone/index.html .
# test on surge
surge -d my-fake-cmp-site.surge.sh .
# then go live
git commit -a -m "latest release comment"
git push
Clone this wiki locally