maybe: fixes

This commit is contained in:
vhsdream 2025-06-08 23:04:39 -04:00
parent 6667e12f05
commit 7cedb9be98
2 changed files with 10 additions and 7 deletions

View File

@ -36,7 +36,8 @@ function update_script() {
msg_ok "Stopped $APP" msg_ok "Stopped $APP"
msg_info "Creating Backup" msg_info "Creating Backup"
cp /opt/maybe/.env /opt/maybe.env BACKUP_FILE="/opt/maybe_backup_$(date +%F).tar.gz"
$STD tar -czf "$BACKUP_FILE" /opt/maybe/{.env,storage/} &>/dev/null
msg_ok "Backup Created" msg_ok "Backup Created"
msg_info "Updating $APP to v${RELEASE}" msg_info "Updating $APP to v${RELEASE}"
@ -45,8 +46,9 @@ function update_script() {
unzip -q /tmp/v"$RELEASE".zip unzip -q /tmp/v"$RELEASE".zip
mv maybe-"$RELEASE" /opt/maybe mv maybe-"$RELEASE" /opt/maybe
cd /opt/maybe cd /opt/maybe
r, ./config/credentials.yml.enc rm ./config/credentials.yml.enc
source ~/.profile source ~/.profile
$STD tar -xf "$BACKUP_FILE" --directory=/
$STD ./bin/bundle install $STD ./bin/bundle install
$STD ./bin/bundle exec bootsnap precompile --gemfile -j 0 $STD ./bin/bundle exec bootsnap precompile --gemfile -j 0
$STD ./bin/bundle exec bootsnap precompile -j 0 app/ lib/ $STD ./bin/bundle exec bootsnap precompile -j 0 app/ lib/
@ -61,6 +63,7 @@ function update_script() {
msg_info "Cleaning Up" msg_info "Cleaning Up"
rm /tmp/v"$RELEASE".zip rm /tmp/v"$RELEASE".zip
rm -f "$BACKUP_FILE"
msg_ok "Cleanup Completed" msg_ok "Cleanup Completed"
echo "${RELEASE}" >/opt/maybe_version.txt echo "${RELEASE}" >/opt/maybe_version.txt

View File

@ -57,7 +57,8 @@ unzip -q /tmp/v"$RELEASE".zip
mv maybe-"$RELEASE" /opt/maybe mv maybe-"$RELEASE" /opt/maybe
cd /opt/maybe cd /opt/maybe
cp ./.env.example ./.env cp ./.env.example ./.env
sed -i -e "s/secret-value/\"$(openssl rand -hex 64)\"/" \ sed -i -e '/SELF_/a RAILS_ENV=production' \
-e "s/secret-value/\"$(openssl rand -hex 64)\"/" \
-e "/^SECRET_KEY/a RAILS_MASTER_KEY=\"$(openssl rand -hex 16)\"" \ -e "/^SECRET_KEY/a RAILS_MASTER_KEY=\"$(openssl rand -hex 16)\"" \
-e "s/_USER=postgres/_USER=${DB_USER}/" \ -e "s/_USER=postgres/_USER=${DB_USER}/" \
-e "s/_PASSWORD=postgres/_PASSWORD=${DB_PASS}/" \ -e "s/_PASSWORD=postgres/_PASSWORD=${DB_PASS}/" \
@ -66,7 +67,7 @@ sed -i -e "s/secret-value/\"$(openssl rand -hex 64)\"/" \
./.env ./.env
sed -i -e '/_DB=/a\ sed -i -e '/_DB=/a\
\ \
REDIS_URL=http://127.0.0.1:6379' \ REDIS_URL=redis://localhost:6379/1' \
-e '/_SSL/a\ -e '/_SSL/a\
RAILS_FORCE_SSL=false\ RAILS_FORCE_SSL=false\
RAILS_ASSUME_SSL=false' \ RAILS_ASSUME_SSL=false' \
@ -92,7 +93,7 @@ After=network.target redis.service postgresql.service
Type=simple Type=simple
WorkingDirectory=/opt/maybe WorkingDirectory=/opt/maybe
ExecStart=/root/.rbenv/shims/dotenv -f /opt/maybe/.env /opt/maybe/bin/rails s ExecStart=/root/.rbenv/shims/dotenv -f /opt/maybe/.env /opt/maybe/bin/rails s
Restart=unless-stopped Restart=on-abnormal
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@ -106,8 +107,7 @@ After=redis.service
[Service] [Service]
Type=simple Type=simple
WorkingDirectory=/opt/maybe WorkingDirectory=/opt/maybe
EnvironmentFile=/opt/maybe/.env ExecStart=/root/.rbenv/shims/dotenv -f /opt/maybe/.env /opt/maybe/bundle exec sidekiq
ExecStart=bundle exec sidekiq
Restart=unless-stopped Restart=unless-stopped
[Install] [Install]