|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e |
| 4 | + |
| 5 | +if [[ -n "${DB_DEBUG}" ]]; then |
| 6 | + set -x |
| 7 | +fi |
| 8 | + |
| 9 | +S3_URIS=( |
| 10 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/AK/2021-08-13T09:23:10.238Z/" |
| 11 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/AL/2021-08-13T02:30:40.369Z/" |
| 12 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/AR/2021-08-13T06:43:09.147Z/" |
| 13 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/AZ/2021-08-12T21:42:38.860Z/" |
| 14 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/CA/2022-04-26T14:12:02.125Z/" |
| 15 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/CO/2021-10-26T03:41:25.119Z/" |
| 16 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/CT/2021-10-26T00:33:03.521Z/" |
| 17 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/DC/2021-08-13T09:30:57.826Z/" |
| 18 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/DE/2021-08-13T09:33:21.756Z/" |
| 19 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/FL/2021-08-12T23:20:51.764Z/" |
| 20 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/GA/2021-08-13T00:54:52.804Z/" |
| 21 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/HI/2021-08-13T08:14:36.412Z/" |
| 22 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/IA/2021-08-13T07:04:13.080Z/" |
| 23 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/ID/2021-08-12T22:37:52.328Z/" |
| 24 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/IL/2021-08-12T21:17:43.961Z/" |
| 25 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/IN/2021-09-25T22:14:17.196Z/" |
| 26 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/KS/2021-08-13T07:25:22.917Z/" |
| 27 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/KY/2021-08-13T10:53:12.868Z/" |
| 28 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/LA/2021-08-13T06:19:58.665Z/" |
| 29 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/MA/2021-08-26T04:34:52.224Z/" |
| 30 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/MD/2021-10-26T04:11:55.734Z/" |
| 31 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/ME/2021-11-09T05:45:39.150Z/" |
| 32 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/MI/2021-08-12T22:15:23.087Z/" |
| 33 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/MN/2021-08-13T05:36:28.223Z/" |
| 34 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/MO/2021-08-26T06:00:34.143Z/" |
| 35 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/MS/2021-08-16T22:06:02.598Z/" |
| 36 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/MT/2021-08-12T23:47:43.719Z/" |
| 37 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/NC/2021-08-13T02:01:34.979Z/" |
| 38 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/ND/2021-11-09T05:17:57.283Z/" |
| 39 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/NE/2021-08-13T08:11:04.020Z/" |
| 40 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/NH/2021-08-13T08:31:17.998Z/" |
| 41 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/NJ/2021-09-28T15:16:51.806Z/" |
| 42 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/NM/2021-08-13T12:27:10.872Z/" |
| 43 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/NV/2021-10-26T01:02:17.677Z/" |
| 44 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/NY/2021-10-24T19:42:40.981Z/" |
| 45 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/OH/2021-08-13T00:20:02.287Z/" |
| 46 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/OK/2021-08-12T20:02:31.231Z/" |
| 47 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/OR/2021-09-25T21:13:46.552Z/" |
| 48 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/PA/2021-08-13T13:08:34.609Z/" |
| 49 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/PR/2022-01-07T22:22:27.542Z/" |
| 50 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/RI/2021-08-13T08:34:27.788Z/" |
| 51 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/SC/2021-08-13T05:57:28.817Z/" |
| 52 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/SD/2021-08-13T13:20:27.234Z/" |
| 53 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/TN/2021-08-26T07:08:17.785Z/" |
| 54 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/TX/2022-04-26T14:34:19.894Z/" |
| 55 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/UT/2022-01-26T21:06:31.562Z/" |
| 56 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/VA/2021-11-09T06:55:41.244Z/" |
| 57 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/VT/2021-08-13T09:51:55.169Z/" |
| 58 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/WA/2021-10-26T02:40:59.376Z/" |
| 59 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/WI/2021-08-13T01:25:55.432Z/" |
| 60 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/WV/2021-08-16T22:53:12.903Z/" |
| 61 | + "s3://global-districtbuilder-dev-us-east-1/regions/US/WY/2021-08-13T10:07:40.461Z/" |
| 62 | +); |
| 63 | + |
| 64 | +function usage() { |
| 65 | + echo -n \ |
| 66 | + "Usage: $(basename "$0") |
| 67 | +Load region configs for all 50 states + DC + PR |
| 68 | +" |
| 69 | +} |
| 70 | + |
| 71 | +if [ "${BASH_SOURCE[0]}" = "${0}" ]; then |
| 72 | + if [ "${1:-}" = "--help" ]; then |
| 73 | + usage |
| 74 | + else |
| 75 | + # Bring up PostgreSQL and NestJS in a way that respects |
| 76 | + # configured service health checks. |
| 77 | + docker-compose \ |
| 78 | + -f docker-compose.yml \ |
| 79 | + up -d database server |
| 80 | + |
| 81 | + for S3_URI in "${S3_URIS[@]}"; do |
| 82 | + docker-compose \ |
| 83 | + exec database psql -U districtbuilder districtbuilder -c " |
| 84 | + INSERT INTO region_config |
| 85 | + VALUES ( |
| 86 | + DEFAULT, |
| 87 | + '${S3_URI:53:2}', |
| 88 | + 'US', |
| 89 | + '${S3_URI:53:2}', |
| 90 | + '$S3_URI' |
| 91 | + ) ON CONFLICT DO NOTHING" |
| 92 | + done |
| 93 | + ./scripts/yarn server run set-topology-size |
| 94 | + fi |
| 95 | +fi |
0 commit comments