Skip to content

ci: deploy the website to S3 and CloudFront - #227

Open
davecramer wants to merge 1 commit into
mainfrom
ci-deploy-site-s3
Open

davecramer wants to merge 1 commit into
mainfrom
ci-deploy-site-s3

Conversation

@davecramer

Copy link
Copy Markdown
Contributor

Builds https://odbc.postgresql.org/ in GitHub Actions and deploys it to S3 and CloudFront, following the pgjdbc site deploy.

This branch is on top of #226, which registers docs-deploy.yml on main so that the deploy can be started from this branch before it is merged. Merge #226 first; this PR then replaces its placeholder.

Workflows

  • docs.yml builds the site from psqlodbc-www with its docs/ directory replaced by docs/ from this repository. That is the copy the psqlodbc-www README asks for. It uploads the result as the site artifact. It runs on pull requests that change docs/ or either workflow, and lints both workflows there with actionlint.
  • docs-deploy.yml calls docs.yml and, on main only, uploads the site to s3://<bucket>/site/<branch>/<yyyymmddThhmmssZ>-<commit>/. It then sets the CloudFront KeyValueStore key to <branch>/<yyyymmddThhmmssZ>-<commit>. Earlier deploys stay in the bucket, so a rollback sets the key back to an earlier value. A run on another branch builds the site and stops there.

Start a deploy with:

gh workflow run docs-deploy.yml -R postgresql-interfaces/psqlodbc --ref main

Needed before the first deploy

None of this is created by this PR:

  • The repository variables SITE_AWS_ROLE_ARN, SITE_AWS_REGION, SITE_S3_BUCKET, SITE_CLOUDFRONT_KVS_ARN and SITE_CLOUDFRONT_KVS_KEY, described at the top of docs-deploy.yml.
  • An IAM role that trusts GitHub OIDC for this repository, and can write to the bucket and update the KeyValueStore.
  • A CloudFront distribution whose function adds site/ in front of the key value.
  • /backups/psqlodbc-cvs.tar.bz2, which the current site serves but neither repository contains, served from outside site/.
  • DNS for odbc.postgresql.org, which PostgreSQL infrastructure manages.

Testing

I ran the build step locally. Its output has the psqlodbc-www pages, media/ and README.txt, with docs/ from this repository. The deploy job has not been run, because the AWS resources above don't exist yet.

docs.yml builds the site from psqlodbc-www on git.postgresql.org with
its docs/ directory replaced by docs/ from this repository, and uploads
it as the site artifact. It runs on pull requests that change docs/ or
the two workflows, and lints the workflows there with actionlint.

docs-deploy.yml calls docs.yml and, on main, uploads the site to the S3
bucket under a new prefix and points the CloudFront KeyValueStore key at
that prefix, so a rollback sets the key back to an earlier deploy. A run
on another branch builds the site and stops there. The bucket, role and
KeyValueStore come from repository variables, which the comment at the
top of docs-deploy.yml lists.

This follows the pgjdbc site deploy.

Assisted-By: Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant