Disable rails during ruby setup
This commit is contained in:
parent
c265e3232d
commit
a0c995e318
12
ct/sure.sh
12
ct/sure.sh
@ -29,16 +29,24 @@ function update_script() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NODE_VERSION="24" setup_nodejs
|
|
||||||
|
|
||||||
if check_for_gh_release "Sure" "we-promise/sure"; then
|
if check_for_gh_release "Sure" "we-promise/sure"; then
|
||||||
msg_info "Stopping Sure"
|
msg_info "Stopping Sure"
|
||||||
$STD systemctl stop sure
|
$STD systemctl stop sure
|
||||||
msg_ok "Stopped Sure"
|
msg_ok "Stopped Sure"
|
||||||
|
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "Sure" "we-promise/sure" "tarball" "latest" "/opt/sure"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "Sure" "we-promise/sure" "tarball" "latest" "/opt/sure"
|
||||||
|
RUBY_VERSION="$(cat /opt/sure/.ruby-version)" RUBY_INSTALL_RAILS=false setup_ruby
|
||||||
|
|
||||||
msg_info "Updating Sure"
|
msg_info "Updating Sure"
|
||||||
|
cd /opt/sure
|
||||||
|
export RAILS_ENV=production
|
||||||
|
export BUNDLE_DEPLOYMENT=1
|
||||||
|
export BUNDLE_WITHOUT=development
|
||||||
|
$STD bundle install
|
||||||
|
$STD bundle exec bootsnap precompile --gemfile -j 0
|
||||||
|
$STD bundle exec bootsnap precompile -j 0 app/ lib/
|
||||||
|
export SECRET_KEY_BASE_DUMMY=1 && $STD ./bin/rails assets:precompile
|
||||||
|
unset SECRET_KEY_BASE_DUMMY
|
||||||
msg_ok "Updated Sure"
|
msg_ok "Updated Sure"
|
||||||
|
|
||||||
msg_info "Starting Sure"
|
msg_info "Starting Sure"
|
||||||
|
|||||||
@ -26,30 +26,34 @@ fetch_and_deploy_gh_release "Sure" "we-promise/sure" "tarball" "latest" "/opt/su
|
|||||||
|
|
||||||
PG_VERSION="$(sed -n '/postgres:/s/[^[:digit:]]*//p' /opt/sure/compose.example.yml)" setup_postgresql
|
PG_VERSION="$(sed -n '/postgres:/s/[^[:digit:]]*//p' /opt/sure/compose.example.yml)" setup_postgresql
|
||||||
PG_DB_NAME=sure_production PG_DB_USER=sure_user setup_postgresql_db
|
PG_DB_NAME=sure_production PG_DB_USER=sure_user setup_postgresql_db
|
||||||
RUBY_VERSION="$(cat /opt/sure/.ruby-version)" RUBY_INSTALL_RAILS=true setup_ruby
|
RUBY_VERSION="$(cat /opt/sure/.ruby-version)" RUBY_INSTALL_RAILS=false setup_ruby
|
||||||
|
|
||||||
# msg_info "Building Sure"
|
msg_info "Building Sure"
|
||||||
# cd /opt/sure
|
cd /opt/sure
|
||||||
# export RAILS_ENV=production
|
export RAILS_ENV=production
|
||||||
# export BUNDLE_DEPLOYMENT=1
|
export BUNDLE_DEPLOYMENT=1
|
||||||
# export BUNDLE_WITHOUT=development
|
export BUNDLE_WITHOUT=development
|
||||||
# $STD bundle install
|
$STD bundle install
|
||||||
# $STD bundle exec bootsnap precompile --gemfile -j 0
|
$STD bundle exec bootsnap precompile --gemfile -j 0
|
||||||
# $STD bundle exec bootsnap precompile -j 0 app/ lib/
|
$STD bundle exec bootsnap precompile -j 0 app/ lib/
|
||||||
# export SECRET_KEY_BASE_DUMMY=1 && $STD ./bin/rails assets:precompile
|
export SECRET_KEY_BASE_DUMMY=1 && $STD ./bin/rails assets:precompile
|
||||||
# msg_ok "Built Sure"
|
unset SECRET_KEY_BASE_DUMMY
|
||||||
#
|
msg_ok "Built Sure"
|
||||||
# msg_info "Configuring Sure"
|
|
||||||
# KEY="$(openssl rand -hex 64)"
|
msg_info "Configuring Sure"
|
||||||
# mkdir -p /etc/sure
|
KEY="$(openssl rand -hex 64)"
|
||||||
# mv /opt/sure/.env.example /etc/sure/.env
|
mkdir -p /etc/sure
|
||||||
# sed -i -e "/^SECRET_KEY_BASE=/s/secret-value/${KEY}/" \
|
mv /opt/sure/.env.example /etc/sure/.env
|
||||||
# -e "/POSTGRES_PASSWORD=/s/postgres/${PG_DB_PASS}/" \
|
sed -i -e "/^SECRET_KEY_BASE=/s/secret-value/${KEY}/" \
|
||||||
# -e "/POSTGRES_USER=/s/postgres/${PG_DB_USER}\\
|
-e 's/_KEY_BASE=.*$/&\n\nRAILS_FORCE_SSL=false \\
|
||||||
# POSTGRES_DB=${PG_DB_NAME}/" \
|
\\
|
||||||
# -e "s|^APP_DOMAIN=|&${LOCAL_IP}|" /etc/sure/.env
|
# Change to true when using a reverse proxy \\
|
||||||
# $STD ./bin/rails db:prepare
|
RAILS_ASSUME_SSL=false/' \
|
||||||
# msg_ok "Configured Sure"
|
-e "/POSTGRES_PASSWORD=/s/postgres/${PG_DB_PASS}/" \
|
||||||
|
-e "/POSTGRES_USER=/s/postgres/${PG_DB_USER}\\
|
||||||
|
POSTGRES_DB=${PG_DB_NAME}/" \
|
||||||
|
-e "s|^APP_DOMAIN=|&${LOCAL_IP}|" /etc/sure/.env
|
||||||
|
msg_ok "Configured Sure"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/sure.service
|
cat <<EOF >/etc/systemd/system/sure.service
|
||||||
@ -60,7 +64,10 @@ After=network.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=/opt/sure
|
WorkingDirectory=/opt/sure
|
||||||
|
Environment=RAILS_ENV=production
|
||||||
|
Environment=PATH=/root/.rbenv/shims:/root/.rbenv/bin:/usr/bin:\$PATH
|
||||||
EnvironmentFile=/etc/sure/.env
|
EnvironmentFile=/etc/sure/.env
|
||||||
|
ExecStartPre=/opt/sure/bin/rails db:prepare
|
||||||
ExecStart=/opt/sure/bin/rails server
|
ExecStart=/opt/sure/bin/rails server
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
@ -70,7 +77,7 @@ StandardError=journal
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
# $STD systemctl enable -q --now sure
|
$STD systemctl enable -q --now sure
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user