fix update
This commit is contained in:
parent
c0ab71a1b8
commit
f681835150
@ -41,33 +41,33 @@ function update_script() {
|
|||||||
msg_ok "Backed up Data"
|
msg_ok "Backed up Data"
|
||||||
|
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "dawarich" "Freika/dawarich" "tarball" "latest" "/opt/dawarich/app"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "dawarich" "Freika/dawarich" "tarball" "latest" "/opt/dawarich/app"
|
||||||
RUBY_VERSION=$(cat /opt/dawarich/app/.ruby-version 2>/dev/null || echo "3.4.6")
|
|
||||||
RUBY_VERSION=${RUBY_VERSION} RUBY_INSTALL_RAILS="false" HOME=/home/dawarich setup_ruby
|
|
||||||
|
|
||||||
source /opt/dawarich/.env
|
RUBY_VERSION=$(cat /opt/dawarich/app/.ruby-version 2>/dev/null || echo "3.4.6")
|
||||||
export PATH="/home/dawarich/.rbenv/shims:/home/dawarich/.rbenv/bin:$PATH"
|
RUBY_VERSION=${RUBY_VERSION} RUBY_INSTALL_RAILS="false" setup_ruby
|
||||||
eval "$(/home/dawarich/.rbenv/bin/rbenv init - bash)"
|
|
||||||
cd /opt/dawarich/app
|
|
||||||
chown -R dawarich:dawarich /home/dawarich/.rbenv
|
|
||||||
chown -R dawarich:dawarich /opt/dawarich
|
|
||||||
|
|
||||||
msg_info "Running Migrations"
|
msg_info "Running Migrations"
|
||||||
cat <<'EOF' >/opt/dawarich/update_script.sh
|
cd /opt/dawarich/app
|
||||||
#!/bin/bash
|
source /root/.profile
|
||||||
source /opt/dawarich/.env
|
export PATH="/root/.rbenv/shims:/root/.rbenv/bin:$PATH"
|
||||||
export PATH="/home/dawarich/.rbenv/shims:/home/dawarich/.rbenv/bin:$PATH"
|
eval "$(/root/.rbenv/bin/rbenv init - bash)"
|
||||||
eval "$(/home/dawarich/.rbenv/bin/rbenv init - bash)"
|
|
||||||
cd /opt/dawarich/app
|
set -a && source /opt/dawarich/.env && set +a
|
||||||
bundle config set --local deployment 'true'
|
|
||||||
bundle config set --local without 'development test'
|
$STD bundle config set --local deployment 'true'
|
||||||
bundle install
|
$STD bundle config set --local without 'development test'
|
||||||
SECRET_KEY_BASE_DUMMY=1 bundle exec rake assets:precompile
|
$STD bundle install
|
||||||
bundle exec rails db:migrate
|
|
||||||
bundle exec rake data:migrate
|
if [[ -f /opt/dawarich/package.json ]]; then
|
||||||
EOF
|
cd /opt/dawarich
|
||||||
chmod +x /opt/dawarich/update_script.sh
|
$STD npm install
|
||||||
$STD sudo -u dawarich bash /opt/dawarich/update_script.sh
|
cd /opt/dawarich/app
|
||||||
rm -f /opt/dawarich/update_script.sh
|
elif [[ -f /opt/dawarich/app/package.json ]]; then
|
||||||
|
$STD npm install
|
||||||
|
fi
|
||||||
|
|
||||||
|
$STD bundle exec rake assets:precompile
|
||||||
|
$STD bundle exec rails db:migrate
|
||||||
|
$STD bundle exec rake data:migrate
|
||||||
msg_ok "Ran Migrations"
|
msg_ok "Ran Migrations"
|
||||||
|
|
||||||
msg_info "Restoring Data"
|
msg_info "Restoring Data"
|
||||||
@ -75,13 +75,12 @@ EOF
|
|||||||
cp /opt/dawarich_master.key /opt/dawarich/app/config/master.key 2>/dev/null || true
|
cp /opt/dawarich_master.key /opt/dawarich/app/config/master.key 2>/dev/null || true
|
||||||
cp /opt/dawarich_credentials.yml.enc /opt/dawarich/app/config/credentials.yml.enc 2>/dev/null || true
|
cp /opt/dawarich_credentials.yml.enc /opt/dawarich/app/config/credentials.yml.enc 2>/dev/null || true
|
||||||
rm -rf /opt/dawarich_storage_backup /opt/dawarich_master.key /opt/dawarich_credentials.yml.enc
|
rm -rf /opt/dawarich_storage_backup /opt/dawarich_master.key /opt/dawarich_credentials.yml.enc
|
||||||
chown -R dawarich:dawarich /opt/dawarich
|
|
||||||
msg_ok "Restored Data"
|
msg_ok "Restored Data"
|
||||||
|
|
||||||
msg_info "Starting Services"
|
msg_info "Starting Services"
|
||||||
systemctl start dawarich-web dawarich-worker
|
systemctl start dawarich-web dawarich-worker
|
||||||
msg_ok "Started Services"
|
msg_ok "Started Services"
|
||||||
msg_ok "Updated Successfully!"
|
msg_ok "Updated successfully!"
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user