{"id":13878511,"url":"https://github.com/bibendi/dip-example-rails","last_synced_at":"2025-07-29T07:31:56.735Z","repository":{"id":35966518,"uuid":"152127049","full_name":"bibendi/dip-example-rails","owner":"bibendi","description":"Example modern Rails application running by Dip.","archived":false,"fork":false,"pushed_at":"2023-01-19T11:20:28.000Z","size":868,"stargazers_count":20,"open_issues_count":26,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-19T09:26:32.224Z","etag":null,"topics":["dip","docker","docker-compose","rails"],"latest_commit_sha":null,"homepage":"https://github.com/bibendi/dip","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/bibendi.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}},"created_at":"2018-10-08T18:28:06.000Z","updated_at":"2024-11-13T15:00:02.000Z","dependencies_parsed_at":"2023-02-10T23:15:24.837Z","dependency_job_id":null,"html_url":"https://github.com/bibendi/dip-example-rails","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/bibendi%2Fdip-example-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibendi%2Fdip-example-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibendi%2Fdip-example-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibendi%2Fdip-example-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bibendi","download_url":"https://codeload.github.com/bibendi/dip-example-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227674007,"owners_count":17802301,"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":["dip","docker","docker-compose","rails"],"created_at":"2024-08-06T08:01:51.839Z","updated_at":"2024-12-03T20:47:42.069Z","avatar_url":"https://github.com/bibendi.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"This is the exmaple of modern Ruby on Rails application. \nIt consists of RoR 6, Postgres, Redis, Webpack, React. \nAll services are described in the docker-compose.yml.\n\n# How to run?\n\nThis application customized that we can run it in two ways. Either run by Docker Compose only or by DIP. \nThis way we can smoothly and gradually move members of your team to use DIP. \nFor veterans is nothing change. They as before run the application by `docker-compose up rails webpack` \nand open `localhost:3000` in a browser. \nBTW, you can try it now after hand setup (see provision section in dip.yml). \nFor progressive users (yeap, I mean us) everything is simple. \nI hope you already read [how to set up local dns](https://github.com/bibendi/dip/tree/master/docs) for getting the best experience. \nAnd Nginx must be running by `dip nginx up`. That's all we have to do once. After reboot, it will start automatically.\nAlso, I strongly recommend you [integrate DIP to your ZSH shell](https://github.com/bibendi/dip#integration-with-shell) \nfor the best experience. \nNext simply run `provision` and the application will set up.\nIf you choose not the `.docker` top level domain then you must add `DOCKER_TLD=yourdomain` to `~/.bashrc` and reopen the console.\nAfter that run `webpack` and in another console `rails s`. \nAlso, you can leave webpack running in the background by `up -d webpack`. Where `up` is a alias for `docker-compose up`. \nOpen http://dip-rails.docker and all should work.\n\n# Usage\n\nAssume that you have integrated DIP into ZSH shell, \nso all commands below run in a console without the `dip` \"prefix\".\n\n```sh\n# provision application\nprovision\n\n# run rails app with all debuging capabilities (i.e. `binding.pry`)\nrails s\n\n# run rails console\nrails c\n\n# run webpack\nup -d webpacker\n# `-d` - mean that service will run in detached (background) mode\nor\nwebpack\n\n# run migrations\nrake db:migrate\n\n# pass env variables into application\nVERSION=20100905201547 rake db:migrate:down\n\n# run sidekiq\nup -d sidekiq\nor\nsidekiq\n\n# launch bash within app directory\nbash\n\n# Additional commands\n\n# update gems or packages\nbundle install\nyarn install\n\n# run psql console\npsql app\n# where `app` is a database name. It might be `app_test`.\n\n# run redis-cli\nredis-cli\n\n# run tests\n# TIP: `rspec` command is already auto prefixed with `RAILS_ENV=test`\nrspec spec/path/to/single/test.rb:23\n\n# run system tests\n# webpack should be running with test environment\nRAILS_ENV=test webpack\nrspec spec/system\n\n# shutdown all containers\ndown\n```\n\n# How this application has been created from scratch?\n\nThe main goal of using Docker is not having all dependencies installed on the host machine. \nSo the first question is how to create an application without having rails? \nFirst of all, in an empty directory, we should add `Dockerfile`, `docker-compose.yml` and `dip.yml`. \nThen run `dip bash` where we can temporarily install `rails` gem by running `gem install rails`. \nAfter that, we have to generate the skeleton of our application. \nRun `rails new -d postgresql --skip-turbolinks --skip-bundle --webpack=react --skip --skip-test --skip-system-test .` \nType `exit` and we will return into the host machine. \nNext, fix files permissions by running `sudo chown -R $USER:$USER .`. \nThe last step we will need to run `dip provision`. \nThat's all! Farther we customize the application how do you like. \nI strongly recommend learning the source code of this application. \nMaybe you simply decide to pick up it entirely because most pitfalls are found.\n\n\nWill be continued...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbibendi%2Fdip-example-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbibendi%2Fdip-example-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbibendi%2Fdip-example-rails/lists"}