A common task is to run database migrations with newer code before deploying the code. This is easily achieved with the
ufo task command. Here’s an example:
ufo task hi-web --command bundle exec rake db:migrate
It nice to wrap the commands in a wrapper script in case you have to do things like the load the environment.
ufo task hi-web --command bin/migrate
bin/migrate script can look like this:
#!/bin/bash bundle exec rake db:migrate
ufo task command is generalized so you can run any one-off task. It is not just limited to running migrations. The
ufo task command performs the following:
- Builds the docker image and pushes it to a registry
- Registers the ECS Task definition
- Runs a one-off ECS Task
Pro tip: Use the <- and -> arrow keys to move back and forward.