puppet-mastodon/templates/install_mastodon.sh.erb

21 lines
1.2 KiB
Text
Raw Normal View History

2023-11-28 08:20:18 +01:00
#!/bin/bash
set -euo pipefail
2023-11-28 12:47:03 +01:00
if [ ! -e '<%= @mastodon_home %>/.mastodon_install' ]; then
cd '<%= @mastodon_home %>'
2023-11-28 10:34:55 +01:00
echo "Installing ruby..."
2023-11-28 13:23:53 +01:00
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$($HOME/.rbenv/bin/rbenv init -)"
2023-11-28 08:50:37 +01:00
sudo -u <%= @mastodon_user %> RUBY_CONFIGURE_OPTS=--with-jemalloc '<%= @mastodon_home %>/.rbenv/bin/rbenv' install '<%= @ruby_version %>'
2023-11-28 09:42:50 +01:00
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/.rbenv/bin/rbenv' global '<%= @ruby_version %>'
2023-11-28 09:54:26 +01:00
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/.rbenv/versions/<%= @ruby_version %>/bin/gem' install bundler --no-document
2023-11-28 10:34:55 +01:00
echo "Configuring bundle..."
2023-11-28 10:24:56 +01:00
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/live/bin/bundle' config deployment 'true'
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/live/bin/bundle' config without 'development test'
2023-11-28 10:34:55 +01:00
echo "Running bundle install..."
2023-11-28 10:24:56 +01:00
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/live/bin/bundle' install -j$(getconf _NPROCESSORS_ONLN)
2023-11-28 10:34:55 +01:00
echo "Running yarn install..."
2023-11-28 10:24:56 +01:00
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/live/bin/yarn' install --pure-lockfile
2023-11-28 12:47:03 +01:00
echo $(date +s) > '<%= @mastodon_home %>/.mastodon_install'
2023-11-28 08:20:18 +01:00
fi