DEV Community

Ahmad Ya'kob Ubaidullah
Ahmad Ya'kob Ubaidullah

Posted on

tomo deploy. Deploy rails app in one command. Heroku alike.

tomo deploy allow user to deploy with just one command. Tomo will do both setup and deploy processes. Tomo deploy will allow Heroku alike features to be install onto your own server

for the tomo setup command it will:
run "env:setup"
run "core:setup_directories"
run "git:clone"
run "git:create_release"
run "core:symlink_shared"
run "bundler:upgrade_bundler"
run "bundler:config"
run "bundler:install"
# run "rails:db_create"
run "rails:db_schema_load"
run "rails:db_seed"
run "puma:setup_systemd"
run 'sidekiq:setup_systemd'

for the tomo deploy command it will:
run "env:update"
run "git:create_release"
run "core:symlink_shared"
run "core:write_release_json"
run "bundler:install"
run 'yarn:check_files'
run "rails:db_migrate"
run "rails:assets_precompile"
run "core:symlink_current"
run "puma:restart"
run "puma:check_active"
run "core:clean_releases"
run "bundler:clean"
run "core:log_revision"
run 'sidekiq:restart'

of course we can secify our own task in these processes by adding plugin to it. eg:

plugin './plugins/yarn.rb'


def check_files
  remote.chdir(paths.release) do'yarn', 'install', '--check-files')
Enter fullscreen mode Exit fullscreen mode

then we can add run 'yarn:check_files' to our process.

This is the part that I love about tomo deploy.

git:create_release source:
Fetches the latest commits from git_branch (or git_ref) and creates a release by copying the contents of that branch of repository into a new release inside the releases_path. Releases are numbered based on the timestamp of when the deploy takes place.

git:create_release is intended for use as a deploy task.


There are tons of goodness when it comes to tomo commands. We browse all commands through tomo tasks command.

  1. To see running log on remote deploy server, we can use this command: tomo puma:tail_log

Image description

  1. To access remote server data-via-activerecord we can always use our handy rails console but to do it remotely with tomo, we can use tomo rails:console.
    Image description

  2. tomo sidekiq:log
    Image description


  1. Do not use set env_vars to update your PATH. We cannot use like export "PATH=$PATH:/our/bin" in env_vars, as it will break our path. I have break it once and I suggest other people to do it on to the remote(deploy server) shell it self.

  2. To allow message encryptor to work properly, we need to make sure:
    a. master.key content from our local machine are the same RAILS_MASTER_KEY that we enter onto the remote server via tomo setup.
    b. we add and commit+push our local credentials.yml.enc.

thank you for reading.

Discussion (0)