Add service and other setup files
This commit is contained in:
parent
6fb6a0d635
commit
568cbf4980
10
.SRCINFO
10
.SRCINFO
@ -7,6 +7,16 @@ pkgbase = pgweb
|
||||
license = MIT
|
||||
makedepends = go
|
||||
source = pgweb::git+https://gitea.balki.me/balki/pgweb#branch=anyhttp
|
||||
source = bookmarks-example.toml
|
||||
source = pgweb.service
|
||||
source = pgweb.socket
|
||||
source = pgweb.sysusers
|
||||
source = pgweb.tmpfiles
|
||||
sha256sums = SKIP
|
||||
sha256sums = d19da3e2a7a1f4d35abf0992563792a51bf1a22074345d7a7c7de9f2209b21da
|
||||
sha256sums = 38fe5b4af46ea97f00780b36a73976b325574352e6005ac524921ff3acd784bd
|
||||
sha256sums = 8f2bd788a7f64ebe3d0f1b87d8da2eaee884dba96593c2f85883a5eb91a8b9e4
|
||||
sha256sums = 1d5a0bf82a1c1a9f260252a3a1d09333150c78a5c830fb04ca24f331062a9767
|
||||
sha256sums = c11001ac35239b2a8be38d831ce62c67624df0ce5ed894850d129627b1eaa408
|
||||
|
||||
pkgname = pgweb
|
||||
|
51
PKGBUILD
51
PKGBUILD
@ -6,31 +6,50 @@ arch=('x86_64')
|
||||
license=('MIT')
|
||||
makedepends=('go')
|
||||
url="https://gitea.balki.me/balki/$pkgname"
|
||||
source=("$pkgname::git+$url#branch=anyhttp")
|
||||
source=("$pkgname::git+$url#branch=anyhttp"
|
||||
bookmarks-example.toml
|
||||
pgweb.service
|
||||
pgweb.socket
|
||||
pgweb.sysusers
|
||||
pgweb.tmpfiles
|
||||
)
|
||||
sha256sums=('SKIP'
|
||||
'd19da3e2a7a1f4d35abf0992563792a51bf1a22074345d7a7c7de9f2209b21da'
|
||||
'38fe5b4af46ea97f00780b36a73976b325574352e6005ac524921ff3acd784bd'
|
||||
'8f2bd788a7f64ebe3d0f1b87d8da2eaee884dba96593c2f85883a5eb91a8b9e4'
|
||||
'1d5a0bf82a1c1a9f260252a3a1d09333150c78a5c830fb04ca24f331062a9767'
|
||||
'c11001ac35239b2a8be38d831ce62c67624df0ce5ed894850d129627b1eaa408')
|
||||
|
||||
prepare(){
|
||||
cd "$pkgname"
|
||||
mkdir -p build/
|
||||
prepare() {
|
||||
cd "$pkgname"
|
||||
mkdir -p build/
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$pkgname"
|
||||
export CGO_CPPFLAGS="${CPPFLAGS}"
|
||||
export CGO_CFLAGS="${CFLAGS}"
|
||||
export CGO_CXXFLAGS="${CXXFLAGS}"
|
||||
export CGO_LDFLAGS="${LDFLAGS}"
|
||||
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
|
||||
go build -o build
|
||||
cd "$pkgname"
|
||||
export CGO_CPPFLAGS="${CPPFLAGS}"
|
||||
export CGO_CFLAGS="${CFLAGS}"
|
||||
export CGO_CXXFLAGS="${CXXFLAGS}"
|
||||
export CGO_LDFLAGS="${LDFLAGS}"
|
||||
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
|
||||
go build -o build
|
||||
}
|
||||
|
||||
check() {
|
||||
cd "$pkgname"
|
||||
# go test ./...
|
||||
cd "$pkgname"
|
||||
# tests depend on createdb command to be present
|
||||
# go test ./...
|
||||
true
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$pkgname"
|
||||
install -Dm755 build/$pkgname "$pkgdir"/usr/bin/$pkgname
|
||||
cd "$pkgname"
|
||||
install -Dm 755 build/$pkgname "${pkgdir}/usr/bin/$pkgname"
|
||||
install -Dm 644 LICENSE "${pkgdir}/usr/share/doc/pgweb/LICENSE"
|
||||
install -Dm 644 README.md "${pkgdir}/usr/share/doc/pgweb/README.md"
|
||||
install -Dm 644 "${srcdir}/pgweb.service" "${pkgdir}/usr/lib/systemd/system/pgweb.service"
|
||||
install -Dm 644 "${srcdir}/pgweb.socket" "${pkgdir}/usr/lib/systemd/system/pgweb.socket"
|
||||
install -Dm 644 "${srcdir}/bookmarks-example.toml" "${pkgdir}/usr/share/doc/pgweb/bookmarks-example.toml"
|
||||
install -Dm 644 "${srcdir}/pgweb.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/pgweb.conf"
|
||||
install -Dm 644 "${srcdir}/pgweb.sysusers" "${pkgdir}/usr/lib/sysusers.d/pgweb.conf"
|
||||
}
|
||||
sha256sums=('SKIP')
|
||||
|
29
bookmarks-example.toml
Normal file
29
bookmarks-example.toml
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
## See: https://github.com/sosedoff/pgweb/wiki/Server-Connection-Bookmarks
|
||||
|
||||
|
||||
## Example 1: local-server.toml
|
||||
|
||||
host = "localhost"
|
||||
port = 5432
|
||||
user = "postgres"
|
||||
database = "mydatabase"
|
||||
sslmode = "disable"
|
||||
|
||||
## Example 2: ssh-tunnel-to-db.toml
|
||||
|
||||
# host = "rds-db-name.cluster-asdf.us-east-1.rds.amazonaws.com"
|
||||
# port = 5432
|
||||
# user = "rds-username"
|
||||
# password = "rds-password"
|
||||
# database = "rds-database-name"
|
||||
#
|
||||
# [SSH]
|
||||
# host = "ec2-111-111-111-111.compute-1.amazonaws.com"
|
||||
# user = "ec2-user"
|
||||
# key = "/path/to/key-file"
|
||||
# key_password = "key-file-password"
|
||||
|
||||
## Example 3: just-url.toml
|
||||
|
||||
# url = "postgres://user:password@host:port/database?sslmode=mode"
|
17
pgweb.service
Normal file
17
pgweb.service
Normal file
@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Simple web-based and cross platform PostgreSQL database explorer
|
||||
Documentation=https://sosedoff.github.io/pgweb
|
||||
|
||||
[Service]
|
||||
User=pgweb
|
||||
Group=pgweb
|
||||
ExecStart=/usr/bin/pgweb --skip-open --address="sysd?name=pgweb.socket&idle_timeout=30m" --bookmarks-dir=bookmarks --queries-dir=queries
|
||||
|
||||
NoNewPrivileges=yes
|
||||
CapabilityBoundingSet=
|
||||
RestrictNamespaces=true
|
||||
SystemCallFilter=@system-service
|
||||
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
14
pgweb.socket
Normal file
14
pgweb.socket
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Listening socket for pgweb
|
||||
|
||||
[Socket]
|
||||
# Default tcp stream
|
||||
ListenStream=127.0.0.1:8081
|
||||
|
||||
# Secure unix stream. Only allows the reverse proxy to access
|
||||
# ListenStream=/run/pgweb.sock
|
||||
# SocketGroup=caddy
|
||||
# SocketMode=0660
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
1
pgweb.sysusers
Normal file
1
pgweb.sysusers
Normal file
@ -0,0 +1 @@
|
||||
u! pgweb - "pgweb user" /var/lib/pgweb
|
3
pgweb.tmpfiles
Normal file
3
pgweb.tmpfiles
Normal file
@ -0,0 +1,3 @@
|
||||
d /var/lib/pgweb 0750 pgweb pgweb
|
||||
d /var/lib/pgweb/bookmarks 0750 pgweb pgweb
|
||||
d /var/lib/pgweb/queries 0750 pgweb pgweb
|
Loading…
x
Reference in New Issue
Block a user