aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhitlerrip <git@hitler.rip>2025-08-03 13:37:05 +0200
committerhitlerrip <git@hitler.rip>2025-08-03 13:37:05 +0200
commit65701c8f82c5e160bbe3b8d511f3665e0fbdba6c (patch)
tree8b45abd6c05fd2c98c64fa131f09fcb538164329
parent906a467192418fe599857c4d78735aac99e7beed (diff)
downloadhitler-clicker-65701c8f82c5e160bbe3b8d511f3665e0fbdba6c.tar.gz
hitler-clicker-65701c8f82c5e160bbe3b8d511f3665e0fbdba6c.tar.bz2
hitler-clicker-65701c8f82c5e160bbe3b8d511f3665e0fbdba6c.zip
tmux script
added a tmux script that sets up the dev environment for me
-rw-r--r--README.md21
-rwxr-xr-xtmux.sh27
2 files changed, 31 insertions, 17 deletions
diff --git a/README.md b/README.md
index 035059c..cb0735d 100644
--- a/README.md
+++ b/README.md
@@ -14,25 +14,12 @@ There is an included testing environment. Requirements are Docker and PHP.
Docker is generally not needed, you can replace it with any other DB Server.
PHP has to have the `pdo_mysql` driver enabled.
-```sh
-# start mariadb
-cd ./backend/docker-test-env/
-docker compose up -d
-
-# start api
-cd .. #./backend/
-php -S localhost:8000
-
-# start frontend
-cd ../frontend/
-npm i
-npm run dev
-```
-
-You send requests to the API like this:
+There is an included tmux script that starts all of the required servers.
+If you have a slightly different set up or you did not install the dependencies,
+it might still be relevant to find out what is to be done.
```sh
-curl -X POST -d '{ "key": "value" }' http://localhost:8000/yourapifile.php
+./tmux.sh
```
`index.php` automatically creates the required database tables if they do not already exist, so just request that API to have everything set up for you.
diff --git a/tmux.sh b/tmux.sh
new file mode 100755
index 0000000..e31c68a
--- /dev/null
+++ b/tmux.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+if tmux has-session -t hitlerclicker 2>/dev/null; then
+ tmux attach-session -t hitlerclicker:2
+else
+
+ echo "note: there is no timeout. you may need to wait until the database container is ready."
+ sudo systemctl start docker # to not have to enter root password in srvenv window
+
+ tmux new-session -d -s hitlerclicker
+
+ tmux rename-window -t hitlerclicker:1 "srvenv"
+ tmux new-window -t hitlerclicker:2 -n "editor"
+
+ tmux split-window -v -t hitlerclicker:1
+ tmux split-window -h -t hitlerclicker:1.1
+
+ tmux send-keys -t hitlerclicker:1.1 "clear && echo '===== DB =====' && cd ./backend/docker-test-env/ && docker compose up" C-m
+ tmux send-keys -t hitlerclicker:1.2 "clear && echo '==== API ====' && cd ./backend/ && php -S localhost:8000" C-m
+ tmux send-keys -t hitlerclicker:1.3 "clear && echo '== FRONTEND ==' && cd ./frontend/hitler-clicker/ && npm run dev" C-m
+
+ tmux send-keys -t hitlerclicker:2 "clear && vim ." C-m
+
+ tmux select-window -t hitlerclicker:1
+ tmux attach-session -t hitlerclicker:1.3
+
+fi