From 6506d91b502a6e719e3679f041fda38f004bf71b Mon Sep 17 00:00:00 2001 From: Lars Yencken Date: Fri, 2 Aug 2024 11:28:32 +0100 Subject: [PATCH] :hammer: Switch from resume to kill on duplicate tmux session --- Makefile | 93 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 203b25667be..1187fa35652 100644 --- a/Makefile +++ b/Makefile @@ -47,33 +47,34 @@ up: export DEBUG = 'knex:query' up: require create-if-missing.env ../owid-content tmp-downloads/owid_metadata.sql.gz node_modules @make validate.env @make check-port-3306 + + @if tmux has-session -t grapher 2>/dev/null; then \ + echo '==> Killing existing tmux session'; \ + tmux kill-session -t grapher; \ + fi + @echo '==> Building grapher' yarn lerna run build @echo '==> Starting dev environment' @mkdir -p logs - @if tmux has-session -t grapher 2>/dev/null; then \ - echo '==> Resuming existing tmux session'; \ - tmux attach-session -t grapher; \ - else \ - tmux new-session -s grapher \ - -n docker 'docker compose -f docker-compose.grapher.yml up' \; \ - set remain-on-exit on \; \ - set-option -g default-shell $(SCRIPT_SHELL) \; \ - new-window -n admin \ - 'devTools/docker/wait-for-mysql.sh && yarn startAdminDevServer' \; \ - set remain-on-exit on \; \ - new-window -n vite 'yarn run startSiteFront' \; \ - set remain-on-exit on \; \ - new-window -n lerna 'yarn startLernaWatcher' \; \ - set remain-on-exit on \; \ - new-window -n welcome 'devTools/docker/banner.sh; exec $(LOGIN_SHELL)' \; \ - bind R respawn-pane -k \; \ - bind X kill-pane \; \ - bind Q kill-server \; \ - set -g mouse on \ - || make down; \ - fi + tmux new-session -s grapher \ + -n docker 'docker compose -f docker-compose.grapher.yml up' \; \ + set remain-on-exit on \; \ + set-option -g default-shell $(SCRIPT_SHELL) \; \ + new-window -n admin \ + 'devTools/docker/wait-for-mysql.sh && yarn startAdminDevServer' \; \ + set remain-on-exit on \; \ + new-window -n vite 'yarn run startSiteFront' \; \ + set remain-on-exit on \; \ + new-window -n lerna 'yarn startLernaWatcher' \; \ + set remain-on-exit on \; \ + new-window -n welcome 'devTools/docker/banner.sh; exec $(LOGIN_SHELL)' \; \ + bind R respawn-pane -k \; \ + bind X kill-pane \; \ + bind Q kill-server \; \ + set -g mouse on \ + || make down; up.devcontainer: create-if-missing.env.devcontainer tmp-downloads/owid_metadata.sql.gz node_modules @make validate.env @@ -102,34 +103,34 @@ up.full: require create-if-missing.env.full ../owid-content tmp-downloads/owid_m @make validate.env.full @make check-port-3306 + @if tmux has-session -t grapher 2>/dev/null; then \ + echo '==> Killing existing tmux session'; \ + tmux kill-session -t grapher; \ + fi + @echo '==> Building grapher' yarn lerna run build @echo '==> Starting dev environment' - @if tmux has-session -t grapher 2>/dev/null; then \ - echo '==> Resuming existing tmux session'; \ - tmux attach-session -t grapher; \ - else \ - tmux new-session -s grapher \ - -n docker 'docker compose -f docker-compose.grapher.yml up' \; \ - set remain-on-exit on \; \ - set-option -g default-shell $(SCRIPT_SHELL) \; \ - new-window -n admin \ - 'devTools/docker/wait-for-mysql.sh && yarn startAdminDevServer' \; \ - set remain-on-exit on \; \ - new-window -n vite 'yarn run startSiteFront' \; \ - set remain-on-exit on \; \ - new-window -n lerna 'yarn startLernaWatcher' \; \ - set remain-on-exit on \; \ - new-window -n functions 'yarn startLocalCloudflareFunctions' \; \ - set remain-on-exit on \; \ - new-window -n welcome 'devTools/docker/banner.sh; exec $(LOGIN_SHELL)' \; \ - bind R respawn-pane -k \; \ - bind X kill-pane \; \ - bind Q kill-server \; \ - set -g mouse on \ - || make down; \ - fi + tmux new-session -s grapher \ + -n docker 'docker compose -f docker-compose.grapher.yml up' \; \ + set remain-on-exit on \; \ + set-option -g default-shell $(SCRIPT_SHELL) \; \ + new-window -n admin \ + 'devTools/docker/wait-for-mysql.sh && yarn startAdminDevServer' \; \ + set remain-on-exit on \; \ + new-window -n vite 'yarn run startSiteFront' \; \ + set remain-on-exit on \; \ + new-window -n lerna 'yarn startLernaWatcher' \; \ + set remain-on-exit on \; \ + new-window -n functions 'yarn startLocalCloudflareFunctions' \; \ + set remain-on-exit on \; \ + new-window -n welcome 'devTools/docker/banner.sh; exec $(LOGIN_SHELL)' \; \ + bind R respawn-pane -k \; \ + bind X kill-pane \; \ + bind Q kill-server \; \ + set -g mouse on \ + || make down; migrate: node_modules @echo '==> Running DB migrations'