cal-itp / data-analyses

Place for sharing quick reports, and works in progress
https://analysis.calitp.org
27 stars 6 forks source link

migrate from netlify to GCS #849

Open atvaccaro opened 1 year ago

atvaccaro commented 1 year ago

We briefly discussed future plans for the portfolio site awhile back (e.g. https://github.com/cal-itp/data-analyses/issues/715) and we decided it's time to finally start exploring this migration. We've struggled with netlify recently (specifically deploying individual sites under redirects) and we don't have paid support, so it's probably worthwhile to just migrate to a static site served from a GCS bucket.

The general steps are:

  1. Create a new bucket and configure it as a GCP-hosted static site behind a load balancer; see this document created by the services team for gtfs.calitp.org
  2. Change portfolio.py to write to the proper subpaths in the bucket for individual sites; this would involve replacing netlify deploy with gsutil or gcsfs
  3. (Potential) May have to configure JupyterBook to render links etc. under a subpath
  4. Remove _redirects and modify index.html if needed to function properly as the bucket home page
  5. (Optional) Configure CI to allow deploys with a button (i.e. workflow dispatches) for at least the index
mjumbewu commented 1 month ago

I'm not sure whether it is new since the Cal-ITP GTFS Hosting doc was written, but GCP has a set of steps for this at https://cloud.google.com/storage/docs/hosting-static-website#command-line_1. The general steps above still apply, but that documentation is useful for the specific gcloud commands.

ohrite commented 3 weeks ago

@mjumbewu once you have GCS credentials set up, let's make sure there's a runbook about GitHub GCS credential rotation as part of acceptance. Maybe this is something to pair on?