Поправлена настройка почты и добавлена проверка БД

master
parent 7a8efe59ce
commit dc548b7f08

@ -6,7 +6,7 @@ node=16.18.0
git_tag=4.1.1 git_tag=4.1.1
ruby=3.0.4 ruby=3.0.4
login=owner login=owner
smtp_from_address=Mastodon <support@calculate.ru> smtp_from_address=support@calculate.ru
smtp_login= smtp_login=
smtp_password= smtp_password=
smtp_port=465 smtp_port=465

@ -27,8 +27,9 @@ replace=(
LOCAL_DOMAIN "${ini[mastodon.local_domain]}" LOCAL_DOMAIN "${ini[mastodon.local_domain]}"
DB_USER "${ini[postgresql.mastodon_user]}" DB_USER "${ini[postgresql.mastodon_user]}"
DB_PASS "${ini[postgresql.mastodon_password]}" DB_PASS "${ini[postgresql.mastodon_password]}"
SMTP_FROM_ADDRESS "${ini[mastodon.smtp_from_address]}" SMTP_FROM_ADDRESS "Mastodon <${ini[mastodon.smtp_from_address]}>"
SMTP_PORT "${ini[mastodon.smtp_port]}" SMTP_PORT "${ini[mastodon.smtp_port]}"
SMTP_SERVER "${ini[mastodon.smtp_server]}"
) )
configure_conf live/.env.production configure_conf live/.env.production

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
#set -ueo pipefail set -ueo pipefail
export PATH="/lib/rc/bin:$PATH"
SCRIPT=$(readlink -f $0) SCRIPT=$(readlink -f $0)
[[ $UID == 0 ]] && exec su - mastodon -c "$SCRIPT" [[ $UID == 0 ]] && exec su - mastodon -c "$SCRIPT"
. /var/db/repos/container/scripts/functions.sh . /var/db/repos/container/scripts/functions.sh
. /var/db/repos/calculate/scripts/ini.sh . /var/db/repos/calculate/scripts/ini.sh
@ -18,7 +18,8 @@ eval "$(rbenv init -)"
cd ~/live cd ~/live
get_variables(){ if ! [ "$(PGPASSWORD=${ini[postgresql.postgres_password]} psql -U postgres -XtAc "SELECT 1 FROM pg_database WHERE datname='${ini[postgresql.mastodon_database]}'" )" = '1' ]
then
SECRET_KEY_BASE=$(RAILS_ENV=production bundle exec rake secret) SECRET_KEY_BASE=$(RAILS_ENV=production bundle exec rake secret)
OTP_SECRET=$(RAILS_ENV=production bundle exec rake secret) OTP_SECRET=$(RAILS_ENV=production bundle exec rake secret)
vapid_array=($(RAILS_ENV=production bundle exec rake mastodon:webpush:generate_vapid_key)) vapid_array=($(RAILS_ENV=production bundle exec rake mastodon:webpush:generate_vapid_key))
@ -29,9 +30,7 @@ get_variables(){
sed -i -E "s|(OTP_SECRET=).*|\1${OTP_SECRET}|g" ~/live/.env.production sed -i -E "s|(OTP_SECRET=).*|\1${OTP_SECRET}|g" ~/live/.env.production
sed -i -E "s|(VAPID_PRIVATE_KEY=).*|\1${VAPID_PRIVATE_KEY}|g" ~/live/.env.production sed -i -E "s|(VAPID_PRIVATE_KEY=).*|\1${VAPID_PRIVATE_KEY}|g" ~/live/.env.production
sed -i -E "s|(VAPID_PUBLIC_KEY=).*|\1${VAPID_PUBLIC_KEY}|g" ~/live/.env.production sed -i -E "s|(VAPID_PUBLIC_KEY=).*|\1${VAPID_PUBLIC_KEY}|g" ~/live/.env.production
}
migrate_pgsql(){
RAILS_ENV=production bundle exec rake db:setup RAILS_ENV=production bundle exec rake db:setup
RAILS_ENV=production bundle exec rake assets:precompile RAILS_ENV=production bundle exec rake assets:precompile
RAILS_ENV=production bin/tootctl accounts create ${ini[mastodon.login]} \ RAILS_ENV=production bin/tootctl accounts create ${ini[mastodon.login]} \
@ -40,17 +39,6 @@ migrate_pgsql(){
einfo Mail: ${ini[mastodon.smtp_from_address]} einfo Mail: ${ini[mastodon.smtp_from_address]}
einfo Login: ${ini[mastodon.login]} einfo Login: ${ini[mastodon.login]}
} else
RAILS_ENV=production bundle exec rake db:migrate:status
check_migrate(){ fi
data=$(RAILS_ENV=production bundle exec rake db:migrate:status 2>/dev/null)
}
data={:-}
#if [[ -z $data ]]; then
get_variables
migrate_pgsql
#else
check_migrate
#fi

Loading…
Cancel
Save