73 lines
2.0 KiB
Bash
73 lines
2.0 KiB
Bash
#!/bin/bash
|
|
|
|
apt update
|
|
apt upgrade -y
|
|
|
|
# Install Deps to build and install jormun
|
|
echo 'Installing build deps'
|
|
sudo apt-get update && apt-get install -y \
|
|
build-essential \
|
|
g++ \
|
|
librocksdb-dev \
|
|
libsnappy-dev \
|
|
liblz4-dev \
|
|
libzstd-dev \
|
|
zlib1g-dev \
|
|
libbz2-dev \
|
|
curl \
|
|
clang \
|
|
git
|
|
|
|
# Install Odin compiler
|
|
curl -Lo /tmp/odin.tar.gz https://github.com/odin-lang/Odin/releases/download/dev-2026-02/odin-linux-amd64-dev-2026-02.tar.gz \
|
|
&& tar -xzf /tmp/odin.tar.gz -C /tmp \
|
|
&& mv /tmp/odin-linux-amd64-nightly+2026-02-04 /opt/odin \
|
|
&& ln -s /opt/odin/odin /usr/local/bin/odin \
|
|
&& chmod +x /opt/odin/odin \
|
|
&& odin version \
|
|
&& rm /tmp/odin.tar.gz
|
|
|
|
# Install Caddy
|
|
echo 'Installing Caddy'
|
|
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
|
|
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
|
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
|
|
chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
|
chmod o+r /etc/apt/sources.list.d/caddy-stable.list
|
|
sudo apt update
|
|
sudo apt install caddy
|
|
|
|
echo 'Creating Caddyfile'
|
|
# caddy update Caddyfile
|
|
cat <<EOF > /etc/caddy/Caddyfile
|
|
DOMAINGOESHERE.COM {
|
|
handle {
|
|
reverse_proxy 127.0.0.1:8002
|
|
}
|
|
}
|
|
EOF
|
|
|
|
# Actually install jormun
|
|
echo 'Cloning, building, and installing Jormun DB'
|
|
# clone the project
|
|
git clone https://sweetapi.com/biondizzle/jormun-db.git
|
|
cd jormun-db
|
|
|
|
# Build and install the project
|
|
make install
|
|
|
|
# Copy over the systemd service
|
|
cp ./jormundb.service /lib/systemd/system/jormundb.service
|
|
|
|
# Firewall stuff
|
|
echo 'Opening required ports'
|
|
ufw allow 80
|
|
ufw allow 443
|
|
|
|
# Create the data directory
|
|
mkdir -p /srv/jormundb/data
|
|
|
|
echo 'Enabling/Starting the JormunDB and Caddy Services'
|
|
systemctl enable --now jormundb.service
|
|
systemctl enable caddy.service
|
|
systemctl restart caddy.service #triggers caddy to grab an ssl cert |