Created
March 19, 2021 16:12
-
-
Save azjgard/0e5773919cc52059a95ce9beda704612 to your computer and use it in GitHub Desktop.
Tmux setup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################### | |
# Starts all project processes in individual tmux # | |
# windows; only useful for tmux users ;) # | |
################################################### | |
docker-compose up -d | |
./node_modules/.bin/wait-on http-get://localhost:8080 | |
SESSION="$USER"-hats | |
SPLIT=${SPLIT:-h} | |
tmux -2 new-session -d -s "$SESSION" | |
# Start React apps | |
tmux new-window -t "$SESSION":1 -n "React apps" | |
if [ -n "$E2E" ]; then | |
REACT_ENV="REACT_APP_GRAPHQL_URL=https://hasura.happymonday-local.com/v1/graphql REACT_APP_JOB_BOARD_URL=https://jobs.happymonday-local.com REACT_APP_JOB_BOARD_API_URL=https://api-jobs.happymonday-local.com" | |
fi | |
tmux split-window -"$SPLIT" | |
tmux select-pane -t 0 | |
tmux send-keys "$REACT_ENV npm run start:my-hm" C-m | |
tmux select-pane -t 1 | |
tmux send-keys "$REACT_ENV npm run start:job-board" C-m | |
tmux new-window -t "$SESSION":2 -n "Shared" | |
tmux send-keys "npm run start:shared" C-m | |
# Start serverless | |
tmux new-window -t "$SESSION":3 -n "Serverless" | |
SLS_ENV="JOB_BOARD_URL=http://localhost:4000 JOB_BOARD_API_URL=http://localhost:4001" | |
tmux send-keys "$SLS_ENV JOB_BOARD_DOMAIN=$JOB_BOARD_DOMAIN npm run start:job-board:serverless" C-m | |
# Start Dockerized services | |
tmux new-window -t "$SESSION":4 -n "Dockerized services" | |
tmux split-window -"$SPLIT" | |
tmux select-pane -t 0 | |
tmux send-keys "docker-compose logs --follow hasura" C-m | |
tmux select-pane -t 1 | |
tmux send-keys "docker-compose logs --follow event-handlers" C-m | |
tmux new-window -t "$SESSION":5 -n "Hasura console" | |
tmux send-keys "npm run hasura:console" C-m | |
tmux select-window -t 0 | |
tmux -2 attach-session -t "$SESSION" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment