From b7462e4c60ebaa603a65f6391c3172005ef51879 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Thu, 31 Aug 2023 11:49:28 +0000 Subject: [PATCH] Add new file --- install.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000000..71bc1c56ff --- /dev/null +++ b/install.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +if [ $USER != "root" ]; then + echo "This script needs sudo privileges!" + exit 1 +fi + +docker info > /dev/null +if [ $? -ne 0 ]; then + echo "Docker is not installed (or accessible in bash) on your system:" + echo "" + echo " - install docker from https://docs.docker.com/desktop/install/linux-install/" + echo " - make sure the docker executable is in \$PATH" + exit 2 +fi + +echo "Gathering environment ..." +curl -sSL -o .env https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/.env.unix.example +curl -sSL -o docker-compose.yml https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/docker-compose.prod.yml +curl -sSL -o dbrepo.conf https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/dbrepo-gateway-service/dbrepo.conf +curl -sSL -o setup-schema_local.sql https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/dbrepo-metadata-db/setup-schema_local.sql + +echo "Pulling images ..." +docker compose pull + +MAX_MAP_COUNT=$(cat /proc/sys/vm/max_map_count) +if [ "$MAX_MAP_COUNT" -lt 262144 ]; then + echo "Preparing environment ..." + echo "vm.max_map_count=262144" >> /etc/sysctl.conf + sysctl -p +fi + +echo "Starting DBRepo ..." +docker compose up -d + +if [ $? -eq 0 ]; then + echo "Successfully started. You can now inspect the logs with:" + echo "" + echo "docker compose logs -f" +fi -- GitLab