Adding install infrastructure.

This commit is contained in:
John Wiseman 2020-05-03 17:02:26 -07:00
parent 406f1e9013
commit e9badb3a2f
4 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,10 @@
[Unit]
Description=Advisory Circular twitter bot
Documentaion=https://gitlab.com/jjwiseman/advisory-circular/
Wants=network.target
After=network.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/local/share/advisorycircular/advisorycircular.sh %i

11
config-skel.yaml Normal file
View File

@ -0,0 +1,11 @@
adsbx:
url: https://adsbexchange.com/api/aircraft/json
pelias:
url: http://lockheed.local:4000/v1
lat: 34.1335
lon: -118.1924
radius-km: 30
basestation-sqb: clean-basestation.sqb
landmarks:
blocklist:
- Johnny.Depp

32
install.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
set -e
install_path=/usr/local/share/advisorycircular
config_path=/etc/advisorycircular
user=advisorycircular
# Create install and config directories if they doesn't exist.
mkdir -p "$install_path"
mkdir -p "$config_path"
# Create advisory-circular user if it doesn't exist.
if ! id -u ${user} 2>/dev/null
then
adduser --system --home ${install_path} --no-create-home --quiet ${user}
fi
# Compile.
npm install
npx shadow-cljs compile script
# Install
install intervalexec.py advisorycircular "$install_path"/intervalexec
install advisorycircular.sh "$install_path"/advisorycircular
cp -r node_modules "$install_path"
cp -r .shadow-cljs "$install_path"
mkdir -p "$install_path"/out
cp out/advisorycircular.js "$install_path"/out
chown -R "$user" "$install_path"
cp config-skel.yaml "$config_path"
cp secrets-skel.yaml "$config_path"
chown -R "$user" "$config_path"

2
secrets-skel.yaml Normal file
View File

@ -0,0 +1,2 @@
adsbx:
api-key: <my api key>