about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-10-21 10:40:24 +0200
committerEmile <hanemile@protonmail.com>2019-10-21 10:40:24 +0200
commitdfb50bcc9bc3f883b49753d0078b5c89e2962aab (patch)
treeb09b9e79cd667d4df4fb82c782163b258cc51099
parent9d42f5e53b68129c4cf1b2ed9b3578d6177dea7b (diff)
added a simple setup bash script
-rwxr-xr-xsetup.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/setup.sh b/setup.sh
new file mode 100755
index 0000000..5aa19dc
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/bash
+
+# create a circus network containing most of the containers making interaction
+# on a network layer in between the containers possible
+docker network create circus 2> /dev/zero
+
+# create a network containing the database storing the challenges making it
+# possible that containers in the same network can interact with the database
+docker network create circus_db 2> /dev/zero
+
+# get a hostname and a ctfname from the user
+read -e -p "HOSTNAME: " -i "ctf.flexerilla.team" HOSTNAME
+read -e -p "CTFNAME: " -i "FlexCTF" CTFNAME
+
+# Write the vars to the .env file
+echo "HOSTNAME=$HOSTNAME" > .env
+echo "CTFNAME=$CTFNAME" >> .env
+
+# Grafana settings
+read -e -p "Grafana server: " -i "https://grafana.$HOSTNAME:3000" GF_SERVER_ROOT_URL
+read -e -p "Grafana admin pwd: " -i "secret" GF_SECURITY_ADMIN_PASSWORD
+
+# Write the Grafana settings into the grafana.env file
+echo "GF_SERVER_ROOT_URL=$GF_SERVER_ROOT_URL" > grafana.env
+echo "GF_SECURITY_ADMIN_PASSWORD=$GF_SECURITY_ADMIN_PASSWORD" >> grafana.env
+
+# Ask if the circus should be started
+read -p "Do you want to start the circus now? (y/n) " -n 1 -r
+echo # (optional) move to a new line
+if [[ ! $REPLY =~ ^[Yy]$  ]]
+then
+        exit 1
+fi
+# start the docker-compose
+docker-compose up -d