{"id":21017015,"url":"https://github.com/gsa/cloudgov-demo-postgrest","last_synced_at":"2025-05-15T05:33:25.738Z","repository":{"id":65240067,"uuid":"245262815","full_name":"GSA/cloudgov-demo-postgrest","owner":"GSA","description":"Get a federally-compliant REST API for your CSV data on cloud.gov in about 60 seconds. ATO not included.","archived":false,"fork":false,"pushed_at":"2020-04-06T22:04:20.000Z","size":38,"stargazers_count":18,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-03T04:51:09.729Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GSA.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-05T20:37:53.000Z","updated_at":"2025-01-10T03:48:25.000Z","dependencies_parsed_at":"2023-01-16T14:52:58.543Z","dependency_job_id":null,"html_url":"https://github.com/GSA/cloudgov-demo-postgrest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GSA%2Fcloudgov-demo-postgrest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GSA%2Fcloudgov-demo-postgrest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GSA%2Fcloudgov-demo-postgrest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GSA%2Fcloudgov-demo-postgrest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GSA","download_url":"https://codeload.github.com/GSA/cloudgov-demo-postgrest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254282993,"owners_count":22045131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T10:17:36.422Z","updated_at":"2025-05-15T05:33:25.453Z","avatar_url":"https://github.com/GSA.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Requirements\n- A [`cloud.gov`](https://cloud.gov) account\n- [`jq`](https://stedolan.github.io/jq/) `brew install jq`\n\n# cloudgov-demo-postgrest\n\nThis demo shows you how to get a federally-compliant REST API for your CSV data on [cloud.gov](https://cloud.gov) in about 60 seconds. \n\n[ATO](https://atos.open-control.org/steps/#top) not included.\n\n# Trying it out\n\n## Deploying the demo\nIf you haven't already, [set up your cloud.gov account](https://cloud.gov/docs/getting-started/accounts/) and [log in to cloud.gov](https://cloud.gov/docs/getting-started/setup/).\n\nOpen a terminal, then clone this repository.\n\n```sh\n~$ git clone https://github.com/GSA/cloudgov-demo-postgrest.git\n```\n\n(Alternatively, [download a ZIP file](https://codeload.github.com/GSA/cloudgov-demo-postgrest/zip/master) and unzip it to create the `cloudgov-demo-postgrest` folder.)\n\nChange into that directory.\n\n```sh\n~$ cd cloudgov-demo-postgrest\n```\n\nCopy `vars.yml.template` to `vars.yml`, and run the deploy script\n\n```sh\n~$ cp vars.yml.template vars.yml\n~$ ./deploy.sh\n```\n\nOnce that operation completes, run\n\n```sh\n~$ cf apps\n```\n\nYou'll see the URL your application was assigned. The output will look like:\n\n```sh\nGetting apps in org sandbox-agencyname / space your.name as your.name@agencyname.gov...\nOK\n\nname        requested state   instances   memory   disk   urls\npostgrest   started           1/1         512M     1G     postgrest-vivacious-wolverine-lu.app.cloud.gov\n```\n\nYou can now run (with your own URL):\n\n```sh\n~$ curl -s \"https://{your-app-url}/Inspection_Results_School_Food_Service?GradeRecent=eq.C\" | jq .\n```\n\nYou should see a nicely formatted JSON response using the awesome [`jq`](https://stedolan.github.io/jq/) utility. To learn more about querying data in PostgREST, [see the docs](https://postgrest.org/en/v3.2/api_reading.html#filtering).\n\n## Cleaning up the demo\n\nRun \n```sh\n./cleanup.sh\n```\n\n# Next steps\n\n## Try using your own data\n\nThe sample data is in the [`data`](data) directory. You can drop your own `.csv` files there before running `./deploy.sh`. Each file you put in the directory will be turned into a REST API endpoint. (For example, the filename `myfile.csv` will be available at the REST API endpoint `https://{your-app-url}/myfile`).\n\n## Try customizing the data import process\n\nYou can edit the `init.sh` script in the [`data`](data) directory and go to town. (The default behavior just uses [`csvkit`](https://csvkit.readthedocs.io), which you might find useful.)\n\n#  DBAs demand answers\n\n## WHAT IS THIS SORCERY?!\n\nThis was all made possible through the magic of [PostgREST](http://postgrest.org)... We're just providing the cloud.gov glue here. With this tech in hand, you're not just a DBA, you're a backend web developer now. Have a look at the [PostgREST docs](http://postgrest.org/en/v6.0/) to see what else you can do!\n\n## What about access control?\n\nThe [`shared-psql` plan in use on cloud.gov](https://cloud.gov/docs/services/relational-database/) is a community resources, and does not give you `CREATEUSER` or `CREATEROLE` permissions. You'll need to use the `medium-psql` plan or higher for that.\n\nYou can use the [`service-connect` plugin](https://github.com/18F/cf-service-connect) to connect to the DB and create roles by hand, but a better way is to customize `init.sh` to do what you want in a repeatable way. (See the `setup-roles.py` script for an example of how to make DB queries without the `psql` client available.)\n\n## How can I scale this up?\n\n```sh\ncf scale -i INSTANCES -m MEMORY postgrest\n```\n\n...where `INSTANCES` is the number of web services you want serving requests, and `MEMORY` is the memory allocated for each instance.\n\n## How much does this cost to run? \n\nIt's free to run this demo in your sandbox space. See [cloud.gov pricing](https://cloud.gov/pricing/) if you want to instead host it in a more durable prototyping or production space. (Note that using both PostgREST and cloud.gov is going to save you a ridiculous amount of money on custom app code and compliance, so make sure you're comparing the cost of cloud.gov hosting to the real costs of going another route.)\n\n# Contributing\n\nSee [CONTRIBUTING](CONTRIBUTING.md) for additional information.\n\n## Public domain\n\nThis project is in the worldwide [public domain](LICENSE.md). As stated in [CONTRIBUTING](CONTRIBUTING.md):\n\n\u003e This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).\n\u003e\n\u003e All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsa%2Fcloudgov-demo-postgrest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgsa%2Fcloudgov-demo-postgrest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsa%2Fcloudgov-demo-postgrest/lists"}