Refactor Investbrain installation and update script to use fetch_and_deploy_gh_release function
This commit is contained in:
parent
13e30787a2
commit
8c5b7b4ade
@ -31,7 +31,7 @@ function update_script() {
|
||||
|
||||
PG_VERSION="17" setup_postgresql
|
||||
|
||||
if check_for_gh_release "investbrain" "investbrainapp/investbrain"; then
|
||||
if check_for_gh_release "Investbrain" "investbrainapp/investbrain"; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop nginx
|
||||
systemctl stop php8.4-fpm
|
||||
@ -45,11 +45,10 @@ function update_script() {
|
||||
cp -r /opt/investbrain/storage /opt/storage.backup
|
||||
msg_ok "Created Backup"
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/investbrainapp/investbrain/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
msg_info "Updating Investbrain to $RELEASE"
|
||||
msg_info "Updating Investbrain"
|
||||
rm -rf /opt/investbrain-new
|
||||
mkdir -p /opt/investbrain-new
|
||||
curl -fsSL "https://github.com/investbrainapp/investbrain/archive/refs/tags/v${RELEASE}.tar.gz" | tar -xz --strip-components=1 -C /opt/investbrain-new
|
||||
fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain-new"
|
||||
|
||||
cd /opt/investbrain
|
||||
cp -r /opt/investbrain-new/* /opt/investbrain/
|
||||
@ -89,7 +88,6 @@ function update_script() {
|
||||
|
||||
chown -R www-data:www-data /opt/investbrain
|
||||
chmod -R 755 /opt/investbrain/storage /opt/investbrain/bootstrap/cache
|
||||
echo "${RELEASE}" >/root/.investbrain
|
||||
|
||||
rm -rf /opt/.env.backup /opt/storage.backup
|
||||
msg_ok "Updated Investbrain"
|
||||
|
||||
@ -33,11 +33,9 @@ NODE_VERSION="22" setup_nodejs
|
||||
PG_VERSION="17" setup_postgresql
|
||||
PG_DB_NAME="investbrain" PG_DB_USER="investbrain" setup_postgresql_db
|
||||
|
||||
msg_info "Setting up Investbrain"
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/investbrainapp/investbrain/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
msg_info "Installing Investbrain"
|
||||
mkdir -p /opt/investbrain
|
||||
cd /opt/investbrain
|
||||
curl -fsSL "https://github.com/investbrainapp/investbrain/archive/refs/tags/v${RELEASE}.tar.gz" | tar -xz --strip-components=1
|
||||
fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain"
|
||||
LOCAL_IP=$(hostname -I | awk '{print $1}')
|
||||
APP_KEY=$(openssl rand -base64 32)
|
||||
|
||||
@ -126,7 +124,6 @@ $STD php artisan event:clear
|
||||
$STD php artisan route:cache
|
||||
chown -R www-data:www-data /opt/investbrain
|
||||
chmod -R 755 /opt/investbrain/bootstrap/cache
|
||||
echo "${RELEASE}" >/opt/investbrain_version.txt
|
||||
msg_ok "Cleared and Cached"
|
||||
|
||||
msg_info "Configuring Nginx"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user