repos
/ alpinefiles master

alpinefiles

mirror archived upstream

Configs and provisioning files for my Alpine Linux servers: ufw, Caddy, Docker Compose, borgbackup, and neovim.

alpinealpine-linuxborgbackupcaddydockerdocker-composehandcodedneovimself-hostedserver-configurationshellufw

1.8 KB · 55 lines · Bash Raw History
 1#!/bin/sh
 2#
 3# quickstart.sh
 4# v. 2022.07.27
 5#
 6# I don't recommend running this script on your server without modifying it to
 7# suit your needs.
 8
 9# Install dependencies
10apk update
11apk upgrade
12apk add \
13    neovim \
14    curl \
15    rsync \
16    git \
17    ip6tables \
18    iptables \
19    ufw \
20    borgbackup \
21    docker\
22    docker-compose \
23    caddy
24
25# Configure firewall
26ufw allow from 192.230.176.0/20 proto tcp to any port 22
27ufw allow 80/tcp
28ufw allow 80/udp  # for http3
29ufw allow 443/tcp
30ufw allow 443/udp  # for http3
31ufw --force enable
32
33# Download configuration files
34curl -o- https://raw.githubusercontent.com/overshard/alpinefiles/master/etc/apk/repositories \
35    | tee /etc/apk/repositories && chmod 644 /etc/apk/repositories
36curl -o- https://raw.githubusercontent.com/overshard/alpinefiles/master/etc/periodic/daily/apk-autoupgrade \
37    | tee /etc/periodic/daily/apk-autoupgrade && chmod 700 /etc/periodic/daily/apk-autoupgrade
38curl -o- https://raw.githubusercontent.com/overshard/alpinefiles/master/etc/periodic/daily/borg-autobackup \
39    | tee /etc/periodic/daily/borg-autobackup && chmod 700 /etc/periodic/daily/borg-autobackup
40curl -o- https://raw.githubusercontent.com/overshard/alpinefiles/master/etc/docker/daemon.json \
41    | tee /etc/docker/daemon.json && chmod 644 /etc/apk/repositories
42curl -o- https://raw.githubusercontent.com/overshard/alpinefiles/master/root/server-health-check.sh \
43    | tee /root/server-health-check.sh && chmod 700 /root/server-health-check.sh
44
45# Create important directories
46mkdir /srv/git && mkdir /srv/docker && mkdir /srv/data && mkdir /srv/backup
47
48# Initiate borg backups
49borg init -e none /srv/backup
50
51# Start services and add to startup
52rc-update add ufw boot && rc-service ufw start
53rc-update add docker boot && rc-service docker start
54rc-update add caddy boot && rc-service caddy start