commit:a1698aafae05d59f9704e672fb920ee243de7b17
author:Chip Black
committer:Chip Black
date:Tue Nov 8 08:53:41 2022 +0000
parents:76969b2d36d6d9bef8f4608a96892a89d70d2f63
[WIP] Convert to bastille
diff --git a/build.sh b/build.sh
line changes: +16/-24
index bfdad75..7f50b0e
--- a/build.sh
+++ b/build.sh
@@ -1,51 +1,43 @@
 #!/bin/sh
 
 JAILNAME="$1"
-LO_NAME="$2"
-LO_ADDR="$3"
-EM_ADDR="$4"
+ADDR="$2"
 ZFSROOT='main/jail'
 PACKAGES="$(cat pkglist.txt | tr '[:space:]' ' ')"
-MASTODON_VERSION="v3.5.3"
+FREEBSD_RELEASE="13.1-RELEASE"
+MASTODON_VERSION="v4.0.0rc2"
 
-if [ -z "$JAILNAME" -o -z "$LO_NAME" -o -z "$LO_ADDR" -o -z "$EM_ADDR" ]; then
-	echo "syntax: $0 <jailname> <loopback interface name> <loopback addr> <em0 addr>"
+if [ -z "$JAILNAME" -o -z "$ADDR" ]; then
+	echo "syntax: $0 <jailname> <addr>"
 	exit 1
 fi
 
 set -e
 set -x
 
-zfs snapshot $ZFSROOT/newjail@_new_snap_
-zfs send $ZFSROOT/newjail@_new_snap_ | zfs receive $ZFSROOT/$JAILNAME
-zfs destroy $ZFSROOT/$JAILNAME@_new_snap_
-zfs destroy $ZFSROOT/newjail@_new_snap_
+bastille create $JAILNAME $FREEBSD_RELEASE $ADDR
 
-ezjail-admin create -c zfs -x $JAILNAME "$LO_NAME|$LO_ADDR,em0|$EM_ADDR"
-ezjail-admin start $JAILNAME
-echo nameserver 192.168.64.1 >> /usr/jails/$JAILNAME/etc/resolv.conf
-ASSUME_ALWAYS_YES=yes pkg -j $JAILNAME install $PACKAGES
-jexec $JAILNAME pw user add -n mastodon -m -h -
-jexec -U mastodon $JAILNAME /bin/sh -c 'cd && git clone https://github.com/tootsuite/mastodon.git live'
-jexec -U mastodon $JAILNAME /bin/sh -c "cd ~/live && git checkout -b prod $MASTODON_VERSION"
+bastille pkg $JAILNAME install -y $PACKAGES
+bastille cmd $JAILNAME pw user add mastodon -m -h -
 jexec -U mastodon $JAILNAME /bin/sh <<SCRIPT
 set -e
 set -x
 
+cd
+git clone https://github.com/tootsuite/mastodon.git live
 cd ~/live
+git checkout -b prod $MASTODON_VERSION
 bundle config deployment 'true'
 bundle config without 'development test'
 bundle install
 yarn install --pure-lockfile
 SCRIPT
-cat env.production | jexec -U mastodon $JAILNAME /bin/sh -c 'cat >~/live/.env.production'
+bastille cp $JAILNAME home
 jexec -U mastodon $JAILNAME /bin/sh -c 'cd ~/live && RAILS_ENV=production bundle exec rails assets:precompile'
-sed -e "s/LO_ADDR/$LO_ADDR/" < nginx.conf | jexec $JAILNAME /bin/sh -c 'cat > /usr/local/etc/nginx/nginx.conf'
+sed -e "s/ADDR/$ADDR/" < nginx.conf | jexec $JAILNAME /bin/sh -c 'cat > /usr/local/etc/nginx/nginx.conf'
 cat redis.diff | jexec $JAILNAME /bin/sh -c 'cd /usr/local/etc && patch -p1'
 cat mastodon.crt | jexec $JAILNAME /bin/sh -c 'cat > /usr/local/etc/nginx/mastodon.crt'
 cat mastodon.key | jexec $JAILNAME /bin/sh -c 'cd /usr/local/etc/nginx && cat > mastodon.key && chmod 400 mastodon.key'
-cat rc.conf | jexec $JAILNAME /bin/sh -c 'cat >/etc/rc.conf'
-ezjail-admin restart $JAILNAME
-for RC in rc.d/*; do
-	cp $RC /usr/jails/$JAILNAME/usr/local/etc/$RC
-done
+bastille sysrc $JAILNAME redis_enable=YES
+bastille sysrc $JAILNAME nginx_enable=YES
+bastille cp $JAILNAME rc.d /usr/local/etc/

diff --git a/rc.conf b/rc.conf
line changes: +0/-2
index 2951ec4..0000000
--- a/rc.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-redis_enable="YES"
-nginx_enable="YES"