diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..0c91543b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,80 @@ +name: Deployer + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - uses: actions/checkout@v2 + with: + path: multiparty-meeting + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: | + sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install jq npm build-essential || true + cd multiparty-meeting + cp server/config/config.example.js server/config/config.js + cp app/public/config/config.example.js app/public/config/config.js + cd app + npm install + npm run build + cd ../server + cat <<< $(jq '.bundleDependencies += .dependencies' package.json) > package.json + npm install + npm pack + VERSION=$(cat package.json | jq -r '.version') + DATE=$(date) + mkdir -p /home/runner/package + cd /home/runner/package + mkdir DEBIAN + mkdir -p usr/local/src/multiparty-meeting/server + mkdir -p etc/systemd/system/ + tar -xf /home/runner/work/***/***/***/server/***-server-$VERSION.tgz package/ 1>/dev/null 2>/dev/null || true + mv package/* usr/local/src/multiparty-meeting/server/ + mv /home/runner/work/***/***/***/*.service etc/systemd/system/ + rm -rf package + touch DEBIAN/md5sums + touch DEBIAN/md5sums + touch DEBIAN/control + find . -type f ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' -printf '%P ' | xargs md5sum 1>/dev/null 2>/dev/null || true + echo """Package: multiparty-meeting + Version: $VERSION + Maintainer: Mert CELEN + Section: admin + Date : $DATE + Architecture: amd64 + Priority: important + Description: Multiparty web-meetings using mediasoup and WebRTC + Depends: nodejs (>= 12), redis + """ > DEBIAN/control + echo """#!/bin/bash + mkdir -p /etc/meeting/ + ln -s /usr/local/src/multiparty-meeting/server/config/config.js /etc/meeting/server-config.js || true + ln -s /usr/local/src/multiparty-meeting/server/public/config/config.js /etc/meeting/client-config.js || true + systemctl daemon-reload + systemctl enable multiparty-meeting + echo "Multiparty Meeting is installed, but you need the configure the server and client with your ip adresses in configuration files under /etc/meeting/ \n" + echo "\n\nAfter the configuration, you can start service with 'sudo systemctl start multiparty-meeting' command.\n\n" + """ > DEBIAN/postinst + chmod 775 DEBIAN/postinst + cd ../ + dpkg-deb -Zgzip --build package + mv /home/runner/package.deb /home/runner/multiparty-meeting.deb + - name : Release Package + uses: actions/upload-artifact@v1 + with: + name: multiparty-meeting + path: "/home/runner/multiparty-meeting.deb" diff --git a/rpm/multiparty-meeting.service b/rpm/multiparty-meeting.service new file mode 100644 index 00000000..f02f0217 --- /dev/null +++ b/rpm/multiparty-meeting.service @@ -0,0 +1,19 @@ +[Unit] +Description=multiparty-meeting is a audio / video meeting service running in the browser and powered by webRTC +After=network.target + +[Service] +EnvironmentFile=-/etc/sysconfig/multiparty-meeting +ExecStart=/opt/multiparty-meeting/server/server.js +Restart=always +User=mm +Group=mm +WorkingDirectory=/opt/multiparty-meeting/server +AmbientCapabilities=CAP_NET_BIND_SERVICE +ProtectSystem=full +ProtectHome=true +NoNewPrivileges=true +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/rpm/multiparty-meeting.spec b/rpm/multiparty-meeting.spec new file mode 100644 index 00000000..c9123286 --- /dev/null +++ b/rpm/multiparty-meeting.spec @@ -0,0 +1,149 @@ +# Disables debug package +%global debug_package %{nil} + +%global __brp_mangle_shebangs /bin/true + +%define commit effdd3005b9641d1d503d70af064eab0a9c550a8 +%define shortcommit %(c=%{commit}; echo ${c:0:7}) +%define _date %(date +'%%Y%%m%%dT%%H%%M%%S') +%define _release 1 + +Name: multiparty-meeting +Version: 3.2.1 +License: MIT +Summary: Multiparty web-meetings using mediasoup and WebRTC +URL: https://github.com/havfo/multiparty-meeting +%if 0%{?commit:1} +Release: %{_release}.git%{shortcommit}.%{_date}%{?dist} +Source0: %{url}/archive/%{commit}.tar.gz +%else +Release: %{_release}%{?dist} +Source0: %{url}/archive/%{version}.tar.gz +%endif +Source1: %{name}.service +Source2: %{name}.sysconfig + +ExclusiveArch: %{nodejs_arches} noarch + +BuildRequires: systemd +BuildRequires: nodejs-packaging +BuildRequires: nodejs >= 10 +BuildRequires: npm +BuildRequires: yarn +BuildRequires: python3-devel +BuildRequires: openssl-devel +BuildRequires: redis-devel +Requires: nodejs >= 10 +Requires: redis + +Requires(post): policycoreutils +Requires(post): policycoreutils-python-utils +Requires(postun): policycoreutils + +%global appdir /opt/%{name} + +%description +%summary + +%prep +%if 0%{?commit:1} +%autosetup -p1 -n %{name}-%{commit} +cd .. +# Rename the directory to just the name, adding the commit hash makes make error out due +# to too long path names. +mv "%{name}-%{commit}" ./"%{name}" +ln -snf %{name} %{name}-%{commit} +%else +%autosetup -p1 -n %{name}-%{version} +%endif + +%build +export CXXFLAGS="%{optflags}" +export PYTHON=%{__python3} +export PYTHON3=%{__python3} +export NODE_ENV=production + +cd app +npm install +npm install classnames +npm run build +cd - +mkdir -p server/public +cd server +npm install +cd - + +rm -rf server/node_modules/clang-tools-prebuilt + +find server/node_modules/mediasoup \ +\( \ + -name samples -or \ + -name src -or \ + -name test -or \ + -name deps -or \ + -name '*.a' -or \ + -name .deps -or \ + -name include -or \ + -name obj.target \ +\) -a -print0 \ +| xargs -0 rm -rf + +for i in $(find -iname '*.py') +do + sed -i -r \ + -e 's:(/usr)?/bin/(env )?python([0-9]+([.][0-9]+)?)?:%{__python3}:g' \ + ${i} +done + +%install +install -d %{buildroot}%{appdir} +install -d %{buildroot}%{_docdir}/%{name} +install -d %{buildroot}%{_sysconfdir}/%{name} + +install -Dpm 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service +install -Dpm 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name} + +cp -R . %{buildroot}%{appdir}/ +cp -R LTI munin %{buildroot}%{_docdir}/%{name} +rm -f \ + %{buildroot}%{appdir}%{name}.service \ + %{buildroot}%{appdir}/*.md \ + %{buildroot}%{appdir}/.gitignore +rm -rf \ + %{buildroot}%{appdir}/app \ + %{buildroot}%{appdir}/LTI \ + %{buildroot}%{appdir}/munin +mv %{buildroot}%{appdir}/server/config/config.example.js %{buildroot}%{_sysconfdir}/%{name}/config.js +mv %{buildroot}%{appdir}/server/public/config/config.example.js %{buildroot}%{_sysconfdir}/%{name}/app-config.js +ln -snf %{_sysconfdir}/%{name}/config.js %{buildroot}%{appdir}/server/config/config.js +ln -snf %{_sysconfdir}/%{name}/app-config.js %{buildroot}%{appdir}/server/public/config/config.js + +%pre +getent group mm > /dev/null || groupadd -r mm +getent passwd mm > /dev/null || \ + useradd -r -d %{_sharedstatedir}/mm -g mm \ + -s /sbin/nologin -c "%{name} service user" mm +exit 0 + +%post +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%doc CHANGELOG.md README.md HAproxy.md server/config/config.example.js +%{appdir} +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%config(noreplace) %{_sysconfdir}/%{name}/config.js +%config(noreplace) %{_sysconfdir}/%{name}/app-config.js +%{_unitdir}/%{name}.service +%{_docdir}/%{name}/LTI +%{_docdir}/%{name}/munin + +%changelog +* Mon Apr 20 2020 fuero - 3.2.1-1 +- initial package diff --git a/rpm/multiparty-meeting.sysconfig b/rpm/multiparty-meeting.sysconfig new file mode 100644 index 00000000..afe5f380 --- /dev/null +++ b/rpm/multiparty-meeting.sysconfig @@ -0,0 +1,2 @@ +DEBUG= +NODE_ENV=production