Skip to content

Commit

Permalink
🔨 Switch from resume to kill on duplicate tmux session
Browse files Browse the repository at this point in the history
  • Loading branch information
larsyencken committed Aug 2, 2024
1 parent 1e2933a commit 6506d91
Showing 1 changed file with 47 additions and 46 deletions.
93 changes: 47 additions & 46 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 6506d91

Please sign in to comment.