From f9b8d4f24386b6d6ea5e7c2051bf80fee42e86af Mon Sep 17 00:00:00 2001 From: William Petit Date: Thu, 2 Mar 2023 16:56:58 +0100 Subject: [PATCH] fix(packaging): create required directories + improve alpine service startup --- .goreleaser.yaml | 12 ++++++++++++ go.mod | 2 +- misc/packaging/openrc/emissary-agent.openrc.sh | 5 +++-- misc/packaging/openrc/emissary-server.openrc.sh | 9 +++++++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 18db002..48594bd 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -101,6 +101,18 @@ nfpms: file_info: mode: 0755 packager: apk + - dst: /var/lib/emissary + type: dir + file_info: + mode: 0700 + - dst: /usr/share/emissary + type: dir + file_info: + mode: 0700 + - dst: /var/log/emissary + type: dir + file_info: + mode: 0700 scripts: postinstall: "misc/packaging/common/postinstall-server.sh" - id: emissary-agent diff --git a/go.mod b/go.mod index ce9172d..aa9e274 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/golang-migrate/migrate/v4 v4.15.2 github.com/jackc/pgx/v5 v5.2.0 github.com/jedib0t/go-pretty/v6 v6.4.4 + github.com/lestrrat-go/jwx/v2 v2.0.8 github.com/mitchellh/mapstructure v1.5.0 github.com/pkg/errors v0.9.1 github.com/qri-io/jsonschema v0.2.1 @@ -50,7 +51,6 @@ require ( github.com/lestrrat-go/httpcc v1.0.1 // indirect github.com/lestrrat-go/httprc v1.0.4 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect - github.com/lestrrat-go/jwx/v2 v2.0.8 // indirect github.com/lestrrat-go/option v1.0.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect diff --git a/misc/packaging/openrc/emissary-agent.openrc.sh b/misc/packaging/openrc/emissary-agent.openrc.sh index 8014cfa..e53d310 100644 --- a/misc/packaging/openrc/emissary-agent.openrc.sh +++ b/misc/packaging/openrc/emissary-agent.openrc.sh @@ -1,9 +1,10 @@ #!/sbin/openrc-run command="/usr/bin/emissary" -command_args="--config /etc/emissary/config.yml agent run" -start_stop_daemon_args='--chdir /usr/share/emissary' +command_args="--workdir /usr/share/emissary --config /etc/emissary/agent.yml agent run" supervisor=supervise-daemon +output_log="/var/log/emissary/agent.log" +error_log="$output_log" depend() { need net diff --git a/misc/packaging/openrc/emissary-server.openrc.sh b/misc/packaging/openrc/emissary-server.openrc.sh index 9ab76f7..4624936 100644 --- a/misc/packaging/openrc/emissary-server.openrc.sh +++ b/misc/packaging/openrc/emissary-server.openrc.sh @@ -1,9 +1,14 @@ #!/sbin/openrc-run command="/usr/bin/emissary" -command_args="--config /etc/emissary/config.yml server run" -start_stop_daemon_args='--chdir /usr/share/emissary' +command_args="--workdir /usr/share/emissary --config /etc/emissary/server.yml server run" supervisor=supervise-daemon +output_log="/var/log/emissary/server.log" +error_log="$output_log" + +start_pre() { + /usr/bin/emissary --workdir /usr/share/emissary --config /etc/emissary/server.yml server database migrate +} depend() { need net