net-im/mastodon: Resurrect

Mastodon is an alternative implementation of GNU social, a free,
open-source social network.  It is a decentralized alternative to
commercial platforms based on ActivityStreams, Webfinger, PubsubHubbub
and Salmon.  The project focuses on creating a clean REST API and a good
user interface.  Ruby on Rails is used for the back-end, while React.js
and Redux are used for the dynamic front-end.

For easier maintenance of the port some part of the installation
procedure remains to be completed by the end user. The main howto is
available at https://wiki.freebsd.org/Ports/net-im/mastodon.

A great thanks to Stefano Marinelli for the fabulous post on running
Mastodon on a FreeBSD instance which helped a lot in porting this. The
link to the original post is also available on the above mentioned wiki
page.

Sponsored by:	Nepustil
This commit is contained in:
Muhammad Moinur Rahman 2022-12-06 09:33:18 -06:00
parent 122533f37f
commit 079641ccb7
11 changed files with 276 additions and 1 deletions

1
MOVED
View File

@ -10216,7 +10216,6 @@ mail/p5-Mail-Cache||2018-07-16|Has expired: Unmaintained
www/p5-ZConf-RSS||2018-07-16|Has expired: Unmaintained
www/p5-ZConf-RSS-GUI-GTK||2018-07-16|Has expired: Unmaintained
devel/p5-ZConf-GUI||2018-07-16|Has expired: Unmaintained
net-im/mastodon||2018-07-16|Has expired: Breaks too frequently
x11-fm/p5-PerlFM||2018-07-16|Has expired: Unmaintained
astro/p5-ZConf-Weather||2018-07-16|Has expired: Unmaintained
sysutils/p5-ZConf-Cron||2018-07-16|Has expired: Unmaintained

View File

@ -70,6 +70,7 @@
SUBDIR += libstrophe
SUBDIR += loudmouth
SUBDIR += lurch
SUBDIR += mastodon
SUBDIR += matterbridge
SUBDIR += matterhorn
SUBDIR += matterircd

71
net-im/mastodon/Makefile Normal file
View File

@ -0,0 +1,71 @@
PORTNAME= mastodon
DISTVERSIONPREFIX= v
DISTVERSION= 4.0.2
CATEGORIES= net-im www
MAINTAINER= bofh@FreeBSD.org
COMMENT= GNU Social-compatible microblogging server
WWW= https://github.com/tootsuite/mastodon
LICENSE= AGPLv3
LICENSE_FILE= ${WRKSRC}/LICENSE
LIB_DEPENDS= libidn.so:dns/libidn
RUN_DEPENDS= autoconf>=2.71:devel/autoconf \
curl>0:ftp/curl \
ffmpeg>0:multimedia/ffmpeg \
git>=0:devel/git \
gmake>0:devel/gmake \
gnupg>0:security/gnupg \
redis>0:databases/redis \
rubygem-bundler>=0:sysutils/rubygem-bundler \
sudo>0:security/sudo \
wget>0:ftp/wget \
yarn>:www/yarn
USES= magick:7,run pgsql
USE_GITHUB= yes
USE_RC_SUBR= mastodon_sidekiq mastodon_streaming mastodon_web
USE_RUBY= yes
NO_ARCH= yes
NO_BUILD= yes
USERS= ${PORTNAME}
GROUPS= ${PORTNAME}
RM_MASTODONFILES= .dockerignore dist/mastodon-web.service \
dist/mastodon-sidekiq.service \
dist/mastodon-streaming.service
RM_MASTODONDIRS= .circleci .github
post-extract:
.for _F in ${RM_MASTODONFILES}
@${RM} ${WRKSRC}/${_F}
.endfor
.for _D in ${RM_MASTODONDIRS}
@${RM} -r ${WRKSRC}/${_D}
.endfor
post-patch:
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|'\
${WRKSRC}/dist/nginx.conf
do-install:
${FIND} ${WRKSRC} -name '*.orig' -delete
${FIND} ${WRKSRC} -name '*.bak' -delete
${FIND} ${WRKSRC} -name '*.gitkeep' -delete
${FIND} ${WRKSRC} -name '*.gitignore' -delete
${MV} ${WRKSRC}/dist/nginx.conf ${WRKSRC}/dist/nginx.conf.sample
(cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/www/${PORTNAME})
post-install:
@${ECHO_CMD} "@owner mastodon" >> ${TMPPLIST}
@${ECHO_CMD} "@group mastodon" >> ${TMPPLIST}
${FIND} -s ${STAGEDIR}${WWWDIR} -not -type d | ${SORT} | \
${SED} -e 's#^${STAGEDIR}${PREFIX}/##' | \
${SED} -E -e '/sample$$/ s#^#@sample #' >> ${TMPPLIST}
${FIND} -s ${STAGEDIR}${WWWDIR} -type d | ${SORT} | \
${SED} -e 's#^${STAGEDIR}${PREFIX}/#@dir #' >> ${TMPPLIST}
.include <bsd.port.mk>

3
net-im/mastodon/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1669830294
SHA256 (mastodon-mastodon-v4.0.2_GH0.tar.gz) = 70a4d9dcd9b746f6e9ced9b567ee5ad81e530cfaccb7f471259b917c20166309
SIZE (mastodon-mastodon-v4.0.2_GH0.tar.gz) = 27934855

View File

@ -0,0 +1,45 @@
#!/bin/sh
# $FreeBSD$
# PROVIDE: mastodon_sidekiq
# REQUIRE: DAEMON postgresql
# KEYWORD: shutdown
. /etc/rc.subr
name="mastodon_sidekiq"
desc="Mastodon Sidekiq Service"
rcvar="mastodon_sidekiq_enable"
load_rc_config ${name}
start_precmd="${name}_prestart"
stop_cmd="${name}_stop"
mastodon_sidekiq_user="mastodon"
mastodon_sidekiq_chdir="%%WWWDIR%%"
mastodon_sidekiq_env="RAILS_ENV=production \
DB_POOL=25 \
PATH=/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/sbin:%%PREFIX%%/bin:~/bin \
MALLOC_ARENA_MAX=2"
pidfile="/var/run/mastodon/${name##mastodon_}.pid"
ppidfile="/var/run/mastodon/${name##mastodon_}_supervisor.pid"
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/bundle"
procname_args="exec sidekiq -c 25"
command_args="-f -T ${name} -P ${ppidfile} -p ${pidfile} -S -r ${procname} ${procname_args}"
mastodon_sidekiq_prestart()
{
if [ ! -d "/var/run/mastodon" ]; then
install -d -o "${mastodon_sidekiq_user}" -g "${mastodon_sidekiq_user}" -m 750 "/var/run/mastodon"
fi
}
mastodon_sidekiq_stop()
{
/bin/kill -9 `cat ${ppidfile}`
/bin/kill -15 `cat ${pidfile}`
}
run_rc_command "$1"

View File

@ -0,0 +1,45 @@
#!/bin/sh
# $FreeBSD$
# PROVIDE: mastodon_streaming
# REQUIRE: DAEMON postgresql
# KEYWORD: shutdown
. /etc/rc.subr
name="mastodon_streaming"
desc="Mastodon Streaming Service"
rcvar="mastodon_streaming_enable"
load_rc_config ${name}
start_precmd="${name}_prestart"
stop_cmd="${name}_stop"
mastodon_streaming_user="mastodon"
mastodon_streaming_chdir="%%WWWDIR%%"
mastodon_streaming_env="NODE_ENV=production \
PORT=4000 \
STREAMING_CLUSTER_NUM=1 \
PATH=/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/sbin:%%PREFIX%%/bin:~/bin"
pidfile="/var/run/mastodon/${name##mastodon_}.pid"
ppidfile="/var/run/mastodon/${name##mastodon_}_supervisor.pid"
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/node"
procname_args="./streaming"
command_args="-f -T ${name} -P ${ppidfile} -p ${pidfile} -S -r ${procname} ${procname_args}"
mastodon_streaming_prestart()
{
if [ ! -d "/var/run/mastodon" ]; then
install -d -o "${mastodon_streaming_user}" -g "${mastodon_streaming_user}" -m 750 "/var/run/mastodon"
fi
}
mastodon_streaming_stop()
{
/bin/kill -9 `cat ${ppidfile}`
/bin/kill -15 `cat ${pidfile}`
}
run_rc_command "$1"

View File

@ -0,0 +1,44 @@
#!/bin/sh
# $FreeBSD$
# PROVIDE: mastodon_web
# REQUIRE: DAEMON postgresql
# KEYWORD: shutdown
. /etc/rc.subr
name="mastodon_web"
desc="Mastodon Web Service"
rcvar="mastodon_web_enable"
load_rc_config ${name}
start_precmd="${name}_prestart"
stop_cmd="${name}_stop"
mastodon_web_user="mastodon"
mastodon_web_chdir="%%WWWDIR%%"
mastodon_web_env="RAILS_ENV=production \
PORT=3000 \
PATH=/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/sbin:%%PREFIX%%/bin:~/bin"
pidfile="/var/run/mastodon/${name##mastodon_}.pid"
ppidfile="/var/run/mastodon/${name##mastodon_}_supervisor.pid"
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/bundle"
procname_args="exec puma -C config/puma.rb"
command_args="-f -T ${name} -P ${ppidfile} -p ${pidfile} -S -r ${procname} ${procname_args}"
mastodon_web_prestart()
{
if [ ! -d "/var/run/mastodon" ]; then
install -d -o "${mastodon_web_user}" -g "${mastodon_web_user}" -m 750 "/var/run/mastodon"
fi
}
mastodon_web_stop()
{
/bin/kill -9 `cat ${ppidfile}`
/bin/kill -15 `cat ${pidfile}`
}
run_rc_command "$1"

View File

@ -0,0 +1,5 @@
--- .profile.orig 2022-12-06 11:15:00 UTC
+++ .profile
@@ -1 +1 @@
-LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/.apt/lib/x86_64-linux-gnu:/app/.apt/usr/lib/x86_64-linux-gnu/mesa:/app/.apt/usr/lib/x86_64-linux-gnu/pulseaudio
+export LC_ALL="en_US.UTF-8"

View File

@ -0,0 +1,46 @@
--- dist/nginx.conf.orig 2022-11-30 18:16:44 UTC
+++ dist/nginx.conf
@@ -17,31 +17,32 @@ server {
listen 80;
listen [::]:80;
server_name example.com;
- root /home/mastodon/live/public;
+ root %%PREFIX%%/www/mastodon/public;
location /.well-known/acme-challenge/ { allow all; }
location / { return 301 https://$host$request_uri; }
}
server {
- listen 443 ssl http2;
- listen [::]:443 ssl http2;
server_name example.com;
+ # Uncomment these lines once you acquire a certificate:
+ # listen 443 ssl http2;
+ # listen [::]:443 ssl http2;
- ssl_protocols TLSv1.2 TLSv1.3;
- ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
- ssl_prefer_server_ciphers on;
- ssl_session_cache shared:SSL:10m;
- ssl_session_tickets off;
+ # ssl_protocols TLSv1.2 TLSv1.3;
+ # ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
+ # ssl_prefer_server_ciphers on;
+ # ssl_session_cache shared:SSL:10m;
+ # ssl_session_tickets off;
# Uncomment these lines once you acquire a certificate:
- # ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
- # ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
+ # ssl_certificate %%PREFIX%%/etc/ssl/example.com/fullchain.pem;
+ # ssl_certificate_key %%PREFIX%%/etc/ssl/example.com/key.pem;
keepalive_timeout 70;
sendfile on;
client_max_body_size 80m;
- root /home/mastodon/live/public;
+ root %%PREFIX%%/www/mastodon/public;
gzip on;
gzip_disable "msie6";

View File

@ -0,0 +1,6 @@
Mastodon is an alternative implementation of GNU social, a free,
open-source social network. It is a decentralized alternative to
commercial platforms based on ActivityStreams, Webfinger, PubsubHubbub
and Salmon. The project focuses on creating a clean REST API and a good
user interface. Ruby on Rails is used for the back-end, while React.js
and Redux are used for the dynamic front-end.

View File

@ -0,0 +1,10 @@
[
{ type: install
message: <<EOM
############################################################
Visit this URL to get started with Mastodon.
https://wiki.freebsd.org/Ports/net-im/mastodon
############################################################
EOM
}
]