aboutsummaryrefslogtreecommitdiff
path: root/scripts/install
diff options
context:
space:
mode:
authornemsia <nemsia@nemsia.org>2018-05-31 13:41:03 +0200
committerGitHub <noreply@github.com>2018-05-31 13:41:03 +0200
commit64d3147a7b68f9e94f231b9a8aa6e9199b2824aa (patch)
treed48a04897e7d1a103ea4bc116238fcd78c290366 /scripts/install
parent7a3313b7cf14937bbc2b5bb6c1a7a951f0983d9c (diff)
downloadmastodon_ynh-64d3147a7b68f9e94f231b9a8aa6e9199b2824aa.tar.gz
mastodon_ynh-64d3147a7b68f9e94f231b9a8aa6e9199b2824aa.tar.bz2
mastodon_ynh-64d3147a7b68f9e94f231b9a8aa6e9199b2824aa.zip
Yunohost 3.0 Stretch app upgrade (#85)
* Ready to Debian Stretch * rb 2.5.1 on install * Yarn install on root * Ready to mastodon 2.4.1
Diffstat (limited to 'scripts/install')
-rw-r--r--scripts/install44
1 files changed, 29 insertions, 15 deletions
diff --git a/scripts/install b/scripts/install
index 3d5172f..d92e0ed 100644
--- a/scripts/install
+++ b/scripts/install
@@ -47,7 +47,7 @@ ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt
ynh_package_install redis-server redis-tools
# Install postgresql
-ynh_package_install postgresql postgresql-contrib postgresql-server-dev-9.4
+ynh_package_install postgresql postgresql-contrib postgresql-server-dev-all
# Install Ruby
ynh_package_install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
@@ -59,14 +59,23 @@ if [[ $arch = arm* ]]; then
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
fi
-# Install source.list debian package backports & yarn
-sudo cp ../conf/backports.list /etc/apt/sources.list.d/
+# Install source.list debian yarn package
sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
sudo cp ../conf/yarn.list /etc/apt/sources.list.d/
-ynh_package_update
-# Install debian package backports
+# Install source.list debian jessie package backports
+debian_version=$(lsb_release -c -s)
+if [[ $debian_version = jessie ]]; then
+sudo cp ../conf/backports.list /etc/apt/sources.list.d/
+ynh_package_update
sudo apt-get -t jessie-backports -y install ffmpeg
+else
+ynh_package_update
+ynh_package_install ffmpeg
+fi
+
+# Install Yarn
+ynh_package_install yarn
# Creates the destination directory and stores its location.
ynh_app_setting_set $app final_path $final_path
@@ -76,9 +85,6 @@ pushd /opt
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get -y install nodejs
-# Install Yarn
-ynh_package_install yarn
-
# Set UTF8 encoding by default
sudo su -c "psql" postgres <<< \
"update pg_database set datistemplate='false' where datname='template1';"
@@ -122,22 +128,26 @@ COMMANDS
# Install ruby-build
sudo su - $app <<RCOMMANDS
-/opt/mastodon/.rbenv/bin/rbenv install 2.5.0
-/opt/mastodon/.rbenv/versions/2.5.0/bin/ruby -v
+/opt/mastodon/.rbenv/bin/rbenv install 2.5.1
+/opt/mastodon/.rbenv/versions/2.5.1/bin/ruby -v
RCOMMANDS
# Create symlink for ruby
sudo rm /usr/bin/ruby || true
-sudo ln -s /opt/mastodon/.rbenv/versions/2.5.0/bin/ruby /usr/bin/ruby || true
+sudo ln -s /opt/mastodon/.rbenv/versions/2.5.1/bin/ruby /usr/bin/ruby || true
# Install Mastodon
sudo su - $app <<MCOMMANDS
pushd ~/live
-/opt/mastodon/.rbenv/versions/2.5.0/bin/gem install bundler
+/opt/mastodon/.rbenv/versions/2.5.1/bin/gem install bundler
bin/bundle install --deployment --without development test
-yarn install --production
MCOMMANDS
+# Yarn install on root
+pushd $final_path/live
+yarn install --pure-lockfile
+popd
+
# Adjust Mastodon config
pushd $final_path/live/
sudo cp -a .env.production.sample .env.production
@@ -171,9 +181,13 @@ sudo su - $app <<CCOMMANDS
pushd ~/live
echo "SAFETY_ASSURED=1">> .env.production
RAILS_ENV=production bin/bundle exec rails db:setup
-RAILS_ENV=production bin/bundle exec rails --trace assets:precompile
CCOMMANDS
+# Rails precompile on root
+pushd $final_path/live
+RAILS_ENV=production bin/bundle exec rails --trace assets:precompile
+popd
+
# init rbenv & create bundle
sudo su - $app <<BCOMMANDS
. ~/.profile
@@ -191,7 +205,7 @@ sudo cp ../conf/mastodon-streaming.service /etc/systemd/system/mastodon-streamin
sudo chown root: /etc/systemd/system/mastodon-streaming.service
sudo systemctl daemon-reload
-sudo systemctl enable /etc/systemd/system/mastodon-*.service
+sudo systemctl enable mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service
sudo systemctl start mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service
# debug
sudo systemctl status mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service