overpass-systemd/install-debian.sh
Kumi e3f5293ebc
feat: automate Overpass API setup and monitoring
Introduce a complete setup for the Overpass API on Debian. Add necessary scripts and configuration files to automate the installation and configuration process, including setting up Apache and creating systemd services for automatic startup.

- Add an example Apache configuration file.
- Implement a Debian installation script for the Overpass API.
- Create a systemd service and timer for monitoring Overpass OSC and restart if no output is detected.
- Set up additional systemd services for Overpass processes to ensure continuous operations.

This setup simplifies deployment and enhances reliability by monitoring services and ensuring they restart automatically if needed.
2024-10-26 09:10:49 +02:00

53 lines
No EOL
1.5 KiB
Bash

#!/bin/bash
# Install Overpass API
# Step 1: Install required software packages
echo "Installing required packages..."
apt install wget g++ make expat libexpat1-dev zlib1g-dev liblz4-dev -y
# Step 2: Download the latest release of Overpass API
cd /opt
echo "Downloading Overpass API..."
wget https://dev.overpass-api.de/releases/osm-3s_latest.tar.gz
# Extract the package
echo "Extracting package..."
tar -xzf osm-3s_latest.tar.gz
# Navigate into the extracted directory
EXTRACTED_DIR=$(tar -tf osm-3s_latest.tar.gz | head -1 | cut -f1 -d"/")
ln -s "$EXTRACTED_DIR" osm
cd "$EXTRACTED_DIR"
# Compile the software
echo "Compiling Overpass API..."
./configure --enable-lz4
make
chmod 755 bin/*.sh cgi-bin/*
# Step 3: Load Data
DB_DIR="db"
echo "Cloning the database..."
mkdir -p $DB_DIR
bin/download_clone.sh --db-dir="$DB_DIR/" --meta=attic --source="https://dev.overpass-api.de/api_drolbr/"
# Step 4: Create system user
echo "Creating system user..."
useradd -m osm
chown -R osm:osm .
# Step 5: Set up systemd service files
echo "Setting up services..."
SCRIPT_DIR=$(dirname "$0")
cp "$SCRIPT_DIR/systemd/*" /etc/systemd/system/
install "$SCRIPT_DIR/oscmonitor/oscmonitor" /usr/local/bin/
systemctl enable --now overpass
systemctl enable --now overpassareas
systemctl enable --now overpassloop
systemctl enable --now overpassosc
systemctl enable --now oscmonitor.timer
echo "Overpass API installation completed."
echo "Please set up Apache based on the apache/example.conf file."