{"id":18526707,"url":"https://github.com/rogusdev/docker_heroku_rails","last_synced_at":"2026-01-27T21:17:13.882Z","repository":{"id":142081006,"uuid":"113252313","full_name":"rogusdev/docker_heroku_rails","owner":"rogusdev","description":"Demo Docker running Rails on Heroku via CircleCI with Postgresql and Redis","archived":false,"fork":false,"pushed_at":"2017-12-06T14:26:28.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-10T15:40:24.683Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/rogusdev.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,"publiccode":null,"codemeta":null}},"created_at":"2017-12-06T01:20:14.000Z","updated_at":"2019-07-02T16:34:31.000Z","dependencies_parsed_at":"2023-07-22T16:15:31.489Z","dependency_job_id":null,"html_url":"https://github.com/rogusdev/docker_heroku_rails","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rogusdev/docker_heroku_rails","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogusdev%2Fdocker_heroku_rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogusdev%2Fdocker_heroku_rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogusdev%2Fdocker_heroku_rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogusdev%2Fdocker_heroku_rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rogusdev","download_url":"https://codeload.github.com/rogusdev/docker_heroku_rails/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogusdev%2Fdocker_heroku_rails/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28823191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-11-06T17:52:15.698Z","updated_at":"2026-01-27T21:17:13.865Z","avatar_url":"https://github.com/rogusdev.png","language":null,"readme":"# docker_heroku_rails\nDemo how to build a docker rails service deployed to heroku through circleci with postgres and redis attached\n\n- use vagrant to start environment in which to run docker\n- ^ docker is NOT a VM!  (it can and frequently does run IN a VM)\n- use docker image to bootstrap new rails app\n- deploy to heroku\n- deploy using circleci\n- use a C# dotnet app instead\n- use existing rails app\n\n\n1. Install VirtualBox: https://www.virtualbox.org/wiki/Downloads\n1. Install Vagrant: https://www.vagrantup.com/downloads.html\n\n```\ngit clone git@github.com:rogusdev/docker_heroku_rails.git\ncd docker_heroku_rails/\ncp ../Vagrantfile ./\ncp ../README.md ./\n\nvagrant up\nchmod 600 .vagrant/machines/default/virtualbox/private_key\nscp -r -i .vagrant/machines/default/virtualbox/private_key -P 2222 ~/.ssh/id_rsa* ubuntu@127.0.0.1:/home/ubuntu/.ssh/\nvagrant ssh\n\n\ncat \u003c\u003c EOF \u003e .env\nSECRET_KEY_BASE=597eae9051c822c955c4e44f98e75b14beb7596845678e9bf8acab5fd02e7f12some000random00number00009c62c1b\nDATABASE_URL=postgres://postgres:@postgres:5432\nEOF\n\ncat \u003c\u003c EOF \u003e .dockerignore\n.DS_Store\n.dockerignore\n.env\n.git\n.gitignore\n.idea\n.vagrant\n.vscode\ndocker-compose.yml\nlog/*\ntmp/*\nEOF\n\ncat \u003c\u003c EOF \u003e .gitignore\n.DS_Store\n.env\n.idea\n.vagrant\n.vscode\nlog/*\ntmp/*\n.bundle\nvendor/bundle\nEOF\n\ncat \u003c\u003c EOF \u003e Gemfile\nsource 'https://rubygems.org'\ngem 'rails', '5.1.4'\nEOF\n\ntouch Gemfile.lock\n\necho \"web: bundle exec puma -C config/puma.rb\" \u003e Procfile\n\n\ncat \u003c\u003c EOF \u003e app.json\n{\n  \"name\": \"Docker Rails Heroku\",\n  \"description\": \"An example app.json for container-deploy\",\n  \"image\": \"heroku/ruby\",\n  \"addons\": [\n    \"heroku-postgresql\"\n  ]\n}\nEOF\n\n\ncat \u003c\u003c EOF \u003e Dockerfile\n# https://docs.docker.com/compose/rails/\n# http://codingnudge.com/2017/03/17/tutorial-how-to-run-ruby-on-rails-on-docker-part-1/\n# https://www.engineyard.com/blog/using-docker-for-rails\nFROM ruby:2.4.2\n#FROM heroku/heroku:16\n\nRUN apt-get update -qq \\\\\n    \u0026\u0026 apt-get install -y --no-install-recommends \\\\\n    build-essential \\\\\n    libpq-dev \\\\\n    nodejs \\\\\n    \u0026\u0026 rm -rf /var/lib/apt/lists/*\n\nENV RAILS_ROOT /var/www/app\n\nRUN mkdir -p \\$RAILS_ROOT/tmp/pids\n\nWORKDIR \\$RAILS_ROOT\n \nCOPY Gemfile Gemfile\nCOPY Gemfile.lock Gemfile.lock\n\nRUN bundle install\n\nCOPY . .\n\nCMD [\"bundle\", \"exec\", \"puma\", \"-C\", \"config/puma.rb\"]\n#CMD [\"bundle\", \"exec\", \"rails\", \"server\", \"-p\", \"3000\", \"-b\", \"0.0.0.0\"]\nEOF\n\n\ncat \u003c\u003c EOF \u003e docker-compose.yml\n# https://blog.codeship.com/running-rails-development-environment-docker/\n# https://nickjanetakis.com/blog/dockerize-a-rails-5-postgres-redis-sidekiq-action-cable-app-with-docker-compose\nversion: '3'\nservices:\n  postgres:\n    image: postgres:9.6\n    ports:\n      - \"5432:5432\"\n  redis:\n    image: redis:4.0.2\n    ports:\n     - \"6379:6379\"\n  web:\n    build: .\n    volumes:\n      - .:/var/www/app\n    ports:\n      - \"3000:3000\"\n    env_file: \".env\"\n    depends_on:\n      - postgres\n      - redis\nEOF\n\n\n# https://docs.docker.com/compose/rails/\n\ndocker-compose run web rails new . --force --database=postgresql\ndocker-compose build\ndocker-compose run web rails generate controller Welcome index\n\nsed -i \"3i\\  root to: 'welcome#index'\" config/routes.rb\n\nsudo sed -i \"/  pool:/ a \\\n\\  url: \u003c%= ENV['DATABASE_URL'] %\u003e\" config/database.yml\n\ndocker-compose run web rake db:create\ndocker-compose run -e \"RAILS_ENV=test\" web rake db:create db:migrate\ndocker-compose run -e \"RAILS_ENV=test\" web rake test\n\ndocker-compose up\n\n\ndocker ps -a \u0026\u0026 docker images\n#docker stop postgres:9.6\n#docker rm postgres:9.6\n#docker rmi ...\n\ndocker build -t docker-heroku-rails .\n\ndocker run --rm -it --env-file .env -p 0.0.0.0:3000:3000 docker-heroku-rails\n\n\nheroku plugins:install heroku-container-registry\nheroku login\nheroku container:login\n\nheroku create rogusdev-docker-heroku-rails\n#heroku apps:destroy rogusdev-docker-heroku-rails\n# https://rogusdev-docker-heroku-rails.herokuapp.com/\n\n# Look at the \"stack\" in \"Info\" on Heroku's settings for this app, under config vars:\n#  https://dashboard.heroku.com/apps/rogusdev-docker-heroku-rails/settings\n\nheroku container:push web\n\n\nvagrant halt\nvagrant destroy\n```\n\n\nIf you are not in a vagrant vm, you might need to remove postgres:\n```\n# https://askubuntu.com/questions/32730/how-to-remove-postgres-from-my-installation\ndpkg -l | grep postgres\n\nsudo apt-get --purge remove postgresql postgresql-common postgresql-client-common\n```\n\nIntegrating with CircleCI is possible but actually quite complicated -- these are just stubs I will fill in soon, the links tell the story for now:\n```\n# https://circleci.com/docs/2.0/deployment_integrations/#heroku\n# https://circleci.com/docs/2.0/project-walkthrough/#deploying-to-heroku\ncat \u003c\u003c EOF1 \u003e .circleci/setup-heroku.sh\n#!/bin/bash\nwget https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz\nsudo mkdir -p /usr/local/lib /usr/local/bin\nsudo tar -xvzf heroku-linux-amd64.tar.gz -C /usr/local/lib\nsudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku\n\ncat \u003e ~/.netrc \u003c\u003c EOF\nmachine api.heroku.com\n  login $HEROKU_LOGIN\n  password $HEROKU_API_KEY\nEOF\n\ncat \u003e\u003e ~/.ssh/config \u003c\u003c EOF\nVerifyHostKeyDNS yes\nStrictHostKeyChecking no\nEOF\nEOF1\n\n# https://circleci.com/docs/2.0/executor-types/#using-docker\ncat \u003c\u003c EOF \u003e .circleci/config.yml\nversion: 2\njobs:\n  build:\n    machine: true\n    steps:\n      - checkout\n      - run:\n          name: Greeting\n          command: echo Hello, world.\n      - run:\n          name: Print the Current Time\n          command: date\nEOF\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogusdev%2Fdocker_heroku_rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frogusdev%2Fdocker_heroku_rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogusdev%2Fdocker_heroku_rails/lists"}