From 346ec62e6c66c778e24d1052470878a818dd2f44 Mon Sep 17 00:00:00 2001 From: Alexander Tratsevskiy Date: Tue, 28 Mar 2023 08:50:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D1=81=D0=BA=D0=BE=D1=80=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B0?= =?UTF-8?q?=20taiga?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- profiles/templates/taiga/postgresql/0-get_ver | 5 +++++ .../taiga/postgresql/etc-12/.calculate_directory | 1 - .../taiga/postgresql/etc/.calculate_directory | 1 + .../taiga/postgresql/{etc-12 => etc}/pg_hba.conf | 0 .../taiga/postgresql/{etc-12 => etc}/pg_ident.conf | 0 .../postgresql/{etc-12 => etc}/postgresql.conf | 0 scripts/taiga/setup.sh | 14 ++++++++------ scripts/taiga/{install.sh => step/1-install.sh} | 11 ++++++----- .../taiga/{postgresql.sh => step/2-postgresql.sh} | 0 scripts/taiga/{rabbitmq.sh => step/3-rabbitmq.sh} | 0 scripts/taiga/{config.sh => step/4-config.sh} | 0 scripts/taiga/{migrate.sh => step/5-migrate.sh} | 4 ++-- 12 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 profiles/templates/taiga/postgresql/0-get_ver delete mode 100644 profiles/templates/taiga/postgresql/etc-12/.calculate_directory create mode 100644 profiles/templates/taiga/postgresql/etc/.calculate_directory rename profiles/templates/taiga/postgresql/{etc-12 => etc}/pg_hba.conf (100%) rename profiles/templates/taiga/postgresql/{etc-12 => etc}/pg_ident.conf (100%) rename profiles/templates/taiga/postgresql/{etc-12 => etc}/postgresql.conf (100%) rename scripts/taiga/{install.sh => step/1-install.sh} (79%) rename scripts/taiga/{postgresql.sh => step/2-postgresql.sh} (100%) rename scripts/taiga/{rabbitmq.sh => step/3-rabbitmq.sh} (100%) rename scripts/taiga/{config.sh => step/4-config.sh} (100%) rename scripts/taiga/{migrate.sh => step/5-migrate.sh} (92%) diff --git a/profiles/templates/taiga/postgresql/0-get_ver b/profiles/templates/taiga/postgresql/0-get_ver new file mode 100644 index 0000000..520431b --- /dev/null +++ b/profiles/templates/taiga/postgresql/0-get_ver @@ -0,0 +1,5 @@ +# Calculate run=/bin/bash + +ver=$(ls -d /var/db/pkg/dev-db/postgresql-*) +ver=${ver#*postgresql-} +echo ${ver%%.*} > /tmp/pgsqlver diff --git a/profiles/templates/taiga/postgresql/etc-12/.calculate_directory b/profiles/templates/taiga/postgresql/etc-12/.calculate_directory deleted file mode 100644 index 3b430ca..0000000 --- a/profiles/templates/taiga/postgresql/etc-12/.calculate_directory +++ /dev/null @@ -1 +0,0 @@ -# Calculate path=/etc name=postgresql-#-cut(1)-# diff --git a/profiles/templates/taiga/postgresql/etc/.calculate_directory b/profiles/templates/taiga/postgresql/etc/.calculate_directory new file mode 100644 index 0000000..f733fc4 --- /dev/null +++ b/profiles/templates/taiga/postgresql/etc/.calculate_directory @@ -0,0 +1 @@ +# Calculate path=/etc name=postgresql-#-load(char,/tmp/pgsqlver)-# diff --git a/profiles/templates/taiga/postgresql/etc-12/pg_hba.conf b/profiles/templates/taiga/postgresql/etc/pg_hba.conf similarity index 100% rename from profiles/templates/taiga/postgresql/etc-12/pg_hba.conf rename to profiles/templates/taiga/postgresql/etc/pg_hba.conf diff --git a/profiles/templates/taiga/postgresql/etc-12/pg_ident.conf b/profiles/templates/taiga/postgresql/etc/pg_ident.conf similarity index 100% rename from profiles/templates/taiga/postgresql/etc-12/pg_ident.conf rename to profiles/templates/taiga/postgresql/etc/pg_ident.conf diff --git a/profiles/templates/taiga/postgresql/etc-12/postgresql.conf b/profiles/templates/taiga/postgresql/etc/postgresql.conf similarity index 100% rename from profiles/templates/taiga/postgresql/etc-12/postgresql.conf rename to profiles/templates/taiga/postgresql/etc/postgresql.conf diff --git a/scripts/taiga/setup.sh b/scripts/taiga/setup.sh index df3db31..6ca46dc 100755 --- a/scripts/taiga/setup.sh +++ b/scripts/taiga/setup.sh @@ -1,22 +1,24 @@ #!/bin/bash -# Install Taiga in Production +# README: Install Taiga in Production # https://docs.taiga.io/setup-production.html#_introduction set -ueo pipefail export PATH="/lib/rc/bin:$PATH" +scriptpath=$(dirname $(readlink -f $0)) + . /var/db/repos/calculate/scripts/ini.sh echo "Taiga setup" chown taiga: /var/calculate/ini.env -su - taiga -c '/var/db/repos/container/scripts/taiga/install.sh' -/var/db/repos/container/scripts/taiga/postgresql.sh -/var/db/repos/container/scripts/taiga/rabbitmq.sh -/var/db/repos/container/scripts/taiga/config.sh -su - taiga -c '/var/db/repos/container/scripts/taiga/migrate.sh' + +for script in $scriptpath/step/*.sh; do + "$script" +done if [[ ! -e /etc/runlevels/default/taiga ]]; then cl-setup-system rc-update -u fi openrc + echo -e "\nAll is done! Open the link ${ini[taiga.protocol]}://${ini[taiga.taiga_sites_domain]} on your browser." diff --git a/scripts/taiga/install.sh b/scripts/taiga/step/1-install.sh similarity index 79% rename from scripts/taiga/install.sh rename to scripts/taiga/step/1-install.sh index 0ed37eb..288db9c 100755 --- a/scripts/taiga/install.sh +++ b/scripts/taiga/step/1-install.sh @@ -3,7 +3,8 @@ set -ueo pipefail export PATH="/lib/rc/bin:$PATH" -[[ $UID == 0 ]] && exit +SCRIPT=$(readlink -f $0) +[[ $UID == 0 ]] && exec su - taiga -c "$SCRIPT" . /var/db/repos/container/scripts/functions.sh . /var/db/repos/calculate/scripts/ini.sh @@ -22,7 +23,7 @@ set -u if [[ ! -e ~/taiga-back ]]; then cd ~ einfo 'Backend Setup: Get the code' - git clone https://github.com/kaleidos-ventures/taiga-back.git taiga-back + git clone --branch stable --depth 1 https://github.com/kaleidos-ventures/taiga-back.git taiga-back cd taiga-back git checkout stable @@ -45,7 +46,7 @@ fi if [[ ! -e ~/taiga-front-dist ]]; then cd ~ einfo 'Frontend Setup: Get the code' - git clone https://github.com/kaleidos-ventures/taiga-front-dist.git taiga-front-dist + git clone --branch stable --depth 1 https://github.com/kaleidos-ventures/taiga-front-dist.git taiga-front-dist cd taiga-front-dist git checkout stable @@ -57,7 +58,7 @@ fi if [[ ! -e ~/taiga-events ]]; then cd ~ einfo 'Events Setup: Get the code' - git clone https://github.com/kaleidos-ventures/taiga-events.git taiga-events + git clone --branch stable --depth 1 https://github.com/kaleidos-ventures/taiga-events.git taiga-events cd taiga-events git checkout stable @@ -74,7 +75,7 @@ fi if [[ ! -e ~/taiga-protected ]]; then cd ~ einfo 'Taiga protected Setup: Get the code' - git clone https://github.com/kaleidos-ventures/taiga-protected.git taiga-protected + git clone --branch stable --depth 1 https://github.com/kaleidos-ventures/taiga-protected.git taiga-protected cd taiga-protected git checkout stable diff --git a/scripts/taiga/postgresql.sh b/scripts/taiga/step/2-postgresql.sh similarity index 100% rename from scripts/taiga/postgresql.sh rename to scripts/taiga/step/2-postgresql.sh diff --git a/scripts/taiga/rabbitmq.sh b/scripts/taiga/step/3-rabbitmq.sh similarity index 100% rename from scripts/taiga/rabbitmq.sh rename to scripts/taiga/step/3-rabbitmq.sh diff --git a/scripts/taiga/config.sh b/scripts/taiga/step/4-config.sh similarity index 100% rename from scripts/taiga/config.sh rename to scripts/taiga/step/4-config.sh diff --git a/scripts/taiga/migrate.sh b/scripts/taiga/step/5-migrate.sh similarity index 92% rename from scripts/taiga/migrate.sh rename to scripts/taiga/step/5-migrate.sh index 34abb4d..e4f98d5 100755 --- a/scripts/taiga/migrate.sh +++ b/scripts/taiga/step/5-migrate.sh @@ -2,12 +2,12 @@ set -ueo pipefail export PATH="/lib/rc/bin:$PATH" +SCRIPT=$(readlink -f $0) +[[ $UID == 0 ]] && exec su - taiga -c "$SCRIPT" . /var/db/repos/container/scripts/functions.sh . /var/db/repos/calculate/scripts/ini.sh -[[ $UID == 0 ]] && exit - data=$(PGPASSWORD=${ini[postgresql.taiga_password]} psql -U ${ini[postgresql.taiga_user]} -d ${ini[postgresql.taiga_database]} -c '\dt' 2>/dev/null) if [[ -z $data ]]; then