Gamify getting your tasks done with Pomodoro timers. Pomodoro Up is a Rails 6.1 app running on Ruby 2.7.2 and deployed to Heroku.
- Set up repository
git clone git@github.com:ndharani/pomodoro-up.git
- Build Docker container
cd pomodoro_up/
docker-compose build
- Launch app
docker-compose up
- Navigate to the UI on your browser
0.0.0.0:3000
- Get into test container and run tests
docker-compose run --rm pomodoro_up_test sh
rails test
...
exit
- Get into the app's container
docker ps
docker exec -it [container_id] sh
...
exit
- Run rails console
docker-compose run --rm pomodoro_up_app rails c
If you get a "Blocked host" error, follow the suggestion to add your domain to the config.hosts variable in the config/environments/development.rb file, for example:
config.hosts << "ndharani-pomodoro-up-ph5x-3000.githubpreview.dev"
Restart the server if needed.
- Sign up at
/signup - Log in at
/loginand get redirected to your homepage - See your task lists at
/task_lists - Start a pomodoro timer and manage your task list
To run tests:
docker-compose run --rm pomodoro_up_test rails test
- Create a new migration, e.g. to create a
userstable
docker-compose run --rm pomodoro_up_app sh
rails generate model User
...
exit
- Modify newly created migration file
- Execute migration:
rails db:migrate - To undo the last migration:
rails db:rollback
- Create a new controller
docker-compose run --rm pomodoro_up_app sh
rails generate controller users
- Edit the controller file
Gems are ruby packages. To install a new package
- Add the gem and its version to Gemfile
- Run
docker-compose run --rm pomodoro_up_app bundle install
yarn add [package-name]
docker-compose up pomodoro_up_app
Prereqs:
- Install heroku:
curl https://cli-assets.heroku.com/install.sh | sh - Log in:
heroku login -i
To deploy:
-
Log in to Container Registry
$ heroku container:login
-
Push your Docker-based app Build the Dockerfile in the current directory and push the Docker image.
$ heroku container:push web -
Deploy the changes Release the newly pushed images to deploy the app.
$ heroku container:release web
Useful commands
heroku opento open the websiteheroku logsto see build logs, app logs, etc
For more information: https://devcenter.heroku.com/articles/container-registry-and-runtime
Error: server is already running error when starting the rails server.
Remediation:
a) killall ruby to kill running ruby pids
b) remove the tmp/pids/server.pid file
Generally, if something errors/breaks, try shutting the app down and bringing it back up.