Commit 7ca1714a authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

systemd: déclare l'unité dans "current" pour éviter les problèmes en cas de rollback.

No related merge requests found
Showing with 9 additions and 10 deletions
+9 -10
......@@ -64,22 +64,21 @@ set('worker.service.name', '{{ application }}-worker');
// Nom de l'unité systemd
set('worker.service.unit', '{{ worker.service.name }}.service');
// Chemin vers le fichier du service
set('worker.service.path', '{{ release_path }}/{{ bin_dir }}/{{ worker.service.unit }}');
// Chemin vers le fichier du service de cette release
set('worker.service.path', '{{ bin_dir }}/{{ worker.service.unit }}');
desc('Generate the worker definition');
task('worker:service:generate', "{{ worker.sudo }}/bin/cat >'{{ worker.service.path }}' <<'EOF'\n{{ worker.service.parsed }}\nEOF\n");
task('worker:service:generate', "/bin/cat >'{{ worker.service.path }}' <<'EOF'\n{{ worker.service.parsed }}\nEOF\n");
desc('Reload the worker definition');
task('worker:service:reload', function (): void {
// Désactive l'unité si elle existe déjà ; elle a peut-être été définie par une autre release
if (test('{{ worker.systemctl }} is-enabled {{ worker.service.unit }}')) {
run('{{ worker.systemctl }} disable {{ worker.service.unit }}');
if (run('{{ worker.systemctl }} is-enabled {{ worker.service.unit }}') === 'enabled') {
// Recharge toutes les unités
run('{{ worker.systemctl }} daemon-reload');
} else {
// Installe l'unité
run('{{ worker.systemctl }} enable --force {{ deploy_path }}/current/{{ worker.service.path }}');
}
// Force un rechargement de la config de systemd
run('{{ worker.systemctl }} daemon-reload');
// Active l'unité dans sa version actuelle
run('{{ worker.systemctl }} enable {{ worker.service.path }}');
});
desc('Start the worker');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment