commit:7cf88a6151c29ed775efd79382668b1dfaeb60d9
author:Chip Black
committer:Chip Black
date:Mon May 29 21:43:30 2023 -0500
parents:90e2c53cdc0d5e21f91518fd7d339056381a9109
Build ruby locally
diff --git a/build-mastodon.sh b/build-mastodon.sh
line changes: +26/-3
index c7286ff..cf87a17
--- a/build-mastodon.sh
+++ b/build-mastodon.sh
@@ -20,8 +20,25 @@ bastille config $JAILNAME set ip6.addr $IPV6_ADDR
 bastille restart $JAILNAME
 
 bastille pkg $JAILNAME install -y $PACKAGES
-bastille cmd $JAILNAME pw user add mastodon -m -h -
-jexec -U mastodon $JAILNAME /bin/sh <<SCRIPT
+bastille cmd $JAILNAME pw user add mastodon -m -h - -s /bin/sh
+
+# Install ruby
+bastille cp $JAILNAME ruby/$RUBY_SOURCE /root/
+RUBY_DIR=$(basename $RUBY_SOURCE .tar.gz)
+jexec -U root $JAILNAME /bin/sh <<SCRIPT
+set -e
+set -x
+cd
+tar xf $RUBY_DIR.tar.gz
+cd $RUBY_DIR
+./configure
+make -j8 install
+cd
+rm -rf $RUBY_DIR $RUBY_DIR.tar.gz
+gem install bundler --no-document
+SCRIPT
+
+jexec -U mastodon $JAILNAME <<SCRIPT
 set -e
 set -x
 
@@ -31,6 +48,8 @@ cd ~/live
 git checkout -b prod $MASTODON_VERSION
 bundle config deployment 'true'
 bundle config without 'development test'
+# required because ruby doesn't look for native libs in /usr/local
+bundle config set build.idn-ruby --with-idn-dir=/usr/local
 bundle install
 yarn install --pure-lockfile
 SCRIPT
@@ -43,7 +62,11 @@ sed -e "s/\$DB_HOST/$POSTGRES_ADDR/" \
 bastille cp $JAILNAME env.production /home/mastodon/live/.env.production
 rm env.production
 
-jexec -U mastodon $JAILNAME /bin/sh -c 'cd ~/live && RAILS_ENV=production bundle exec rails assets:precompile'
+jexec -U mastodon $JAILNAME <<'SCRIPT'
+cd ~/live
+export RAILS_ENV=production
+bundle exec rails assets:precompile
+SCRIPT
 
 bastille mount $JAILNAME $DATA_PATH/media usr/home/mastodon/live/public/system nullfs rw 0 0
 jexec $JAILNAME /usr/sbin/chown mastodon:mastodon /home/mastodon/live/public/system

diff --git a/common.opts b/common.opts
line changes: +2/-1
index f05ac62..8cbcde4
--- a/common.opts
+++ b/common.opts
@@ -1,4 +1,5 @@
 FREEBSD_RELEASE=13.1-RELEASE
+RUBY_SOURCE=ruby-3.0.6.tar.gz
 
 # mainline
 #MASTODON_REPO="https://github.com/tootsuite/mastodon.git"
@@ -14,4 +15,4 @@ FREEBSD_RELEASE=13.1-RELEASE
 
 # Awesome Garden Hometown
 MASTODON_REPO="chip@yomiko:git/hometown.git"
-MASTODON_VERSION="origin/awesome-garden-main"
+MASTODON_VERSION="awesome-garden-main-2"

diff --git a/pkglist-mastodon.txt b/pkglist-mastodon.txt
line changes: +0/-3
index b9cfc14..7d29449
--- a/pkglist-mastodon.txt
+++ b/pkglist-mastodon.txt
@@ -18,8 +18,5 @@ npm-node16
 postgresql15-client
 protobuf
 readline
-ruby
-ruby30-gems
-rubygem-bundler
 yarn-node16
 zsh