This is the repo for the OpenOUSD project located at openousd.org. Read the front page for a description of the project. All contributors are volunteers and the project has no private or public funders.
We welcome new team members!
OpenOUSD uses several technologies:
- Gatsby, a static site generator built on React
- Postgres to store public datasets
- Node.js to serve that data as JSON through a light API (see openousd-api)
Since this is a static site, the data is fetched once and stored in static JSON files in the /data
directory. The live site does not require any API or database.
- Run
git clone git@github.com:openoakland/openousd-site.git
cd openousd-site
npm install
(if you don't have npm, install node via the node installer or homebrew (macOS) or nvm if you work on several node projects)- Run
npm install -g gatsby-cli
to install the gastby command line tool globally - Ask a member of the project team on OpenOakland Slack for a Contentful API token. Insert the token into this command and run it to create a file and populate the token as an environment variable.
echo "CONTENTFUL_ACCESS_TOKEN={insert the token here and remove brackets}" > .env.development
gatsby develop
Go to http://localhost:8000
in your browser
Setup
docker-compose up
TODO: may need to delete the volume and recreate the container if you want to updte package.json / containers or look into using the --renew-anon-volumes
flag.
Cleaning out old containers
- run the script
./cleanDocker.sh
- enter
y
to prune volumes when prompted
Anyone with write privileges to the repository should be able to push a branch to staging.openousd.org.
To do that, run this command from your branch:
npm run deployStaging
This runs some commands listed in package.json
which essentially:
- run a production
gatsby build
- creates the
CNAME
file for GitHub Pages - Pushes to the
gh-pages
branch usinggh-pages
Only a few members of the group and OO GitHub admins can publish staging.openousd.org to openousd.org.
Please be careful. If you have those permissions, you can run this command from any branch:
npm run promoteStaging
This probably needs to be brought into a proper deploy system, but for now this runs promote_staging.sh
which essentially:
- git fetches the latest from GitHub
- checks out the
gh-pages
branch - replaces the staging
CNAME
file with the production one - pushes the files to
openousd-site-prod
master
repo - goes back to the branch you started in
Percy is a tool that takes screenshots of web pages across browser types and page widths (mobile, desktop) and does a visual "diff" to see if anthing has changed visually during development. Then you can decide if the changes is desired or not.
OpenOUSD's Percy project is here.
- Get a Percy project API token from a member of the team
- Create a file in your local directory called
.env.production
- In that file, add a line
PERCY_TOKEN=<Enter Token Here>
to specify the token
Note: The free version of Percy allows 5000 screenshots a month. Each page has a screenshot for each language OpenOUSD supports and for desktop and mobile. At the time of writing this, that was ~125 screenshots per run.
- To run against Staging:
npm run percyStaging
- To run against Production:
npm run percyProd