diff --git a/tools/README.md b/tools/README.md index 455bf8d..dc4e210 100644 --- a/tools/README.md +++ b/tools/README.md @@ -2,4 +2,9 @@ > Do **NOT** run these tools in this directory. > Run them from the *main* directory. -Tools used for the IXVD infra \ No newline at end of file +Tools used for the IXVD infra + +Prefix legend: +- `server-*`, these tools will modify only the current server. +- `repo/*`, these tools will modify the repo. +- `setup/*`, setup scripts \ No newline at end of file diff --git a/tools/repo/setup-server-folder.sh b/tools/repo/setup-server-folder.sh new file mode 100644 index 0000000..69b0bcb --- /dev/null +++ b/tools/repo/setup-server-folder.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cp -r servers/skel/. servers/${1:-$(hostname)} \ No newline at end of file diff --git a/tools/server-docker-compose.sh b/tools/server-docker-compose.sh new file mode 100644 index 0000000..97911b3 --- /dev/null +++ b/tools/server-docker-compose.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# manage docker-compose with this macro + +if ! [ -d "servers/$(hostname)" ]; then + echo "couldn't find servers/$(hostname)" + exit 1 +fi + +dc_args="-p $(hostname)" +for f in servers/$(hostname)/docker-compose.d/*.yml; do + dc_args="$dc_args -f $f" +done + +docker-compose $dc_args $@ \ No newline at end of file diff --git a/tools/remove-skel.sh b/tools/server-remove-skel.sh similarity index 100% rename from tools/remove-skel.sh rename to tools/server-remove-skel.sh diff --git a/tools/setup-server.sh b/tools/server-setup.sh similarity index 100% rename from tools/setup-server.sh rename to tools/server-setup.sh diff --git a/tools/update-server.sh b/tools/server-update.sh similarity index 100% rename from tools/update-server.sh rename to tools/server-update.sh diff --git a/tools/setup/05-install-packages.sh b/tools/setup/05-install-packages.sh index e33d592..1f8885a 100644 --- a/tools/setup/05-install-packages.sh +++ b/tools/setup/05-install-packages.sh @@ -2,8 +2,10 @@ if grep -q "debian" /etc/os-release; then echo "installing packages..." - apt update - apt install \ + apt update -y + apt install -y \ cifs-utils \ - restic + restic \ + docker.io \ + docker-compose fi \ No newline at end of file diff --git a/tools/setup/40-docker.sh b/tools/setup/40-docker.sh new file mode 100644 index 0000000..d78bb7c --- /dev/null +++ b/tools/setup/40-docker.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if ! docker network inspect proxy &> /dev/null; then + echo "creating proxy network..." + docker network create proxy +fi + +if ! docker network inspect internal &> /dev/null; then + echo "creating internal network..." + docker network create internal +fi \ No newline at end of file