{"id":14067414,"url":"https://github.com/analythium/heroku-shiny","last_synced_at":"2026-01-07T15:58:12.801Z","repository":{"id":108484001,"uuid":"329494904","full_name":"analythium/heroku-shiny","owner":"analythium","description":"Deploy Shiny Apps to Heroku with CLI and CI/CD","archived":false,"fork":false,"pushed_at":"2022-10-14T15:55:56.000Z","size":58,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-04T07:37:31.533Z","etag":null,"topics":["cicd","docker","heroku","shiny"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/analythium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-01-14T03:17:39.000Z","updated_at":"2021-08-07T20:18:31.000Z","dependencies_parsed_at":"2023-06-25T23:59:14.732Z","dependency_job_id":null,"html_url":"https://github.com/analythium/heroku-shiny","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/analythium/heroku-shiny","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fheroku-shiny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fheroku-shiny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fheroku-shiny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fheroku-shiny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/analythium","download_url":"https://codeload.github.com/analythium/heroku-shiny/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fheroku-shiny/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267792337,"owners_count":24144929,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cicd","docker","heroku","shiny"],"created_at":"2024-08-13T07:05:34.958Z","updated_at":"2026-01-07T15:58:12.776Z","avatar_url":"https://github.com/analythium.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"# Heroku deployment examples\n\nWorkflow (works with public and privare repositories):\n\n- start with this template or modify your app taking this as an example\n- run `renv::init()` or `renv::snapshot()` to capture dependencies in the `renv.lock` file\n- work on your app\n- add secrets to your GitHub repo settings and follow steps below\n\nThe `/app` folder contains the shiny app. The demo app was taken from here:\nhttps://github.com/analythium/shinyproxy-demo\n\nNote: Shiny apps [time out after 55 seconds](https://devcenter.heroku.com/articles/limits#http-timeouts):\n\n\u003e After the initial response, each byte sent from the server restarts a rolling 55 second window. A similar 55 second window is restarted for every byte sent from the client.\n\u003e\n\u003e If no data is received from the dyno within the 55 second window the connection is terminated and an H15 error is logged.\n\u003e\n\u003e Similarly, if no data is received from the client within the 55 second window, the connection is terminated and an H28 error is logged.\n\nA workaround was posted on [SO](https://stackoverflow.com/questions/54594781/how-to-prevent-a-shiny-app-from-being-grayed-out) to print a dot to the console every passage of 10 seconds. \nA counter set at 50 seconds interval is added to `/app/server.R`:\n\n```R\n## prevent timeout\nautoInvalidate \u003c- reactiveTimer(intervalMs = 50*1000)\nobserve({\n    autoInvalidate()\n    cat(\".\")\n})\n```\n\nThe following deployment options are explained here:\n\n- [Using GitHub actions](#using-github-actions)\n- [Using local Heroku CLI](#using-local-heroku-cli)\n\n## Deployment using GitHub actions\n\nLog into Heroku, in the dashboard, click on 'New' then select 'Create new App'.\nGive a name (e.g. `shiny-cicd`, if available, this will create the app at https://shiny-cicd.herokuapp.com/) to the app and create the app.\n\nGot to the Settings tab of the repo, scrolld down to Secrets and add the\nfollowing new repository secrets:\n\n- `HEROKU_EMAIL`: your Heroku email\n- `HEROKU_APP_NAME`: you application name from above\n- `HEROKU_API_KEY`: your Heroku api key, you can find it under your personal settings, click on reveal and copy\n\nSee the `.github/workflows/deploy.yml` file for additional options\n(`dockerfile_name`, `docker_options`, `dockerfile_directory`)\n\n## Deployment using local Heroku CLI\n\n### Prerequisites\n\n- Install [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli#download-and-install)\n- R \u0026 Shiny\n- Docker Engine installed \u0026 a Docker Hub account\n\n### Building Docker Images with heroku.yml\n\nSee docs: https://devcenter.heroku.com/articles/build-docker-images-heroku-yml\n\n#### Pieces\n\nCreate a `heroku.yml` file in your application's root directory. The following example heroku.yml specifies the Docker image to build for the app’s web process:\n\n```yaml\nbuild:\n  docker:\n    web: Dockerfile\n```\n\nHeroku uses the `CMD` specified in the Dockerfile.\n\nThe Dockerfile defines system requirements, R package dependencies.\n\n```Dockerfile\nFROM rocker/r-base:latest\n\n...\n\nENV PORT=8080\n\nCMD [\"R\", \"-e\", \"shiny::runApp('/home/app', host = '0.0.0.0', port=as.numeric(Sys.getenv('PORT')))\"]\n```\n\nThe port settings and the `CMD` part is different from ShinyProxy apps,\nport number is passed as an env var by the Heroku container runtime.\n\n#### Create app\n\nSee also here: https://github.com/virtualstaticvoid/heroku-docker-r\n\nCommit your changes if any (only  repos with new commits will deploy once the app is already on Heroku):\n\n```git\ngit commit -m \"Changed\"\n```\n\nCreate the Heroku application with the container stack\n\n```bash\nheroku create --stack=container\n```\n\nNow you should see the app url.\n\nOr configure an existing application to use the container stack.\n\n```bash\nheroku stack:set container\n```\n\n#### Deploy\n\nDeploy your application to Heroku, replacing `\u003cbranch\u003e` with your branch,\ne.g. `main`:\n\n```bash\ngit push heroku \u003cbranch\u003e\n```\n\nNow you see the build logs on the Heroku remote.\n\n#### Open app\n\nNow open the app in your browser:\n\n```bash\nheroku open\n```\n\nhttps://morning-springs-64281.herokuapp.com/\n\n### Test the Docker container locally\n\nTo build the image from the Dockerfile, run:\n\n```bash\nsudo docker build -t analythium/heroku-demo .\n```\n\nTest:\n\n```bash\ndocker run -p 4000:8080 analythium/heroku-demo\n```\nthen visit `127.0.0.1:4000`.\n\n(c) Copyright [Analythium Solutions Inc.](https://analythium.io), 2021 (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanalythium%2Fheroku-shiny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanalythium%2Fheroku-shiny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanalythium%2Fheroku-shiny/lists"}