Обновление настроек taiga

akrasnyh 56
parent b832e50b4b
commit 17fa3847ec

@ -0,0 +1 @@
>=dev-db/postgresql-13

@ -4,7 +4,7 @@
app-text/tree
#in#
#?in(os_linux_pkglist, CCDX, CDC, directory, CCG, games, taiga)!=#
#?in(os_linux_pkglist, CCDX, CDC, directory, CCG, games)!=#
app-admin/logrotate
app-admin/syslog-ng
app-arch/lbzip2

@ -1,4 +1,4 @@
# Calculate path=/etc/nginx/sites-enabled comment=#
# Calculate path=/etc/nginx/sites-enabled exists(/etc/nginx/sites-enabled/#-cut()-#)== comment=#
server {
listen 80 default_server;
server_name taiga.example.org;

@ -0,0 +1,6 @@
# Calculate format=samba path=/var/calculate grep(/var/calculate/ini.env,postgresql)== comment=# protected
[postgresql]
postgres_password = #-rnd(pas,12)-#
taiga_user = taiga
taiga_password = #-rnd(pas,12)-#
taiga_database = taiga

@ -0,0 +1,2 @@
# Calculate path=/root name=.pgpass chmod=600 comment=# protected
localhost:*:*:postgres:#-ini(postgresql.postgres_password)-#

@ -0,0 +1,4 @@
# Calculate format=samba path=/var/calculate grep(/var/calculate/ini.env,rabbitmq)== comment=# protected
[rabbitmq]
taiga_user = taiga
taiga_password = #-rnd(pas,12)-#

@ -1,4 +1,4 @@
# Calculate path=/var/calculate chmod=600 chown=taiga:taiga comment=# grep(/var/calculate/ini.env,taiga)== protected append=before
# Calculate format=samba path=/var/calculate chmod=600 chown=taiga:taiga comment=# grep(/var/calculate/ini.env,taiga_sites_domain)== protected
[taiga]
protocol = http
taiga_sites_domain = taiga.example.org
@ -14,6 +14,3 @@ timezone = #-os_clock_timezone-#
public_register = True
node = 12.22.12
secret_key = #-rnd(pas,16)-#
pgsql_password = #-rnd(pas,16)-#
rabbitmq_user = taiga
rabbitmq_password = #-rnd(pas,16)-#

@ -0,0 +1 @@
# Calculate path=/usr/sbin name=#-cut(1,.)-# link=/var/db/repos/container/scripts/cl-setup-taiga.sh symbolic protected

@ -1 +0,0 @@
# Calculate path=/etc/runlevels/default name=#-cut(1,.)-# link=/etc/init.d/#-cut(1,.)-# protected symbolic

@ -1,10 +0,0 @@
# Calculate path=/var/calculate/bin name=#-cut(1,.)-# chmod=755 comment=#
#!/bin/bash
set -eo pipefail
export PATH="/lib/rc/bin:$PATH"
su - taiga -c /var/calculate/bin/install-taiga
/var/calculate/bin/setup-taiga
/var/calculate/bin/setup-rabbit

@ -1,143 +0,0 @@
# Calculate path=/var/calculate/bin name=#-cut(1,.)-# chmod=755 comment=#
#!/bin/bash
set -eo pipefail
export PATH="/lib/rc/bin:$PATH"
if [[ $UID == 0 ]]
then
exec su - taiga -c /var/calculate/bin/install-taiga
fi
all=
while IFS= read -r line
do
if [[ $line == *"["* ]]
then
line=${line#*[}
line=${line%%]*}
sec=$line
continue
fi
if [[ ${line:0:1} == '#' || $line == '' ]]
then
continue
fi
com=${sec}_${line// =/=};
com=${com//= /=};
all="$com; $all"
done < /var/calculate/ini.env
eval $all
if [[ ! -e ~/.node-live ]]
then
einfo 'Установка Node.js'
cd ~
nodeenv --node=$taiga_node .node-${taiga_node%%.*}
ln -sfT .node-${taiga_node%%.*} .node-live
fi
source ~/.node-live/bin/activate
set -u
install_taiga_back(){
cd ~
einfo 'Получение кода taiga_back'
git clone https://github.com/kaleidos-ventures/taiga-back.git taiga-back
cd taiga-back
git checkout stable
einfo 'Создание виртуальной среды'
python -m venv .venv --prompt taiga-back
source .venv/bin/activate
pip install --upgrade pip wheel
einfo 'Установка всех зависимостей Python'
pip install -r requirements.txt
einfo 'Установка taiga-contrib-protected'
pip install git+https://github.com/kaleidos-ventures/taiga-contrib-protected.git@stable#egg=taiga-contrib-protected
ebegin 'Копирование фала настроек'
cp settings/config.py.prod.example settings/config.py
eend
}
install_taiga_front_dist(){
cd ~
einfo 'Получeние кода taiga_front_dist'
git clone https://github.com/kaleidos-ventures/taiga-front-dist.git taiga-front-dist
cd taiga-front-dist
git checkout stable
ebegin 'Копирование примера файла конфигурации'
cp ~/taiga-front-dist/dist/conf.example.json ~/taiga-front-dist/dist/conf.json
eend
}
install_taiga_events(){
cd ~
einfo 'Получение кода taiga_events'
git clone https://github.com/kaleidos-ventures/taiga-events.git taiga-events
cd taiga-events
git checkout stable
einfo 'Установка необходимых зависимостей JavaScript'
#source ~/.node-live/bin/activate
npm install
npm audit fix
ebegin 'Создание .env файла на основе предоставленного примера'
cp .env.example .env
eend
}
install_taiga_protected(){
cd ~
einfo 'Получение кода taiga_protected'
git clone https://github.com/kaleidos-ventures/taiga-protected.git taiga-protected
cd taiga-protected
git checkout stable
einfo 'Создание виртуальной среды'
python -m venv .venv --prompt taiga-protected
source .venv/bin/activate
pip install --upgrade pip wheel
einfo 'Установка всех зависимостей Python'
pip install -r requirements.txt
ebegin 'Копирование примера файла конфигурации'
cp ~/taiga-protected/env.sample ~/taiga-protected/.env
eend
}
migrate_pgsql(){
cd ~
cd taiga-back
source .venv/bin/activate
DJANGO_SETTINGS_MODULE=settings.config python manage.py migrate --noinput
einfo create an administrator with strong password
CELERY_ENABLED=False DJANGO_SETTINGS_MODULE=settings.config python manage.py createsuperuser
DJANGO_SETTINGS_MODULE=settings.config python manage.py loaddata initial_project_templates
DJANGO_SETTINGS_MODULE=settings.config python manage.py compilemessages
DJANGO_SETTINGS_MODULE=settings.config python manage.py collectstatic --noinput
}
#-----------------------------------------------------------------------------
# Запуск
#-----------------------------------------------------------------------------
[[ ! -e ~/taiga-back ]] && install_taiga_back
[[ ! -e ~/taiga-front-dist ]] && install_taiga_front_dist
[[ ! -e ~/taiga-events ]] && install_taiga_events
[[ ! -e ~/taiga-protected ]] && install_taiga_protected
einfo "Все установлено! Для настройки Taiga выполните 'setup-taiga'."
#migrate_pgsql

@ -1,50 +0,0 @@
# Calculate path=/var/calculate/bin name=#-cut(1,.)-# chmod=755 comment=#
#!/bin/bash
set -ueo pipefail
export PATH="/lib/rc/bin:$PATH"
all=
while IFS= read -r line
do
if [[ $line == *"["* ]]
then
line=${line#*[}
line=${line%%]*}
sec=$line
continue
fi
if [[ ${line:0:1} == '#' || $line == '' ]]
then
continue
fi
com=${sec}_${line// =/=};
com=${com//= /=};
all="$com; $all"
done < /var/calculate/ini.env
eval $all
ebegin 'Проверка выполненной базовой настройки'
if [[ ! -e /var/lib/postgresql/12 ]]
then
echo Выполните настройку 'emerge --config =dev-db/postgresql-12.12'.
exit 1
fi
eend
ebegin 'Проверка запущенного PostgreSQL'
if [[ $(ls /run/postgresql/.*lock 2>/dev/null | wc -l) == 0 ]]
then
echo Запустите PostgreSQL
exit 1
fi
eend
ebegin 'Проверка наличия роли taiga'
$(psql -U taiga -d taiga -c '\dt' 2&>/dev/null) || {
echo Пароль: $taiga_pgsql_password
createuser -U postgres -P taiga
createdb -U postgres -O taiga taiga
}
eend
cl-core-setup -n postgresql

@ -1,37 +0,0 @@
# Calculate path=/var/calculate/bin name=#-cut(1,.)-# chmod=755 comment=#
#!/bin/bash
set -ueo pipefail
export PATH="/lib/rc/bin:$PATH"
all=
while IFS= read -r line
do
if [[ $line == *"["* ]]
then
line=${line#*[}
line=${line%%]*}
sec=$line
continue
fi
if [[ ${line:0:1} == '#' || $line == '' ]]
then
continue
fi
com=${sec}_${line// =/=};
com=${com//= /=};
all="$com; $all"
done < /var/calculate/ini.env
eval $all
rabbit_configure(){
if [[ ! -e /var/lib/rabbitmq/mnesia ]]
then
/etc/init.d/rabbitmq start
rabbitmqctl add_user $taiga_rabbitmq_user $taiga_rabbitmq_password
rabbitmqctl add_vhost taiga
rabbitmqctl set_permissions -p taiga $taiga_rabbitmq_user ".*" ".*" ".*"
fi
}
rabbit_configure

@ -0,0 +1,17 @@
#!/bin/bash
set -ueo pipefail
/var/db/repos/container/scripts/taiga-postgresql.sh
/var/db/repos/container/scripts/taiga-rabbitmq.sh
su - taiga -c '/var/db/repos/container/scripts/taiga-www-install.sh'
/var/db/repos/container/scripts/taiga-www-setup.sh
su - taiga -c '/var/db/repos/container/scripts/taiga-www-migrate.sh'
rc-update add taiga
rc-update -u
openrc

@ -0,0 +1,23 @@
# Read vars from /var/calculate/ini.env
get_ini(){
all=
while IFS= read -r line
do
if [[ $line == *"["* ]]
then
line=${line#*[}
line=${line%%]*}
sec=$line
continue
fi
if [[ ${line:0:1} == '#' || $line == '' ]]
then
continue
fi
com=${sec}_${line// =/=};
com=${com//= /=};
all="$com; $all"
done < /var/calculate/ini.env
eval $all
}

@ -0,0 +1,24 @@
#!/bin/bash
set -ueo pipefail
if [[ -e /var/lib/postgresql/12 ]]
then
exit
fi
export PATH="/lib/rc/bin:$PATH"
source /var/db/repos/container/scripts/functions.sh
get_ini
emerge --config =dev-db/postgresql-12.12
/etc/init.d/postgresql-12 start
psql -U postgres -c "ALTER USER postgres WITH PASSWORD '$postgresql_postgres_password'"
psql -U postgres -c "CREATE ROLE $postgresql_taiga_user WITH login"
psql -U postgres -c "CREATE DATABASE taiga OWNER taiga"
psql -U postgres -c "ALTER USER $postgresql_taiga_user WITH PASSWORD '$postgresql_taiga_password'"
cl-core-setup -n postgresql -f
/etc/init.d/postgresql-12 restart

@ -0,0 +1,18 @@
#!/bin/bash
set -ueo pipefail
if [[ -e /var/lib/rabbitmq/mnesia ]]
then
exit
fi
export PATH="/lib/rc/bin:$PATH"
source /var/db/repos/container/scripts/functions.sh
get_ini
/etc/init.d/rabbitmq start
rabbitmqctl add_user $rabbitmq_taiga_user $rabbitmq_taiga_password
rabbitmqctl add_vhost taiga
rabbitmqctl set_permissions -p taiga $rabbitmq_taiga_user ".*" ".*" ".*"

@ -0,0 +1,109 @@
#!/bin/bash
set -eo pipefail
export PATH="/lib/rc/bin:$PATH"
if [[ $UID == 0 ]]
then
exit
fi
source /var/db/repos/container/scripts/functions.sh
get_ini
if [[ ! -e ~/.node-live ]]
then
einfo 'Install Node.js'
cd ~
nodeenv --node=$taiga_node .node-${taiga_node%%.*}
ln -sfT .node-${taiga_node%%.*} .node-live
fi
source ~/.node-live/bin/activate
set -u
install_taiga_back(){
cd ~
einfo 'Backend Setup: Get the code'
git clone https://github.com/kaleidos-ventures/taiga-back.git taiga-back
cd taiga-back
git checkout stable
einfo 'Create a virtualenv'
python -m venv .venv --prompt taiga-back
source .venv/bin/activate
pip install --upgrade pip wheel
einfo 'Install all Python dependencies'
pip install -r requirements.txt
einfo 'Install taiga-contrib-protected'
pip install git+https://github.com/kaleidos-ventures/taiga-contrib-protected.git@stable#egg=taiga-contrib-protected
ebegin 'Copy the example config file'
cp settings/config.py.prod.example settings/config.py
eend
}
install_taiga_front_dist(){
cd ~
einfo 'Frontend Setup: Get the code'
git clone https://github.com/kaleidos-ventures/taiga-front-dist.git taiga-front-dist
cd taiga-front-dist
git checkout stable
ebegin 'Copy the example config file'
cp ~/taiga-front-dist/dist/conf.example.json ~/taiga-front-dist/dist/conf.json
eend
}
install_taiga_events(){
cd ~
einfo 'Events Setup: Get the code'
git clone https://github.com/kaleidos-ventures/taiga-events.git taiga-events
cd taiga-events
git checkout stable
einfo 'Install the required JavaScript dependencies'
#source ~/.node-live/bin/activate
npm install
npm audit fix
ebegin 'Create .env file based on the provided example'
cp .env.example .env
eend
}
install_taiga_protected(){
cd ~
einfo 'Taiga protected Setup: Get the code'
git clone https://github.com/kaleidos-ventures/taiga-protected.git taiga-protected
cd taiga-protected
git checkout stable
einfo 'Create a virtualenv'
python -m venv .venv --prompt taiga-protected
source .venv/bin/activate
pip install --upgrade pip wheel
einfo 'Install all Python dependencies'
pip install -r requirements.txt
ebegin 'Copy the example config file'
cp ~/taiga-protected/env.sample ~/taiga-protected/.env
eend
}
#-----------------------------------------------------------------------------
# Запуск
#-----------------------------------------------------------------------------
[[ ! -e ~/taiga-back ]] && install_taiga_back
[[ ! -e ~/taiga-front-dist ]] && install_taiga_front_dist
[[ ! -e ~/taiga-events ]] && install_taiga_events
[[ ! -e ~/taiga-protected ]] && install_taiga_protected
exit 0

@ -0,0 +1,33 @@
#!/bin/bash
set -ueo pipefail
export PATH="/lib/rc/bin:$PATH"
source /var/db/repos/container/scripts/functions.sh
get_ini
if [[ $UID == 0 ]]
then
exit
fi
data=$(PGPASSWORD=$postgresql_taiga_password psql -U $postgresql_taiga_user -d $postgresql_taiga_database -c '\dt' 2>/dev/null)
if [[ -n $data ]]
then
exit
fi
migrate_pgsql(){
cd ~
cd taiga-back
source .venv/bin/activate
DJANGO_SETTINGS_MODULE=settings.config python manage.py migrate --noinput
einfo create an administrator with strong password
CELERY_ENABLED=False DJANGO_SETTINGS_MODULE=settings.config python manage.py createsuperuser
DJANGO_SETTINGS_MODULE=settings.config python manage.py loaddata initial_project_templates
DJANGO_SETTINGS_MODULE=settings.config python manage.py compilemessages
DJANGO_SETTINGS_MODULE=settings.config python manage.py collectstatic --noinput
}
migrate_pgsql

@ -1,12 +1,16 @@
# Calculate path=/var/calculate/bin name=#-cut(1,.)-# chmod=755 comment=#
#!/bin/bash
export PATH="/lib/rc/bin:$PATH"
set -ueo pipefail
source /var/db/repos/container/scripts/functions.sh
get_ini
regular(){
replace=(
"taiga-back/settings/config.py" ""
"('PASSWORD':).*" "\1 '${taiga_pgsql_password}',"
"('USER':).*" "\1 '${postgresql_taiga_user}',"
"('PASSWORD':).*" "\1 '${postgresql_taiga_password}',"
"^.*(SECRET_KEY =).*" "\1 \"${taiga_secret_key}\""
"^.*(TAIGA_SITES_SCHEME =).*" "\1 \"${taiga_protocol}\""
"^.*(TAIGA_SITES_DOMAIN =).*" "\1 \"${taiga_taiga_sites_domain}\""
@ -18,8 +22,8 @@ regular(){
"^.*(EMAIL_PORT =).*" "\1 ${taiga_smtp_port}"
"^.*(EMAIL_HOST_USER =).*" "\1 '${taiga_smtp_user}'"
"^.*(EMAIL_HOST_PASSWORD =).*" "\1 '${taiga_smtp_password}'"
"(\"url\": \"amqp://).*(:5672/taiga\")" "\1${taiga_rabbitmq_user}:${taiga_rabbitmq_password}@localhost\2"
"^.*(CELERY_BROKER_URL =).*" "\1 \"amqp://${taiga_rabbitmq_user}:${taiga_rabbitmq_password}@localhost:5672/taiga\""
"(\"url\": \"amqp://).*(:5672/taiga\")" "\1${rabbitmq_taiga_user}:${rabbitmq_taiga_password}@localhost\2"
"^.*(CELERY_BROKER_URL =).*" "\1 \"amqp://${rabbitmq_taiga_user}:${rabbitmq_taiga_password}@localhost:5672/taiga\""
"^.*(CELERY_TIMEZONE =).*" "\1 '${taiga_timezone}'"
"^.*(ENABLE_TELEMETRY =).*" "\1 False"
"^.*(PUBLIC_REGISTER_ENABLED =).*" "\1 ${taiga_public_register}"
@ -33,7 +37,7 @@ regular(){
"(\"gravatar\":).*" "\1 false,"
"taiga-events/.env" ""
"^.*(RABBITMQ_URL=).*" "\1\"amqp://${taiga_rabbitmq_user}:${taiga_rabbitmq_password}@localhost:5672/taiga\""
"^.*(RABBITMQ_URL=).*" "\1\"amqp://${rabbitmq_taiga_user}:${rabbitmq_taiga_password}@localhost:5672/taiga\""
"^.*(SECRET=).*" "\1\"${taiga_secret_key}\""
"taiga-protected/.env" ""
@ -55,7 +59,7 @@ check_conf(){
fi
if [[ ! -e $conf ]]
then
eerror "Не найден файл ~/taiga/$conf. Установите Taiga выполнив 'install-taiga'."
eerror "~/taiga/$conf not found."
exit 2
fi
@ -133,47 +137,22 @@ show_conf(){
done
}
read_vars(){
all=
while IFS= read -r line
do
if [[ $line == *"["* ]]
then
line=${line#*[}
line=${line%%]*}
sec=$line
continue
fi
if [[ ${line:0:1} == '#' || $line == '' ]]
then
continue
fi
com=${sec}_${line// =/=};
com=${com//= /=};
all="$com; $all"
done < /var/calculate/ini.env
eval $all
}
check_homedir(){
homedir=/var/calculate/www/taiga
if [[ -d $homedir ]]
then
cd $homedir
else
eerror "Отсутствует директория $homedir!"
eerror "Missing directory $homedir!"
exit 1
fi
}
read_vars
regular
check_homedir
ebegin 'Проверка настраиваемых переменных'
ebegin 'Checking Custom Variables'
`check_conf` || {
if [[ $? == 1 ]]
then
@ -184,14 +163,14 @@ ebegin 'Проверка настраиваемых переменных'
}
eend
einfo 'Настройка конфигурационных файлов:'
einfo 'Setting up configuration files'
configure_conf
if [[ $# == 0 ]]
then
einfo "Для отображения настроенных опций выполните '$0 show'."
einfo "To display configured options, run '$0 show'."
else
einfo 'Настроенные параметры:'
einfo 'Customized parameters:'
show_conf
fi
Loading…
Cancel
Save