aboutsummaryrefslogtreecommitdiffstats
path: root/testing/homer-app
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2020-03-13 10:41:04 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2020-03-13 10:46:37 +0000
commit118b6e59f5c23587d577d559b6e5cc11e0ae7df2 (patch)
tree02f04ecc5950137cb4083bfc5c50fb469d92888c /testing/homer-app
parent4258b0d6e39a811e7fd880fe111563974715273a (diff)
downloadaports-118b6e59f5c23587d577d559b6e5cc11e0ae7df2.tar.bz2
aports-118b6e59f5c23587d577d559b6e5cc11e0ae7df2.tar.xz
testing/homer-app: new aport
This is the new HOMER 7.x application completely rewritten. Does not replace the current HOMER 5.x package (community/homer-ui).
Diffstat (limited to 'testing/homer-app')
-rw-r--r--testing/homer-app/APKBUILD46
-rw-r--r--testing/homer-app/change-default-locations.patch50
-rw-r--r--testing/homer-app/homer-app.initd18
-rw-r--r--testing/homer-app/homer-app.pre-install5
-rw-r--r--testing/homer-app/initial-setup55
5 files changed, 174 insertions, 0 deletions
diff --git a/testing/homer-app/APKBUILD b/testing/homer-app/APKBUILD
new file mode 100644
index 0000000000..7a79a45947
--- /dev/null
+++ b/testing/homer-app/APKBUILD
@@ -0,0 +1,46 @@
+# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
+pkgname=homer-app
+pkgver=1.1.35
+_uiver=7.7.031
+pkgrel=0
+pkgdesc="HOMER 7.x Front-End and API Server"
+url="http://sipcapture.io"
+arch="all"
+license="AGPL-3.0-or-later"
+makedepends="go"
+install="$pkgname.pre-install"
+subpackages="$pkgname-doc $pkgname-openrc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/sipcapture/homer-app/archive/$pkgver.tar.gz
+ https://github.com/sipcapture/homer-app/releases/download/$pkgver/homer-ui-$_uiver.tgz
+ $pkgname.initd
+ change-default-locations.patch
+ initial-setup
+ "
+
+build() {
+ make modules
+ make all
+}
+
+check() {
+ release/homer-app_linux_amd64/homer-app --version
+}
+
+package() {
+ install -D -m755 release/homer-app_linux_amd64/homer-app "$pkgdir"/usr/bin/homer-app
+ install -D -m644 etc/webapp_config.json "$pkgdir"/etc/homer/webapp_config.json
+ install -m755 "$srcdir"/initial-setup "$pkgdir"/etc/homer/initial-setup
+ mkdir -p "$pkgdir"/usr/share/webapps/homer \
+ "$pkgdir"/var/log/homer \
+ "$pkgdir"/usr/share/licenses/$pkgname
+ mv "$srcdir"/dist/3rdpartylicenses.txt \
+ "$pkgdir"/usr/share/licenses/$pkgname/3rdpartylicenses.txt
+ mv "$srcdir"/dist "$pkgdir"/usr/share/webapps/homer
+ install -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+}
+
+sha512sums="49bafa645c2f4c4d9099973b51dd7a279f183afadd7e4509a4ce946a57888821af71e295f82823c22e360638865f07827692603331202cf032d37f8ac93e8fa3 homer-app-1.1.35.tar.gz
+c4ddb57afaf073f5c1473e46536b7219fdba10f7deb253d8b0f972e3662f07423272860f93a5550a08c0e64688d3e54a729ee0f6fac0fe3d7a6749f90029e0ab homer-ui-7.7.031.tgz
+4a076f557dc3e3deac2ab24f63e08728dec58ca9ab7fe173e3947c51578713e6dca22c7c3713f32de88061f58c8ad798188324c09e1c6ddccf846ed76eb285c1 homer-app.initd
+0f27c5b357aa321e60cf9a5f754b79e7e8a1d430cb355dce52d3c79e40d2873c5d6fa97f548e98a78fb836930b0ab2f28ed1a82680dad4e11a436ec9ed56ca26 change-default-locations.patch
+5339905a793d210b4ecd477f129fb60a15f7d6fd144fc6f12753eb70172f5bd29765c1f0b9bbe08bed3b27da26c7ad190efd7bb8244a40f036265055a711f7a6 initial-setup"
diff --git a/testing/homer-app/change-default-locations.patch b/testing/homer-app/change-default-locations.patch
new file mode 100644
index 0000000000..536fdf9b00
--- /dev/null
+++ b/testing/homer-app/change-default-locations.patch
@@ -0,0 +1,50 @@
+diff --git a/etc/webapp_config.json b/etc/webapp_config.json
+index 505a02f..93d576e 100644
+--- a/etc/webapp_config.json
++++ b/etc/webapp_config.json
+@@ -45,14 +45,14 @@
+ "help": "Settings for the HOMER Webapp Server. If you have gzip_static = false, please be sure that your dist directory has uncompressed .js files",
+ "host": "0.0.0.0",
+ "port" : 9080,
+- "root" : "/usr/local/homer/dist",
++ "root" : "/usr/share/webapps/homer/dist",
+ "gzip" : true,
+ "gzip_static" : true,
+ "debug" : false
+ },
+ "system_settings": {
+ "help": "Settings for HOMER logs",
+- "logpath": "/usr/local/homer/log",
++ "logpath": "/var/log/homer",
+ "logname" : "homer-app.log",
+ "_loglevels": "can be: fatal, error, warn, info, debug, trace",
+ "loglevel": "error",
+@@ -86,4 +86,4 @@
+ "bin": "/usr/bin/tshark",
+ "protocols": ["1_call","1_registration", "1_default"]
+ }
+-}
+\ No newline at end of file
++}
+diff --git a/main.go b/main.go
+index ede7b44..5e7a3d5 100644
+--- a/main.go
++++ b/main.go
+@@ -169,7 +169,7 @@ func initFlags() {
+ appFlags.DatabaseHomerConfig = flag.String("database-homer-config", "homer_config", "database-homer-config")
+ appFlags.DatabaseHomerData = flag.String("database-homer-data", "homer_data", "database-homer-data")
+
+- appFlags.PathWebAppConfig = flag.String("webapp-config-path", "/usr/local/homer/etc", "the path to the webapp config file")
++ appFlags.PathWebAppConfig = flag.String("webapp-config-path", "/etc/homer", "the path to the webapp config file")
+ appFlags.LogName = flag.String("webapp-log-name", "", "the name prefix of the log file.")
+ appFlags.LogPathWebApp = flag.String("webapp-log-path", "", "the path for the log file.")
+
+@@ -346,7 +346,7 @@ func configureAsHTTPServer() {
+ /* static */
+ rootPath := viper.GetString("http_settings.root")
+ if rootPath == "" {
+- rootPath = "/usr/local/homer/dist"
++ rootPath = "/usr/share/webapps/homer/dist"
+ }
+ /* static */
+ e.Use(middleware.Static(rootPath))
diff --git a/testing/homer-app/homer-app.initd b/testing/homer-app/homer-app.initd
new file mode 100644
index 0000000000..175b7c456c
--- /dev/null
+++ b/testing/homer-app/homer-app.initd
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+
+description="HOMER App and UI"
+supervisor=supervise-daemon
+command=/usr/bin/homer-app
+command_args="-webapp-config-path=/etc/homer -webapp-log-path /var/log/homer"
+command_user=homer
+command_group=homer
+pidfile="/run/homer/${RC_SVCNAME}.pid"
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath --directory --owner $command_user:$command_group ${pidfile%/*} /var/log/homer
+}
diff --git a/testing/homer-app/homer-app.pre-install b/testing/homer-app/homer-app.pre-install
new file mode 100644
index 0000000000..aa6784b877
--- /dev/null
+++ b/testing/homer-app/homer-app.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S homer &>/dev/null
+adduser -S -G homer -s /sbin/nologin -D homer &>/dev/null
+exit 0
diff --git a/testing/homer-app/initial-setup b/testing/homer-app/initial-setup
new file mode 100644
index 0000000000..40fa27886a
--- /dev/null
+++ b/testing/homer-app/initial-setup
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Alpine Linux HOMER setup
+
+echo
+read -p "Did you customize /etc/homer/webapp_config.json before running this setup (y/n)? " answer
+
+test "$answer" = "y" || exit 1
+
+# Create user
+/usr/bin/homer-app \
+ -webapp-config-path=/etc/homer \
+ -create-homer-user \
+ -database-root=postgres \
+ -database-root-user=postgres \
+ -database-host=localhost
+
+# Create config and data DBs
+/usr/bin/homer-app \
+ -webapp-config-path=/etc/homer \
+ -create-config-db \
+ -database-root=postgres \
+ -database-root-user=postgres \
+ -database-host=localhost \
+ -database-homer-user=homer_user
+
+/usr/bin/homer-app \
+ -webapp-config-path=/etc/homer \
+ -create-data-db \
+ -database-root=postgres \
+ -database-root-user=postgres \
+ -database-host=localhost \
+ -database-root-password=postgres \
+ -database-homer-user=homer_user
+
+# Create role
+/usr/bin/homer-app \
+ -webapp-config-path=/etc/homer \
+ -create-homer-role \
+ -database-root=postgres \
+ -database-root-user=postgres \
+ -database-host=localhost \
+ -database-root-password=postgres \
+ -database-homer-data=homer_data \
+ -database-homer-config=homer_config
+
+# Populate connection data from webapp_config
+/usr/bin/homer-app \
+ -webapp-config-path=/etc/homer \
+ -create-table-db-config
+
+# Populate DB
+/usr/bin/homer-app \
+ -webapp-config-path=/etc/homer \
+ -populate-table-db-config
+