diff --git a/scr/1_upd_install.sh b/scr/1_upd_install.sh new file mode 100755 index 0000000..66bf973 --- /dev/null +++ b/scr/1_upd_install.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# update, upgrade and install / frode klevstul / oct 2025 +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +if [ "$EUID" -ne 0 ] + then echo "error: run as 'root'" + exit +fi + +# --- +# update server +# --- +apt update +apt -y full-upgrade + +# --- +# misc installations +# trash-cli - used in misc scripts +# nginx - webserver +# --- +apt -y install trash-cli nginx + +# --- +# nginx +# --- +systemctl enable nginx # enable on startup + +# change mode so given dirs are writable by non-root user (which is nifty) +chmod o+w /etc/nginx/sites-enabled/ +chmod o+w /etc/nginx/sites-available/ +chmod o+w /etc/nginx/nginx.conf +chmod o+w /var/www/ diff --git a/scr/2a_postgrest_install.sh b/scr/2a_postgrest_install.sh new file mode 100644 index 0000000..f512b77 --- /dev/null +++ b/scr/2a_postgrest_install.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# install postgrest / frode klevstul / oct 2025 +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +if [ "$EUID" -ne 0 ] + then echo "error: run as 'root'" + exit +fi + +# --- +# postgrest +# --- + +# https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8 + +#wget https://github.com/PostgREST/postgrest/releases/latest/download/postgrest-linux-amd64 + +#https://github.com/PostgREST/postgrest/releases/latest/download/postgrest-latest-linux-static-x86-64.tar.xz + + +#https://github.com/PostgREST/postgrest/releases/download/v14.0/postgrest-v14.0-linux-static-x86-64.tar.xz + + +#wget -qO- --max-redirect=10 https://github.com/PostgREST/postgrest/releases | grep -wo "https.*x86_64.deb\|https.*amd64.deb" | head -n 1 | xargs -I {} wget -O test.deb {} + +cd /tmp + +curl -s https://api.github.com/repos/PostgREST/postgrest/releases/latest | sed 's/[()",{}]/ /g; s/ /\n/g' | grep "https.*releases/download*static*.*tar.xz" + diff --git a/scr/2b_postgrest_config.sh b/scr/2b_postgrest_config.sh new file mode 100644 index 0000000..415a824 --- /dev/null +++ b/scr/2b_postgrest_config.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# config postgrest / frode klevstul / oct 2025 +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +useradd -M -U -d /nonexistent -s /usr/sbin/nologin postgrest + +cd /tmp +wget https://gt.op.fo/fro/srv-pub/raw/branch/trunk/cfg/pgr/postgrest.service +cp postgrest.service /etc/systemd/system/ + +systemctl enable postgrest +systemctl start postgrest +systemctl status postgrest