aboutsummaryrefslogtreecommitdiff
path: root/scripts/install
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install')
-rw-r--r--scripts/install33
1 files changed, 20 insertions, 13 deletions
diff --git a/scripts/install b/scripts/install
index e82774b..1536cd5 100644
--- a/scripts/install
+++ b/scripts/install
@@ -96,7 +96,7 @@ ynh_install_app_dependencies \
`# redis ` \
redis-server redis-tools \
`# postgresql ` \
- postgresql \
+ postgresql postgresql-contrib \
`# Ruby ` \
autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev \
`# ffmpeg from backports ` \
@@ -146,7 +146,7 @@ ynh_add_nginx_config
# Create a system user
adduser $app --home $final_path --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
-chown -R "$app" "$final_path"
+chown -R "$app": "$final_path"
# TODO: try to use ynh_install_ruby from https://github.com/YunoHost-Apps/Experimental_helpers
# Install de rbenv
@@ -161,14 +161,14 @@ eval \"\$(rbenv init -)\"" > $final_path/.profile
# Install ruby-build
(
- exec_as "$app" $final_path/.rbenv/bin/rbenv install 2.5.1
- exec_as "$app" $final_path/.rbenv/bin/rbenv global 2.5.1
- exec_as "$app" $final_path/.rbenv/versions/2.5.1/bin/ruby -v
+ exec_as "$app" $final_path/.rbenv/bin/rbenv install 2.5.3 || true
+ exec_as "$app" $final_path/.rbenv/bin/rbenv global 2.5.3 || true
+ exec_as "$app" $final_path/.rbenv/versions/2.5.3/bin/ruby -v
)
# Create symlink for ruby
rm /usr/bin/ruby || true
-ln -s $final_path/.rbenv/versions/2.5.1/bin/ruby /usr/bin/ruby || true
+ln -s $final_path/.rbenv/versions/2.5.3/bin/ruby /usr/bin/ruby || true
# Yarn install on root
pushd $final_path/live
@@ -208,8 +208,8 @@ ynh_replace_string "#SMTP_OPENSSL_VERIFY_MODE=peer" "SMTP_OPENSSL_V
(
cd "$final_path/live"
su mastodon <<INSTALL
- $final_path/.rbenv/versions/2.5.1/bin/gem install bundler
- $final_path/live/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test --quiet
+ $final_path/.rbenv/versions/2.5.3/bin/gem install bundler
+ $final_path/live/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test
yarn install --production --no-progress --non-interactive --silent
echo "SAFETY_ASSURED=1">> .env.production
RAILS_ENV=production $final_path/live/bin/bundle exec rails db:migrate --quiet
@@ -222,6 +222,8 @@ INSTALL
#=================================================
# Create a dedicated systemd config
+ynh_replace_string "__PORT_WEB__" "$port_web" "../conf/mastodon-web.service"
+ynh_replace_string "__PORT_STREAM__" "$port_stream" "../conf/mastodon-streaming.service"
ynh_add_systemd_config "$app-web" "mastodon-web.service"
ynh_add_systemd_config "$app-sidekiq" "mastodon-sidekiq.service"
ynh_add_systemd_config "$app-streaming" "mastodon-streaming.service"
@@ -237,8 +239,8 @@ account = Account.create!(username: '$admin_mastodon')
user = User.create!(email: '$admin_mastodon_mail', password: '$admin_pass', account: account)
CREATEUSER
su mastodon <<SETADMIN
-RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=$admin_mastodon
-RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon_mail
+RAILS_ENV=production bin/tootctl accounts modify $admin_mastodon --confirm
+RAILS_ENV=production bin/tootctl accounts modify $admin_mastodon --role admin
SETADMIN
)
@@ -249,7 +251,7 @@ SETADMIN
#=================================================
# TODO:Set permissions to app files
-chown -R "$app" "$final_path"
+chown -R "$app": "$final_path"
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
@@ -260,6 +262,11 @@ yunohost service add "$app-web"
yunohost service add "$app-sidekiq"
yunohost service add "$app-streaming"
+# SETUP CRON JOB FOR REMOVING CACHE
+ynh_replace_string "__FINAL_PATH__" "$final_path" ../conf/cron
+ynh_replace_string "__USER__" "$app" ../conf/cron
+sudo cp -f ../conf/cron /etc/cron.d/$app
+
#=================================================
# SETUP SSOWAT
#=================================================
@@ -281,8 +288,8 @@ systemctl reload nginx
message="Mastodon was successfully installed :)
Please open 'https://$domain$path_url'
-The admin username is: '$admin_mastodon_mail'
-The admin password is: '$admin_pass'
+The admin username is: $admin_mastodon_mail
+The admin password is: $admin_pass
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/mastodon_ynh"
ynh_send_readme_to_admin "$message" "$admin_mastodon"