Skip to content

zooniverse/static

Repository files navigation

static

An nginx caching proxy (mostly) for serving static sites from Azure Blob Storage.

Run it locally with Docker:

docker-compose build
docker-compose up

And access it at http://localhost:8080/.

Testing your changes locally

Use curl to test the behaviour of your target or default server block:

curl -v -H "Host: www.zooniverse.org" http://localhost:8080/main-54f00afe77a81c4ff6b88b1e0bee34bc.css

Test the default - first server block

# provide an unkonwn host to test the defaul server block.
# making sure it matches path in the upstream proxy
curl -v -H "Host: talk.sunspotter.org" http://localhost:8080/users/%E7%8E%8B%E5%8F%AF%E8%90%B1/index.html

Note: You must provide a host when testing locally or the implicit localhost host header will be used.

Read more at the Nginx request processing docs

Simulate the jenkins test step

Use the test-http image to replicate the jenkins Test HTTP response stage. Uncomment the test-http conatiner in the docker-compose yaml.

docker-compose run --rm test-http
# in the alpine conatiner install curl
apk add --no-cache curl
# and test a request to nginx static image
curl -vk http://nginx/index.html

Deployment

The nginx proxy portion of this repo is deployed to staging on pushes to the master branch via a Github Action. Deploys to production occur on pushes to the production-release tag and can be initiated via chatops in Slack with lita deploy static.

Ingress application also managed via a production-ingresses tag, which triggers the Apply Ingresses workflow. This workflow checks the diff between the hash tagged by the production-ingress-release tag and the current head and applies the templates that have changed. It then updates the latter tag to indicate the updates have been made. The production-ingreses tag can be pushed manually or via chatops with the lita apply ingresses command.