From 43983385e1fe1253f8d3df449e73511e28a5096e Mon Sep 17 00:00:00 2001 From: Yan Date: Sun, 27 Oct 2024 00:03:09 -0700 Subject: [PATCH] rename services --- ARCHITECTURE.md | 7 ++-- Dockerfile | 32 +++++++++---------- dojo/dojo | 6 ++-- ...ege.backup.service => dojo.backup.service} | 2 +- ...college.backup.timer => dojo.backup.timer} | 2 +- ...armer.service => dojo.cachewarmer.service} | 2 +- ...agepuller.timer => dojo.cachewarmer.timer} | 2 +- ...ckup.service => dojo.cloud.backup.service} | 2 +- ...d.backup.timer => dojo.cloud.backup.timer} | 2 +- ...uller.service => dojo.imagepuller.service} | 0 ...chewarmer.timer => dojo.imagepuller.timer} | 2 +- .../{dojo-init.service => dojo.init.service} | 0 .../{dojo-up.service => dojo.up.service} | 0 13 files changed, 29 insertions(+), 30 deletions(-) rename etc/systemd/system/{pwn.college.backup.service => dojo.backup.service} (76%) rename etc/systemd/system/{pwn.college.backup.timer => dojo.backup.timer} (53%) rename etc/systemd/system/{pwn.college.cachewarmer.service => dojo.cachewarmer.service} (74%) rename etc/systemd/system/{pwn.college.imagepuller.timer => dojo.cachewarmer.timer} (56%) rename etc/systemd/system/{pwn.college.cloud.backup.service => dojo.cloud.backup.service} (62%) rename etc/systemd/system/{pwn.college.cloud.backup.timer => dojo.cloud.backup.timer} (53%) rename etc/systemd/system/{pwn.college.imagepuller.service => dojo.imagepuller.service} (100%) rename etc/systemd/system/{pwn.college.cachewarmer.timer => dojo.imagepuller.timer} (56%) rename etc/systemd/system/{dojo-init.service => dojo.init.service} (100%) rename etc/systemd/system/{dojo-up.service => dojo.up.service} (100%) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 998ecd573..358aa92c0 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -174,10 +174,9 @@ TODO You might want to look at some logs while administrating or developing the dojo. The most useful logs are: -- **dojo-init:** `journalctl -b -u dojo-init` -- **dojo up:** `journalctl -b -u dojo-up` -- **ctfd:** `docker logs ctfd" -- **nginx:** `docker logs nginx-proxy" +- **dojo:** `journalctl -b -u dojo.*` +- **ctfd:** `docker logs ctfd` +- **nginx:** `docker logs nginx-proxy` All of these should be run inside the outer docker. If you are outside of the outer docker (e.g., on the host itself), you can do stuff like `docker exec dojo journalctl -b -u dojo-up`. diff --git a/Dockerfile b/Dockerfile index bc8752696..c8dd64521 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,22 +35,22 @@ RUN git clone --branch 3.6.0 https://github.com/CTFd/CTFd /opt/CTFd RUN echo 'tmpfs /run/dojofs tmpfs defaults,mode=755,shared 0 0' > /etc/fstab && \ echo '/data/homes /run/homefs none defaults,bind,nosuid 0 0' >> /etc/fstab -RUN ln -s /opt/pwn.college/etc/systemd/system/dojo-up.service /etc/systemd/system/dojo-up.service && \ - ln -s /opt/pwn.college/etc/systemd/system/dojo-init.service /etc/systemd/system/dojo-init.service && \ - ln -s /opt/pwn.college/etc/systemd/system/pwn.college.backup.service /etc/systemd/system/pwn.college.backup.service && \ - ln -s /opt/pwn.college/etc/systemd/system/pwn.college.backup.timer /etc/systemd/system/pwn.college.backup.timer && \ - ln -s /opt/pwn.college/etc/systemd/system/pwn.college.cachewarmer.service /etc/systemd/system/pwn.college.cachewarmer.service && \ - ln -s /opt/pwn.college/etc/systemd/system/pwn.college.cachewarmer.timer /etc/systemd/system/pwn.college.cachewarmer.timer && \ - ln -s /opt/pwn.college/etc/systemd/system/pwn.college.imagepuller.service /etc/systemd/system/pwn.college.imagepuller.service && \ - ln -s /opt/pwn.college/etc/systemd/system/pwn.college.imagepuller.timer /etc/systemd/system/pwn.college.imagepuller.timer && \ - ln -s /opt/pwn.college/etc/systemd/system/pwn.college.cloud.backup.service /etc/systemd/system/pwn.college.cloud.backup.service && \ - ln -s /opt/pwn.college/etc/systemd/system/pwn.college.cloud.backup.timer /etc/systemd/system/pwn.college.cloud.backup.timer && \ - ln -s /etc/systemd/system/dojo-init.service /etc/systemd/system/multi-user.target.wants/dojo-init.service && \ - ln -s /etc/systemd/system/dojo-up.service /etc/systemd/system/multi-user.target.wants/dojo-up.service && \ - ln -s /etc/systemd/system/pwn.college.backup.timer /etc/systemd/system/timers.target.wants/pwn.college.backup.timer && \ - ln -s /etc/systemd/system/pwn.college.cachewarmer.timer /etc/systemd/system/timers.target.wants/pwn.college.cachewarmer.timer && \ - ln -s /etc/systemd/system/pwn.college.imagepuller.timer /etc/systemd/system/timers.target.wants/pwn.college.imagepuller.timer && \ - ln -s /etc/systemd/system/pwn.college.cloud.backup.timer /etc/systemd/system/timers.target.wants/pwn.college.cloud.backup.timer +RUN ln -s /opt/pwn.college/etc/systemd/system/dojo.up.service /etc/systemd/system/dojo.up.service && \ + ln -s /opt/pwn.college/etc/systemd/system/dojo.init.service /etc/systemd/system/dojo.init.service && \ + ln -s /opt/pwn.college/etc/systemd/system/dojo.backup.service /etc/systemd/system/dojo.backup.service && \ + ln -s /opt/pwn.college/etc/systemd/system/dojo.backup.timer /etc/systemd/system/dojo.backup.timer && \ + ln -s /opt/pwn.college/etc/systemd/system/dojo.cachewarmer.service /etc/systemd/system/dojo.cachewarmer.service && \ + ln -s /opt/pwn.college/etc/systemd/system/dojo.cachewarmer.timer /etc/systemd/system/dojo.cachewarmer.timer && \ + ln -s /opt/pwn.college/etc/systemd/system/dojo.imagepuller.service /etc/systemd/system/dojo.imagepuller.service && \ + ln -s /opt/pwn.college/etc/systemd/system/dojo.imagepuller.timer /etc/systemd/system/dojo.imagepuller.timer && \ + ln -s /opt/pwn.college/etc/systemd/system/dojo.cloud.backup.service /etc/systemd/system/dojo.cloud.backup.service && \ + ln -s /opt/pwn.college/etc/systemd/system/dojo.cloud.backup.timer /etc/systemd/system/dojo.cloud.backup.timer && \ + ln -s /etc/systemd/system/dojo.init.service /etc/systemd/system/multi-user.target.wants/dojo.init.service && \ + ln -s /etc/systemd/system/dojo.up.service /etc/systemd/system/multi-user.target.wants/dojo.up.service && \ + ln -s /etc/systemd/system/dojo.backup.timer /etc/systemd/system/timers.target.wants/dojo.backup.timer && \ + ln -s /etc/systemd/system/dojo.cachewarmer.timer /etc/systemd/system/timers.target.wants/dojo.cachewarmer.timer && \ + ln -s /etc/systemd/system/dojo.imagepuller.timer /etc/systemd/system/timers.target.wants/dojo.imagepuller.timer && \ + ln -s /etc/systemd/system/dojo.cloud.backup.timer /etc/systemd/system/timers.target.wants/dojo.cloud.backup.timer WORKDIR /opt/pwn.college COPY . . diff --git a/dojo/dojo b/dojo/dojo index d985b6b43..e7f45207e 100755 --- a/dojo/dojo +++ b/dojo/dojo @@ -124,7 +124,7 @@ case "$ACTION" in # HELP: logs: display dojo logs "logs") - journalctl -u pwn.college -f --no-tail + journalctl -u dojo.* -f --no-tail ;; # HELP: wait: wait for the dojo to finish starting @@ -132,10 +132,10 @@ case "$ACTION" in dojo logs | while IFS= read -r line; do echo "$line" case "$line" in - *"Finished pwn.college.service - pwn.college docker compose service"*) + *"Finished dojo.up.service - dojo docker compose service"*) exit 0 ;; - *"Failed to start pwn.college.service - pwn.college docker compose service."*) + *"Failed to start dojo.up.service - dojo docker compose service."*) exit 1 ;; esac diff --git a/etc/systemd/system/pwn.college.backup.service b/etc/systemd/system/dojo.backup.service similarity index 76% rename from etc/systemd/system/pwn.college.backup.service rename to etc/systemd/system/dojo.backup.service index 4b895378c..ecd6f680d 100644 --- a/etc/systemd/system/pwn.college.backup.service +++ b/etc/systemd/system/dojo.backup.service @@ -1,5 +1,5 @@ [Unit] -Description=Create a pwn.college backup +Description=Create a dojo backup [Service] Type=simple diff --git a/etc/systemd/system/pwn.college.backup.timer b/etc/systemd/system/dojo.backup.timer similarity index 53% rename from etc/systemd/system/pwn.college.backup.timer rename to etc/systemd/system/dojo.backup.timer index 2fc6cdfbe..9d0723658 100644 --- a/etc/systemd/system/pwn.college.backup.timer +++ b/etc/systemd/system/dojo.backup.timer @@ -1,5 +1,5 @@ [Unit] -Description=Timer to run pwn.college local backup service +Description=Timer to run dojo local backup service [Timer] OnCalendar=hourly diff --git a/etc/systemd/system/pwn.college.cachewarmer.service b/etc/systemd/system/dojo.cachewarmer.service similarity index 74% rename from etc/systemd/system/pwn.college.cachewarmer.service rename to etc/systemd/system/dojo.cachewarmer.service index 266efb29a..aec18f764 100644 --- a/etc/systemd/system/pwn.college.cachewarmer.service +++ b/etc/systemd/system/dojo.cachewarmer.service @@ -1,5 +1,5 @@ [Unit] -Description=Keep the pwn.college caches warm! +Description=Keep the dojo caches warm! [Service] Type=simple diff --git a/etc/systemd/system/pwn.college.imagepuller.timer b/etc/systemd/system/dojo.cachewarmer.timer similarity index 56% rename from etc/systemd/system/pwn.college.imagepuller.timer rename to etc/systemd/system/dojo.cachewarmer.timer index 6300abbb8..711c31729 100644 --- a/etc/systemd/system/pwn.college.imagepuller.timer +++ b/etc/systemd/system/dojo.cachewarmer.timer @@ -1,5 +1,5 @@ [Unit] -Description=Timer to run pwn.college imagepuller service +Description=Timer to run dojo cachewarmer service [Timer] OnCalendar=*-*-* *:*:00 diff --git a/etc/systemd/system/pwn.college.cloud.backup.service b/etc/systemd/system/dojo.cloud.backup.service similarity index 62% rename from etc/systemd/system/pwn.college.cloud.backup.service rename to etc/systemd/system/dojo.cloud.backup.service index 91887e602..d8d3ea9c4 100644 --- a/etc/systemd/system/pwn.college.cloud.backup.service +++ b/etc/systemd/system/dojo.cloud.backup.service @@ -1,5 +1,5 @@ [Unit] -Description=Upload a pwn.college backup to cloud (at this time just an S3 bucket). +Description=Upload a dojo backup to cloud (at this time just an S3 bucket). [Service] Type=simple diff --git a/etc/systemd/system/pwn.college.cloud.backup.timer b/etc/systemd/system/dojo.cloud.backup.timer similarity index 53% rename from etc/systemd/system/pwn.college.cloud.backup.timer rename to etc/systemd/system/dojo.cloud.backup.timer index 1fb6dd8f1..1933606a6 100644 --- a/etc/systemd/system/pwn.college.cloud.backup.timer +++ b/etc/systemd/system/dojo.cloud.backup.timer @@ -1,5 +1,5 @@ [Unit] -Description=Timer to run pwn.college cloud backup service +Description=Timer to run dojo cloud backup service [Timer] OnCalendar=daily diff --git a/etc/systemd/system/pwn.college.imagepuller.service b/etc/systemd/system/dojo.imagepuller.service similarity index 100% rename from etc/systemd/system/pwn.college.imagepuller.service rename to etc/systemd/system/dojo.imagepuller.service diff --git a/etc/systemd/system/pwn.college.cachewarmer.timer b/etc/systemd/system/dojo.imagepuller.timer similarity index 56% rename from etc/systemd/system/pwn.college.cachewarmer.timer rename to etc/systemd/system/dojo.imagepuller.timer index bd785baa5..bfc7566ad 100644 --- a/etc/systemd/system/pwn.college.cachewarmer.timer +++ b/etc/systemd/system/dojo.imagepuller.timer @@ -1,5 +1,5 @@ [Unit] -Description=Timer to run pwn.college cachewarmer service +Description=Timer to run dojo imagepuller service [Timer] OnCalendar=*-*-* *:*:00 diff --git a/etc/systemd/system/dojo-init.service b/etc/systemd/system/dojo.init.service similarity index 100% rename from etc/systemd/system/dojo-init.service rename to etc/systemd/system/dojo.init.service diff --git a/etc/systemd/system/dojo-up.service b/etc/systemd/system/dojo.up.service similarity index 100% rename from etc/systemd/system/dojo-up.service rename to etc/systemd/system/dojo.up.service