1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/glitchsoc_ynh.git synced 2024-09-03 19:15:59 +02:00

[fix] rbenv init + start service

This commit is contained in:
magikcypress 2017-04-13 01:38:09 +02:00
parent c5757ed06b
commit 9599028041
2 changed files with 17 additions and 40 deletions

View file

@ -101,13 +101,12 @@ popd
# sudo chown -R $app: "${final_path}" # sudo chown -R $app: "${final_path}"
# Install de rbenv # Install de rbenv
# Tips: rbenv init - bash (see: https://github.com/rbenv/rbenv/issues/925)
sudo su - $app <<COMMANDS sudo su - $app <<COMMANDS
pushd ~/.rbenv pushd ~/.rbenv
src/configure && make -C src src/configure && make -C src
echo 'export PATH="/opt/mastodon/.rbenv/bin:/opt/mastodon/live/bin:$PATH"' >> ~/.profile echo 'export PATH="/opt/mastodon/.rbenv/bin:/opt/mastodon/live/bin:$PATH"' >> ~/.profile
echo 'export PATH="/opt/mastodon/.rbenv/bin:/opt/mastodon/live/bin:$PATH"' >> ~/.bashrc echo 'export PATH="/opt/mastodon/.rbenv/bin:/opt/mastodon/live/bin:$PATH"' >> ~/.bashrc
echo 'eval "\$(rbenv init - bash)"' >> ~/.bashrc echo 'eval "\$(rbenv init -)"' >> ~/.profile
COMMANDS COMMANDS
# Install ruby-build # Install ruby-build
@ -127,19 +126,6 @@ bin/bundle install --deployment --without development test
yarn install --production yarn install --production
MCOMMANDS MCOMMANDS
# Vérif Mastodon
sudo su - $app <<VCOMMANDS
pushd ~
type rbenv
VCOMMANDS
# Vérif Mastodon
sudo su - $app <<VVCOMMANDS
pushd ~
rbenv init - bash
type rbenv
VVCOMMANDS
# Adjust Mastodon config # Adjust Mastodon config
pushd $final_path/live/ pushd $final_path/live/
sudo cp -a .env.production.sample .env.production sudo cp -a .env.production.sample .env.production
@ -156,6 +142,7 @@ sudo sed -i "s@OTP_SECRET=@OTP_SECRET=$(head -n32 /dev/urandom | tr -dc -d 'A-Za
sudo sed -i "s@SMTP_SERVER=smtp.mailgun.org@SMTP_SERVER=localhost@g" "${final_path}/live/.env.production" sudo sed -i "s@SMTP_SERVER=smtp.mailgun.org@SMTP_SERVER=localhost@g" "${final_path}/live/.env.production"
sudo sed -i 's,SMTP_FROM_ADDRESS=notifications@example.com,SMTP_FROM_ADDRESS='${admin_mastodon}'@'${domain}',' "${final_path}/live/.env.production" sudo sed -i 's,SMTP_FROM_ADDRESS=notifications@example.com,SMTP_FROM_ADDRESS='${admin_mastodon}'@'${domain}',' "${final_path}/live/.env.production"
sudo sed -i "s@#SMTP_OPENSSL_VERIFY_MODE=peer@SMTP_OPENSSL_VERIFY_MODE=none@g" "${final_path}/live/.env.production"
# Create database # Create database
# Preconfig CSS & JS # Preconfig CSS & JS
@ -175,8 +162,16 @@ pushd ~/live
# RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon@$domain # RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon@$domain
ACOMMANDS ACOMMANDS
# init rbenv & create bundle
# Tips: rbenv init bash (see: https://github.com/rbenv/rbenv/issues/925)
sudo su - $app <<BCOMMANDS
. ~/.profile
type rbenv
ls -alh /opt/mastodon/.rbenv/shims/bundle || true
BCOMMANDS
# Add Services # Add Services
#pushd /var/cache/yunohost/from_file/mastodon_ynh-master/scripts
pushd $(popd) pushd $(popd)
sudo cp ../conf/mastodon-web.service /etc/systemd/system/mastodon-web.service sudo cp ../conf/mastodon-web.service /etc/systemd/system/mastodon-web.service
@ -188,27 +183,15 @@ sudo chown root: /etc/systemd/system/mastodon-streaming.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable /etc/systemd/system/mastodon-*.service sudo systemctl enable /etc/systemd/system/mastodon-*.service
# sudo systemctl start mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service sudo systemctl start mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service
# debug # debug
# sudo systemctl status mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service sudo systemctl status mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service
# Add service YunoHost # Add service YunoHost
sudo yunohost service add mastodon-web sudo yunohost service add mastodon-web
sudo yunohost service add mastodon-sidekiq sudo yunohost service add mastodon-sidekiq
sudo yunohost service add mastodon-streaming sudo yunohost service add mastodon-streaming
# restart 1
sudo systemctl restart /etc/systemd/system/mastodon-*.service
# Re-Install bundle WHY ???
sudo su - $app <<MCOMMANDS
pushd ~/live
bundle install
MCOMMANDS
# restart 2
sudo systemctl restart /etc/systemd/system/mastodon-*.service
# Copy nginx config # Copy nginx config
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf
@ -235,8 +218,4 @@ fi
sudo yunohost app ssowatconf sudo yunohost app ssowatconf
# Reload Nginx # Reload Nginx
sudo systemctl reload nginx || true sudo systemctl reload nginx
# debug
# sudo systemctl status nginx
# sudo systemctl reload nginx

View file

@ -63,6 +63,7 @@ ynh_psql_drop_db "${app}_production"
ynh_psql_drop_role "${app}" ynh_psql_drop_role "${app}"
# Remove Debian package # Remove Debian package
sudo apt-get remove --purge -y yarn
#sudo apt-get remove --purge -y imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file curl git #sudo apt-get remove --purge -y imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file curl git
# Delete redis package # Delete redis package
#sudo apt-get remove --purge -y redis-server redis-tools #sudo apt-get remove --purge -y redis-server redis-tools
@ -83,15 +84,12 @@ SECURE_REMOVE '/var/log/$app/'
# Delete cronlog # Delete cronlog
SECURE_REMOVE '/etc/cron.d/$app' SECURE_REMOVE '/etc/cron.d/$app'
# Delete source.list # Delete source.list
SECURE_REMOVE '/etc/apt/sources.list.d/backports.list' sudo rm /etc/apt/sources.list.d/backports.list
SECURE_REMOVE '/etc/apt/sources.list.d/yarn.list' sudo rm /etc/apt/sources.list.d/yarn.list
# Delete ruby exec # Delete ruby exec
sudo rm /usr/bin/ruby sudo rm /usr/bin/ruby
# Uninstall Yarn
sudo npm uninstall yarn
# Remove user # Remove user
sudo userdel -f $app sudo userdel -f $app