#!/bin/bash
set -e

trap 'send_{{ service.name }}_status_hook $?' EXIT

{% block install_commands %}
source {{ deployer.rendered_files_path }}/deploy-{{ service.name }}-functions.sh
run_install_commands
send_{{ service.name }}_status_hook 0 "working"
{% endblock %}

{% block build_commands %}

{% if service.is_backend %}

{% if service.settings.migrate %}
migrate_{{ service.name }}
{% endif %}

{% if not service.environment.is_production and service.settings.seed %}
seed_{{ service.name }}
{% endif %}

{% endif %}

deploy_{{ service.name }}

{% endblock %}

{% block finally_build_commands %}
{% endblock %}