Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add before/after lifecycle hooks to Baremetal deploy #5297

Closed
cannikin opened this issue Apr 22, 2022 · 0 comments · Fixed by #5500
Closed

Add before/after lifecycle hooks to Baremetal deploy #5297

cannikin opened this issue Apr 22, 2022 · 0 comments · Fixed by #5500
Assignees
Labels
release:feature This PR introduces a new feature topic/deployment

Comments

@cannikin
Copy link
Member

cannikin commented Apr 22, 2022

This gives the ability to run arbitrary code before/after any of the existing steps: update, install, migrate, build, restart.

Global before/after hooks that apply to all servers in all environments:

[[servers.production]]
host = "server.com"
# ...

[before]
install = ["yarn clean"]

[after]
install = ["cp -R * backup"]

If you want some per enviroment:

[before.staging]
install = ["yarn clean"]

[before.production]
install = ["cp -R * backup"]

Or you can have some on a per-server basis:

[[servers.production]]
host = "server.com"
before.install = "yarn clean"

These configurations will stack and execute them in the following order:

  1. Global
  2. Per environment
  3. Per server

So in the most complex example:

[[servers.production]]
host = "server.com"
before.install = "echo 'server'"

[before]
install = ["echo 'global'"]

[before.production]
install = "echo 'environment'"

You would see the following output:

global
environment
server

The actual commands to be run can be a string or an array of strings if you want to run multiple commands:

[before.production]
install = ["yarn clean", "rm -rf log/*"]
@cannikin cannikin added topic/deployment release:feature This PR introduces a new feature labels Apr 22, 2022
@cannikin cannikin self-assigned this Apr 22, 2022
@jtoar jtoar added this to Release Apr 26, 2022
@jtoar jtoar moved this to Todo in Release Apr 26, 2022
@jtoar jtoar added this to Main May 5, 2022
@jtoar jtoar moved this to Backlog in Main May 5, 2022
@jtoar jtoar moved this from Backlog to Todo in Main May 8, 2022
@jtoar jtoar moved this from Todo to Backlog in Main May 8, 2022
@jtoar jtoar removed this from Release May 8, 2022
@jtoar jtoar removed this from Main May 11, 2022
@jtoar jtoar added this to Main May 11, 2022
@jtoar jtoar removed this from Main May 11, 2022
@jtoar jtoar added this to Main May 14, 2022
@jtoar jtoar removed this from Main May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature topic/deployment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant