Skip to content

Commit

Permalink
Add initial set of ebuilds for Jitsi Meet on 64-bit Gentoo ^-^
Browse files Browse the repository at this point in the history
Covers the baseline component set (usrsctp, videobridge, jicofo, etc)
for amd64 (x86_64) and arm64 (aarch64). Maven ebuilds are from source,
leveraging the provided java-maven-pkg eclass / mvn2ebuild flow
(although note that essentially all _dependency_ libs are currently
still pulled in as pre-built jars from upstream; there's a huge chunk
of work needed to bring each of these into Portage).

Supports OpenRC and systemd; nginx (preferred) and apache webservers;
automated Let's Encrypt certificate issuance / renewal is integrated.

Also, provides a cross-component configuration process that follows
(broadly) upstream's debconf / postinst flow.

To install the full (server-side) complex, issue:
  emerge net-im/jitsi-meet-server

Then configure (using a debconf-style Q&A), via:
  emerge --config net-im/jitsi-meet-master-config

Once that's done, start up the server complex, by issuing:
  rc-service jitsi-meet-server start   # OpenRC, or
  systemctl start jitsi-meet-server    # systemd

Many thanks to the various contributors on
  jitsi/docker-jitsi-meet#195
for showing how to build the usrsctp component on arm64!
  • Loading branch information
sakaki- committed May 27, 2020
1 parent 06aec32 commit 7a5375e
Show file tree
Hide file tree
Showing 84 changed files with 13,252 additions and 0 deletions.
10 changes: 10 additions & 0 deletions acct-group/jitsi/jitsi-0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) 2020 sakaki <[email protected]>
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit acct-group

DESCRIPTION="A group for Jitsi services"
ACCT_GROUP_ID=377

12 changes: 12 additions & 0 deletions acct-group/jitsi/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>sakaki</name>
</maintainer>
<longdescription>
A group for Jitsi services
</longdescription>
</pkgmetadata>

15 changes: 15 additions & 0 deletions acct-user/jicofo/jicofo-0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2020 sakaki <[email protected]>
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit acct-user

DESCRIPTION="A user for JItsi COnference FOcus server"
ACCT_USER_ID=377
ACCT_USER_GROUPS=( jitsi )
ACCT_USER_HOME=/etc/jitsi/jicofo
ACCT_USER_HOME_PERMS=0750

acct-user_add_deps

12 changes: 12 additions & 0 deletions acct-user/jicofo/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>sakaki</name>
</maintainer>
<longdescription>
A user for JItsi COnference FOcus server
</longdescription>
</pkgmetadata>

15 changes: 15 additions & 0 deletions acct-user/jvb/jvb-0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2020 sakaki <[email protected]>
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit acct-user

DESCRIPTION="A user for Jitsi Videobridge SFU"
ACCT_USER_ID=376
ACCT_USER_GROUPS=( jitsi )
ACCT_USER_HOME=/etc/jitsi/videobridge
ACCT_USER_HOME_PERMS=0750

acct-user_add_deps

12 changes: 12 additions & 0 deletions acct-user/jvb/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>sakaki</name>
</maintainer>
<longdescription>
A user for Jitsi Videobridge SFU
</longdescription>
</pkgmetadata>

112 changes: 112 additions & 0 deletions app-portage/mvn2ebuild/files/mvn2ebuild-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/bash
#
# Run in the top-level of a Maven project (once you have it
# building correctly) in place of the "mvn" command, and
# a 'starter' ebuild, using java-maven-pkg, will be
# emitted to stdout (all other output is to stderr).
#
# Copyright (c) 2020 sakaki <[email protected]>
# License: GPL v3+
# NO WARRANTY


T="$(mktemp -d)"
D="${T##*/}"

if [[ -z ${@} ]]; then
EMAVEN_PARAMS="-DskipTests -Dassembly.skipAssembly=false clean package install -f pom.xml"
else
EMAVEN_PARAMS="${@}"
fi
if [[ $(uname -m) == "aarch64" ]]; then
EMAVEN_PARAMS+=" -Dos.detected.name=linux -Dos.detected.arch=aarch_64 -Dos.detected.classifier=linux-aarch_64"
else
EMAVEN_PARAMS+=" -Dos.detected.name=linux -Dos.detected.arch=x86_64 -Dos.detected.classifier=linux-x86_64"
fi
EMAVEN_PARAMS+=" --batch-mode -Dmaven.repo.local=${T}"

GIT_ECLASS=""
GIT_DEFBLOCK=""

# are we in a git repo?
if GIT_COMMIT="$(git rev-parse HEAD)" 2>/dev/null; then
GIT_ECLASS=" git-r3"
GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
GIT_REMOTE_URL="$(git remote get-url origin)"
GIT_DEFBLOCK="
EGIT_REPO_URI=\"${GIT_REMOTE_URL%.git}.git\"
EGIT_BRANCH=\"${GIT_BRANCH}\"
EGIT_COMMIT=\"${GIT_COMMIT}\"
"
fi

echo "Running Maven: all output to stderr..." >&2
echo "Params: ${EMAVEN_PARAMS}" >&2

EMAVEN_VENDOR_DEFS="$(mvn ${EMAVEN_PARAMS} |& tee /dev/fd/2 | \
grep 'Downloaded' | \
grep -o 'https[^[:space:]]*' | sort | uniq | \
sed -r 's/^/\t"/g;s/$/"/g;s#(releases|maven2)/+#\1 #g;s#/(org|com|net)/# \1/#g')"

rm -rf "/tmp/${D}"

echo "Ouputting skeleton ebuild to stdout..." >&2

cat <<EOF
# Copyright 2020 <yourname> (<[email protected]>)
# Distributed under the terms of the GNU General Public License v2
EAPI=7
JAVA_PKG_IUSE=""
inherit unpacker java-pkg-2 java-maven-pkg${GIT_ECLASS}
DESCRIPTION=""
SRC_URI=""
HOMEPAGE=""
RESTRICT="mirror"
JAVA_PKG_NO_CLEAN=1
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE=""
${GIT_DEFBLOCK}
CP_DEPEND="
"
CDEPEND="
"
DEPEND="
\${CP_DEPEND}
\${CDEPEND}
"
RDEPEND="
\${CP_DEPEND}
\${CDEPEND}
>=virtual/jre-1.8
"
BDEPEND="
\${CP_DEPEND}
\${CDEPEND}
>=virtual/jdk-1.8
"
JAVA_GENTOO_CLASSPATH=""
JAVA_GENTOO_CLASSPATH_EXTRA=""
EMAVEN_VENDOR=(
${EMAVEN_VENDOR_DEFS}
)
setup_maven_src_uri
PATCHES=(
)
EMAVEN_PARAMS+=""
#EMAVEN_INSTALL_JAR_FROM=""
#EMAVEN_INSTALL_JAR_TO=""
EOF
93 changes: 93 additions & 0 deletions app-portage/mvn2ebuild/files/mvn2ebuild.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
.nh
.TH MVN2EBUILD 1 "Version 1.0.0: May 2020"
.SH NAME
.PP
mvn2ebuild \- create a starter ebuild for a Maven project

.SH SYNOPSIS
.PP
\fB\fCmvn2ebuild\fR [\fIMVN\_OPTIONS\fP]

.SH DESCRIPTION
.PP
\fB\fCmvn2ebuild\fR is a simple script that can be used to create a 'starter'
ebuild from a (working) Maven Java project. It is invoked in place
of \fB\fCmvn\fR, in the top level directory, passing any options that
would normally be given to \fB\fCmvn\fR (\fB\fC\-DskipTests\fR etc.)

.PP
The resulting ebuild is emitted to stdout; any other messages are
sent to stderr.

.PP
The (usually long) list of URLs of all the jars, poms,
etc that are required to be present in the Maven
cache, in order to build and run the project, will be explicitly
captured in the \fIEMAVEN\_VENDOR\fP array in the resulting ebuild
(transformed into the correct format for use
by the \fB\fCjava\-mavan\-pkg\fR eclass, which it inherits).

.PP
This, in turn, allows for the construction (via the eclass) of
an 'on\-the\-fly' Maven cache during the
ebuild's \fB\fCsrc\_prepare()\fR phase, sufficient to allow the rest of
the build to proceed without needing to hit the network at all
(necessary, if it is to run properly inside the \fB\fCportage\fR(5) sandbox).

.PP
You will almost certainly need to provide further functionality to
the resulting ebuild, before it is ready for deployment.

.SH OPTIONS
.PP
\fB\fC[MVN\_OPTIONS]\fR
Pass any options to \fB\fCmvn2ebuild\fR that you normally would to your
(working) \fB\fCmvn\fR clean build invocation. By default (if nothing is passed)
the following 'equivalent' Maven invocation will be assumed:
\fB\fCmvn \-DskipTests \-Dassembly.skipAssembly=false clean package install \-f pom.xml\fR
Note that \fB\fCmvn2ebuild\fR also passes
\fB\fC\-Dos.detected.{name,os,classifier}\fR parameters, to ensure these
are set correctly.

.SH ALGORITHM
.PP
The script works by invoking \fB\fCmvn\fR with a temporary cache that is
initially empty, and then recording all files downloaded, using these
to populate the \fIEMAVEN\_VENDOR\fP array in the ebuild.

.PP
If invoked inside a \fB\fCgit\fR(1) repository, \fB\fCmvn2ebuild\fR will
automatically inherit the \fB\fCgit\-r3\fR eclass in the ebuild, and
set \fIEGIT\_REPO\_URI\fP, \fIEGIT\_BRANCH\fP and \fIEGIT\_COMMIT\fP appropriately.

.SH BUGS
.PP
This is a very simple script, so many edge cases exist that can fool
it. For example, if you pass some build options, but omit \fB\fCclean\fR, then
the resulting \fIEMAVEN\_VENDOR\fP may be incomplete. The parsing out of
Maven coordinates from captured URLs is primitive and may not work
in certain cases. No attempt to create e.g. appropriate \fB\fCsrc\_install()\fR
functions for zipped assemblies (etc.) is attempted (you need to roll
your own install in such a case, but that is not particularly difficult).

.SH COPYRIGHT
.PP
Copyright © 2020 sakaki

.PP
License GPLv3+ (GNU GPL version 3 or later)
http://gnu.org/licenses/gpl.html
\[la]http://gnu.org/licenses/gpl.html\[ra]

.PP
This is free software, you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

.SH AUTHOR
.PP
sakaki — send bug reports or comments to [email protected]
\[la]mailto:[email protected]\[ra]

.SH SEE ALSO
.PP
\fB\fCebuild\fR(5), \fB\fCgit\fR(1), \fB\fCportage\fR(5)
101 changes: 101 additions & 0 deletions app-portage/mvn2ebuild/files/mvn2ebuild.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
MVN2EBUILD 1 "Version 1.0.0: May 2020"
======================================

[//]: # ( Convert to manpage using e.g. go-md2man -in=mvn2ebuild.md -out=mvn2ebuild.1 )

NAME
----

mvn2ebuild - create a starter ebuild for a Maven project

SYNOPSIS
--------

`mvn2ebuild` [*MVN_OPTIONS*]

DESCRIPTION
-----------

`mvn2ebuild` is a simple script that can be used to create a 'starter'
ebuild from a (working) Maven Java project. It is invoked in place
of `mvn`, in the top level directory, passing any options that
would normally be given to `mvn` (`-DskipTests` etc.)

The resulting ebuild is emitted to stdout; any other messages are
sent to stderr.

The (usually long) list of URLs of all the jars, poms,
etc that are required to be present in the Maven
cache, in order to build and run the project, will be explicitly
captured in the *EMAVEN_VENDOR* array in the resulting ebuild
(transformed into the correct format for use
by the `java-mavan-pkg` eclass, which it inherits).

This, in turn, allows for the construction (via the eclass) of
an 'on-the-fly' Maven cache during the
ebuild's `src_prepare()` phase, sufficient to allow the rest of
the build to proceed without needing to hit the network at all
(necessary, if it is to run properly inside the `portage`(5) sandbox).

You will almost certainly need to provide further functionality to
the resulting ebuild, before it is ready for deployment.

OPTIONS
-------

`[MVN_OPTIONS]`
Pass any options to `mvn2ebuild` that you normally would to your
(working) `mvn` clean build invocation. By default (if nothing is passed)
the following 'equivalent' Maven invocation will be assumed:
`mvn -DskipTests -Dassembly.skipAssembly=false clean package install -f pom.xml`
Note that `mvn2ebuild` also passes
`-Dos.detected.{name,os,classifier}` parameters, to ensure these
are set correctly.


ALGORITHM
---------

The script works by invoking `mvn` with a temporary cache that is
initially empty, and then recording all files downloaded, using these
to populate the *EMAVEN_VENDOR* array in the ebuild.

If invoked inside a `git`(1) repository, `mvn2ebuild` will
automatically inherit the `git-r3` eclass in the ebuild, and
set *EGIT_REPO_URI*, *EGIT_BRANCH* and *EGIT_COMMIT* appropriately.


BUGS
----

This is a very simple script, so many edge cases exist that can fool
it. For example, if you pass some build options, but omit `clean`, then
the resulting *EMAVEN_VENDOR* may be incomplete. The parsing out of
Maven coordinates from captured URLs is primitive and may not work
in certain cases. No attempt to create e.g. appropriate `src_install()`
functions for zipped assemblies (etc.) is attempted (you need to roll
your own install in such a case, but that is not particularly difficult).


COPYRIGHT
---------

Copyright © 2020 sakaki

License GPLv3+ (GNU GPL version 3 or later)
<http://gnu.org/licenses/gpl.html>

This is free software, you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


AUTHOR
------

sakaki — send bug reports or comments to <[email protected]>


SEE ALSO
--------

`ebuild`(5), `git`(1), `portage`(5)
Loading

0 comments on commit 7a5375e

Please sign in to comment.