Skip to content

CLI deploy

Naomichi Yamakita edited this page Jan 4, 2023 · 19 revisions

In order to deploy an application, you need to create a proper deployment configuration file in advance.

Update service

# Help
$ docker-compose run --rm rails thor genova:deploy help service

# Execution
$ docker-compose run --rm rails thor genova:deploy service -r {repository} -c {cluster} -s {service}

# Execution example
$ docker-compose run --rm rails thor genova:deploy service -r api -c production-app -s backend

Update scheduled task

# Help
$ docker-compose run --rm rails thor genova:deploy help scheduled-task

# Execution
$ docker-compose run --rm rails thor genova:deploy scheduled-task -r {repository} -c {cluster} --scheduled_task_rule={scheduled_task_rule} --scheduled_task_target={scheduled_task_target}

$ Execution example
$ docker-compose run --rm rails thor genova:deploy scheduled-task -r api -c production-app --scheduled_task_rule=sitemap_refresh --scheduled_task_target=production

Execute the Run task

# Help
$ docker-compose run --rm rails thor genova:deploy help run-task

# Execution
$ docker-compose run --rm rails thor genova:deploy run-task -r {repository} -c {cluster} --run-task {run task}

# Execution example
$ docker-compose run --rm rails thor genova:deploy run-task -r api -c production-app --run-task greeting
$ docker-compose run --rm rails thor genova:deploy run-task -r api -c production-app --run-task greeting --override-container rails --override-command db:migrate

Tips

Force deploy

genova clones the repository locally, then checks out the branch to be deployed and builds the Docker file. The process from repository clone to build is transaction-managed and automatically locked if a separate deploy request for the same repository is executed (the lock wait time defaults to 1,200 seconds and can be changed via config/settings.local.yml).

In some situations, you may want to deploy the same image to multiple clusters or services. In such cases, you can add --force (or -f) to the deploy command to disable transactions and allow parallel builds, thus improving performance.

# Example
$ docker-compose run --rm rails thor genova:deploy service -r api -c production-app -s backend --force

Note, however, that genova creates only one local repository per repository, so deploying different branches in parallel to the same repository may cause unexpected behavior.

Clone this wiki locally