install from script

This commit is contained in:
Antonio J. Delgado 2023-11-28 11:24:56 +02:00
parent 4bde8dfbea
commit bc0598b7c6
2 changed files with 22 additions and 44 deletions

View file

@ -169,22 +169,6 @@ class mastodon (
group => $mastodon_group,
require => Vcsrepo['rbenv'],
}
file { '/usr/local/bin/install_ruby.sh':
ensure => $ensure,
content => template('mastodon/install_ruby.sh.erb'),
mode => '0750',
owner => $mastodon_user,
group => 'root',
require => Vcsrepo['ruby_build'],
}
exec { 'install_ruby':
command => '/usr/local/bin/install_ruby.sh',
# user => $mastodon_user,
# cwd => "${mastodon_home}/.rbenv/",
creates => "${mastodon_home}/.rbenv/versions/3.2.2/bin/bundler",
timeout => 0,
require => File['/usr/local/bin/install_ruby.sh'],
}
postgresql::server::db { 'mastodon':
user => 'mastodon',
password => postgresql::postgresql_password('mastodon', $db_password),
@ -198,34 +182,24 @@ class mastodon (
group => $mastodon_group,
require => User[$mastodon_user],
}
exec { 'config_deployment':
command => "${mastodon_home}/live/bin/bundle config deployment 'true'",
user => $mastodon_user,
cwd => "${mastodon_home}/live",
# creates => "${mastodon_home}/.rbenv/libexec/rbenv-realpath.dylib",
require => Exec['install_ruby'],
file { '/usr/local/bin/install_mastodon.sh':
ensure => $ensure,
content => template('mastodon/install_mastodon.sh.erb'),
mode => '0750',
owner => $mastodon_user,
group => 'root',
require => [
Vcsrepo['mastodon_code'],
Postgresql::Server::Db['mastodon'],
Vcsrepo['ruby_build'],
],
}
exec { 'config_without_devel_test':
command => "${mastodon_home}/live/bin/bundle config without 'development test'",
user => $mastodon_user,
cwd => "${mastodon_home}/live",
# creates => "${mastodon_home}/.rbenv/libexec/rbenv-realpath.dylib",
require => Exec['config_deployment'],
}
exec { 'bundle_install':
command => "${mastodon_home}/live/bin/bundle install -j$(getconf _NPROCESSORS_ONLN)",
path => '/usr/sbin:/usr/bin:/sbin:/bin',
user => $mastodon_user,
cwd => "${mastodon_home}/live",
# creates => "${mastodon_home}/.rbenv/libexec/rbenv-realpath.dylib",
require => Exec['config_without_devel_test'],
}
exec { 'yarn_install':
command => "${mastodon_home}/live/bin/yarn install --pure-lockfile",
path => '/usr/sbin:/usr/bin:/sbin:/bin',
user => $mastodon_user,
cwd => "${mastodon_home}/live",
# creates => "${mastodon_home}/.rbenv/libexec/rbenv-realpath.dylib",
require => Exec['bundle_install'],
exec { 'install_mastodon':
command => '/usr/local/bin/install_mastodon.sh',
# user => $mastodon_user,
# cwd => "${mastodon_home}/.rbenv/",
creates => "${mastodon_home}/.rbenv/versions/3.2.2/bin/bundler",
timeout => 0,
require => File['/usr/local/bin/install_mastodon.sh'],
}
}

View file

@ -6,4 +6,8 @@ if [ ! -e '<%= @mastodon_home %>/.rbenv/versions/<%= @ruby_version %>/bin/ruby'
sudo -u <%= @mastodon_user %> RUBY_CONFIGURE_OPTS=--with-jemalloc '<%= @mastodon_home %>/.rbenv/bin/rbenv' install '<%= @ruby_version %>'
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/.rbenv/bin/rbenv' global '<%= @ruby_version %>'
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/.rbenv/versions/<%= @ruby_version %>/bin/gem' install bundler --no-document
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'
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/live/bin/bundle' install -j$(getconf _NPROCESSORS_ONLN)
sudo -u <%= @mastodon_user %> '<%= @mastodon_home %>/live/bin/yarn' install --pure-lockfile
fi