build: add installer script

This commit is contained in:
decentral1se 2021-09-07 13:01:22 +02:00
parent 48bc03db51
commit 45f1692c99
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
5 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# install.abra.coopcloud.tech
To deploy, run `make`.
You have to be an [Autonomic](https://autonomic.zone) member to do this.

View File

@ -0,0 +1,38 @@
---
version: "3.8"
services:
app:
image: "nginx:stable"
configs:
- source: abra_conf
target: /etc/nginx/conf.d/abra.conf
- source: abra_installer
target: /var/www/abra-installer/installer
volumes:
- "public:/var/www/abra-installer"
networks:
- proxy
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
- "traefik.http.services.abra-installer.loadbalancer.server.port=80"
- "traefik.http.routers.abra-installer.rule=Host(`install.abra.autonomic.zone`,`install.abra.coopcloud.tech`)"
- "traefik.http.routers.abra-installer.entrypoints=web-secure"
- "traefik.http.routers.abra-installer.tls.certresolver=production"
configs:
abra_installer:
file: installer
abra_conf:
file: nginx.conf
networks:
proxy:
external: true
volumes:
public:

57
scripts/installer/installer Executable file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env bash
ABRA_VERSION="0.1.1-alpha"
ABRA_RELEASE_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$ABRA_VERSION"
function show_banner {
echo ""
echo " ____ ____ _ _ "
echo " / ___|___ ___ _ __ / ___| | ___ _ _ __| |"
echo " | | / _ \ _____ / _ \| '_ \ | | | |/ _ \| | | |/ _' |"
echo " | |__| (_) |_____| (_) | |_) | | |___| | (_) | |_| | (_| |"
echo " \____\___/ \___/| .__/ \____|_|\___/ \__,_|\__,_|"
echo " |_|"
echo ""
echo ""
echo " === Public interest infrastructure === "
echo ""
echo ""
}
function install_abra_release {
mkdir -p "$HOME/.local/bin"
if ! type "curl" > /dev/null 2>&1; then
echo "'curl' is not installed, cannot proceed..."
echo "perhaps try installing manually via the releases URL?"
echo "https://git.coopcloud.tech/coop-cloud/abra/releases"
exit 1
fi
if ! type "curl" > /dev/null 2>&1; then
error "'python3' is not installed, cannot proceed..."
echo "perhaps try installing manually via the releases URL?"
echo "https://git.coopcloud.tech/coop-cloud/abra/releases"
fi
# FIXME: support different architectures
release_url=$(curl -s "$ABRA_RELEASE_URL" |
python3 -c "import sys, json; \
payload = json.load(sys.stdin); \
url = [a['browser_download_url'] for a in payload['assets'] if 'arm64' in a['name']][0]; \
print(url)")
echo "downloading $ABRA_VERSION AMD64 binary release for abra..."
curl --progress-bar "$release_url" --output "$HOME/.local/bin/abra"
chmod +x "$HOME/.local/bin/abra"
echo "abra installed to $HOME/.local/bin/abra"
}
function run_installation {
show_banner
install_abra_release
}
run_installation "$@"
exit 0

View File

@ -0,0 +1,7 @@
STACK := abra_installer_script
default: deploy
deploy:
@docker stack rm $(STACK) && \
docker stack deploy -c compose.yml $(STACK)

View File

@ -0,0 +1,10 @@
server {
listen 80 default_server;
server_name install.abra.autonomic.zone install.abra.coopcloud.tech;
location / {
root /var/www/abra-installer;
add_header Content-Type text/plain;
index installer;
}
}