Questions re: deployment, deployment status
jaredmoody opened this issue · comments
I'm thinking about how to improve my deployment workflow with tomo, currently it goes:
- Merge PR on github
- Locally pull
main
branch - Locally run tomo deploy
Would deploying with tomo via webhook coming from github (or some other method) be feasible somehow? I realize this is big/difficult, but just dreaming here...
Also, in the absence of auto-deploy so that deployed code is always up to date, having a tomo command that lets you know where your deployment is in relation to origin/main
would be nice. Do you think this would this be a good candidate for a PR or a plugin?
Last, perhaps enabling the Discussions section/tab on this repo would be a good place to ask questions/have discussions like this?
Thanks for Tomo! 🙏
Would deploying with tomo via webhook coming from github (or some other method) be feasible somehow?
Great question!
In my projects I use Circle CI to do this. CI will build every branch, and for the main
branch, if all tests pass, it will automatically deploy to production via tomo. The Circle CI job looks like this:
jobs:
deploy_production:
executor: ruby
steps:
- checkout
- ruby/install-deps
- run:
name: Deploy
command: |
bundle exec tomo deploy -e production -s git_ref=$CIRCLE_SHA1
This deploys the current commit that Circle CI is building on the main
branch. Theoretically there could be multiple builds happening on main
at the same time if many PRs are getting merged around the same time, so -s git_ref=$CIRCLE_SHA1
makes explicit what should be deployed.
The deploy job only runs on main
, like this:
workflows:
version: 2
commit-workflow:
jobs:
- brakeman
- rubocop
- test
- deploy_production:
filters:
branches:
only: main
requires:
- brakeman
- rubocop
- test
I imagine you could configure GitHub Actions or other CI systems to do something similar.
I needed to make sure the SSH key that Circle CI uses is installed in .ssh/authorized_keys
on the hosts tomo deploys to. In Circle CI, you can install arbitrary SSH keys into a project, so that is fairly straightforward.
in the absence of auto-deploy so that deployed code is always up to date, having a tomo command that lets you know where your deployment is in relation to origin/main would be nice. Do you think this would this be a good candidate for a PR or a plugin?
Could you elaborate a bit more on what this would do? Is it additional metadata that would get written to the .tomo_release.json
file, or some sort of output from the CLI?
perhaps enabling the Discussions section/tab on this repo
Maybe someday... I haven't used Discussions before so I am not sure how much moderation or setup will be needed for that. The Issues traffic is still pretty light. 🙂
Ah, perfect, for whatever reason I wasn't thinking about the fact that a tomo deploy could just be part of a CI run. I'll see if I can get a github action working.
Then, I don't really need the second thing, but what I wanted was CLI output - e.g. something like
> tomo status
Deployment is 2 commits behind origin/main
Maybe someday... I haven't used Discussions before so I am not sure how much moderation or setup will be needed for that. The Issues traffic is still pretty light. 🙂
Cool, just didn't want to open an "issue" for questions/discussion if that's not where you wanted them :)