{"id":13840541,"url":"https://github.com/CleverCloud/sinatra-postgresql-example","last_synced_at":"2025-07-11T09:31:58.293Z","repository":{"id":138078522,"uuid":"105636315","full_name":"CleverCloud/sinatra-postgresql-example","owner":"CleverCloud","description":"Run Sinatra with PostgreSQL on Clever Cloud","archived":false,"fork":false,"pushed_at":"2017-10-05T11:38:07.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-08-04T17:08:45.438Z","etag":null,"topics":["clevercloud-example","postgresql","ruby","sinatra"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleverCloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-10-03T09:51:45.000Z","updated_at":"2024-08-04T17:08:45.439Z","dependencies_parsed_at":"2024-01-31T03:46:56.549Z","dependency_job_id":"22e47472-c99e-4c95-b52b-6587682cfbb8","html_url":"https://github.com/CleverCloud/sinatra-postgresql-example","commit_stats":null,"previous_names":["clevercloud/demo-sinatra-puma-activerecord"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CleverCloud/sinatra-postgresql-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fsinatra-postgresql-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fsinatra-postgresql-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fsinatra-postgresql-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fsinatra-postgresql-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleverCloud","download_url":"https://codeload.github.com/CleverCloud/sinatra-postgresql-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fsinatra-postgresql-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264777753,"owners_count":23662553,"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":["clevercloud-example","postgresql","ruby","sinatra"],"created_at":"2024-08-04T17:00:50.165Z","updated_at":"2025-07-11T09:31:57.967Z","avatar_url":"https://github.com/CleverCloud.png","language":"Ruby","funding_links":[],"categories":["Examples"],"sub_categories":["Ruby"],"readme":"# demo-sinatra-puma-activerecord\n\n## Setting up environment\n\n### The Clever Cloud application environment\n\nCreate a ruby application, a postgresql addon and link the addon to your application.\n\nTell Clever Cloud to deploy the API using puma (the default is uwsgi as of now) by adding this environment variable:\n`CC_RACKUP_SERVER=\"puma\"`\n\nTell Clever Cloud to run database migrations before launching the API by adding this environment variable:\n`CC_PRE_RUN_HOOK=\"bundle exec rake db:migrate\"`. You can also run this locally as long as you import the correct\nenvironment to connect to your addon.\n\nSpecify the maximum number of PG connections your application will use (depending on the selected plan)\nby adding an environment variable like `DB_POOL=5` if you want to use 5 connections.\n\n### The local ruby environment (not needed if running on Clever Cloud)\n\nFirst, you need to install postgresql, ruby and bundler.\n\nThe required version of ruby is specified at the top of `gems.rb`.\n\nIf you haven't already, setup `~/.bundle/config` as such:\n\n```\nBUNDLE_PATH: .bundle\nBUNDLE_DISABLE_SHARED_GEMS: \"1\"\n```\n\nThis will cause bundle not to use system gems, and to install the local ones in the `.bundle`\ndirectory of the applicaiton, which is `.gitignore`'d.\n\n### The local application environment (not needed if running on Clever Cloud)\n\nJust create a `.env` file (which is `.gitignore`'d) as such:\n\n```\nexport POSTGRESQL_ADDON_HOST=localhost\nexport POSTGRESQL_ADDON_PORT=5432\nexport POSTGRESQL_ADDON_USER=user\nexport POSTGRESQL_ADDON_PASSWORD=secret\nexport POSTGRESQL_ADDON_DB=demo\n```\n\nYou can also add\n\n```\nexport DB_POOL=\u003cthe pool size\u003e\n```\n\nFor production, you should also add:\n```\nexport RACK_ENV=production\nexport RAILS_ENV=production\n```\n\n## Start the API on Clever Cloud\n\nJust run `git push` or hit the redeploy button if you run it from a github fork, nothing else to do.\n\n## Start the API locally (not needed if running on Clever Cloud)\n\n```\nsource .env\nbundle install\nbundle exec rake db:migrate\nbundle exec rackup\n```\n\n## Coding style\n\n- run `bundle exec rake`\n- fix the warnings :-)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCleverCloud%2Fsinatra-postgresql-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCleverCloud%2Fsinatra-postgresql-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCleverCloud%2Fsinatra-postgresql-example/lists"}