The page(s) are generated every five minutes by a Cloud Function which uploads the result to a public Cloud Storage Bucket whose contents are served by Cloudflare. Each build uses the contents of .config to build a GraphQL query for the GitHub API. This data is then used to execute the website templates and build the static output files.
This process means the website contents, like user icon and repo descriptions, will always be up-to-date, without impacting response time. It also makes it easy, fast and version-controlled to update the list of projects and contributions shown on the website.
$ go run ./development/build.go
This command will output index.html
in the project root and uses the local .config
to fetch for data.
After the initial build, the ./templates
directory is watched for changes. Manual rebuilds can be triggered by typing .\n
.
If a .env
file exists in the project root, it will automatically be loaded.
The GRAPHQL_TOKEN
environment variable must be defined to access the GitHub API.
To publish Go dependency changes outside the ./functions
directory, commit/push the changes and run ./scripts/update-function-deps.sh
.
This project's resources are all managed using Terraform. Any change to the main branch will automatically be applied (using Cloud Build). However, some initial manual setup is required:
- A Source Repository must be connected to the GitHub project to act as a trigger for Cloud Build.
- Cloud Build's Terraform build step requires a terraform cloud builder image available in the project's Container Registry. Instructions available here.
As of this writing (Nov 2018)
- Default cloud function service account must have
Storage Object Admin
Role.