diff options
| author | __cyp <cyp@rouquin.me> | 2017-04-11 17:17:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-11 17:17:13 +0200 |
| commit | 80fa7cd71afbef63fe8a1e0b52431c3c192233ca (patch) | |
| tree | 32e81e7d4a46bf7a8836d85cf585c4e8fdba0e47 /scripts/install | |
| parent | 6cca229765263b90433b776b9d2cc97e8c04ad22 (diff) | |
| parent | d582ec8d7bb114961f58c36bf0bb0b8257a7cbca (diff) | |
| download | mastodon_ynh-80fa7cd71afbef63fe8a1e0b52431c3c192233ca.tar.gz mastodon_ynh-80fa7cd71afbef63fe8a1e0b52431c3c192233ca.tar.bz2 mastodon_ynh-80fa7cd71afbef63fe8a1e0b52431c3c192233ca.zip | |
Merge branch 'master' into master
Diffstat (limited to 'scripts/install')
| -rw-r--r-- | scripts/install | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/scripts/install b/scripts/install index b3150f0..6a1fe20 100644 --- a/scripts/install +++ b/scripts/install @@ -40,7 +40,7 @@ ynh_app_setting_set $app is_public $is_public sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login # Install debian package -ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl +ynh_package_install imagemagick libpq-dev libxml2-dev libxslt1-dev file curl apt-transport-https # Install redis package ynh_package_install redis-server redis-tools @@ -51,9 +51,13 @@ ynh_package_install postgresql postgresql-contrib # Install Ruby ynh_package_install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev -# Install debian package backports -sudo cp ../conf/backports.list /etc/apt/sources.list.d/ +# Install source.list debian package backports & yarn +sudo cp ../conf/backports.list /etc/apt/sources.list.d/ +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 sudo apt-get -t jessie-backports -y install ffmpeg # Creates the destination directory and stores its location. @@ -63,7 +67,9 @@ ynh_app_setting_set $app final_path $final_path pushd /opt curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - sudo apt-get -y install nodejs -sudo npm install -g yarn + +# Install Yarn +ynh_package_install yarn # Set UTF8 encoding by default sudo su -c "psql" postgres <<< \ @@ -77,6 +83,7 @@ sudo su -c "psql" postgres <<< \ # Create DB without password ynh_psql_create_db_without_password "$app" +sudo systemctl restart postgresql # Download all Ruby source sudo su - $app <<CLONECOMMANDS @@ -94,12 +101,13 @@ popd # sudo chown -R $app: "${final_path}" # Install de rbenv +# Tips: rbenv init - bash (see: https://github.com/rbenv/rbenv/issues/925) sudo su - $app <<COMMANDS pushd ~/.rbenv 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"' >> ~/.bashrc -echo 'eval "\$(rbenv init -)"' >> ~/.bashrc +echo 'eval "\$(rbenv init - bash)"' >> ~/.bashrc COMMANDS # Install ruby-build @@ -116,7 +124,7 @@ sudo su - $app <<MCOMMANDS pushd ~/live /opt/mastodon/.rbenv/versions/2.4.1/bin/gem install bundler bin/bundle install --deployment --without development test -yarn install +yarn install --production MCOMMANDS # Vérif Mastodon @@ -125,6 +133,13 @@ pushd ~ type rbenv VCOMMANDS +# Vérif Mastodon +sudo su - $app <<VVCOMMANDS +pushd ~ +rbenv init - bash +type rbenv +VVCOMMANDS + # Adjust Mastodon config pushd $final_path/live/ sudo cp -a .env.production.sample .env.production @@ -144,13 +159,14 @@ sudo sed -i 's,SMTP_FROM_ADDRESS=notifications@example.com,SMTP_FROM_ADDRESS='${ # Create database # Preconfig CSS & JS - sudo su - $app <<CCOMMANDS pushd ~/live RAILS_ENV=production bin/bundle exec rails db:setup -RAILS_ENV=production bin/bundle exec rails assets:precompile +RAILS_ENV=production bin/bundle exec rails --trace assets:precompile CCOMMANDS +# TODO: Doesn't work for the moment, +# Mastodon need a user for creating an administator account # Create admin user # Create confirm email sudo su - $app <<ACOMMANDS @@ -169,10 +185,11 @@ sudo cp ../conf/mastodon-sidekiq.service /etc/systemd/system/mastodon-sidekiq.se sudo chown root: /etc/systemd/system/mastodon-sidekiq.service sudo cp ../conf/mastodon-streaming.service /etc/systemd/system/mastodon-streaming.service sudo chown root: /etc/systemd/system/mastodon-streaming.service + sudo systemctl daemon-reload sudo systemctl enable /etc/systemd/system/mastodon-*.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 # Add service YunoHost |
