Add Dawarich container install and metadata scripts

Introduces scripts for installing and updating Dawarich in a containerized environment, including systemd service setup and Nginx configuration. Adds a JSON metadata file for frontend integration and application details.
This commit is contained in:
CanbiZ 2026-01-16 16:16:14 +01:00
parent 5ce22e563c
commit c2c0fdbb93
3 changed files with 303 additions and 0 deletions

96
ct/dawarich.sh Normal file
View File

@ -0,0 +1,96 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/Freika/dawarich
APP="Dawarich"
var_tags="${var_tags:-location;tracking;gps}"
var_cpu="${var_cpu:-4}"
var_ram="${var_ram:-4096}"
var_disk="${var_disk:-15}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/dawarich ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "dawarich" "Freika/dawarich"; then
msg_info "Stopping Services"
systemctl stop dawarich-web dawarich-worker
msg_ok "Stopped Services"
msg_info "Backing up Data"
cp -r /opt/dawarich/app/storage /opt/dawarich_storage_backup 2>/dev/null || true
cp /opt/dawarich/app/config/master.key /opt/dawarich_master.key 2>/dev/null || true
cp /opt/dawarich/app/config/credentials.yml.enc /opt/dawarich_credentials.yml.enc 2>/dev/null || true
msg_ok "Backed up Data"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "dawarich" "Freika/dawarich" "tarball" "latest" "/opt/dawarich/app"
RUBY_VERSION=$(cat /opt/dawarich/app/.ruby-version 2>/dev/null || echo "3.4.6")
RUBY_VERSION=${RUBY_VERSION} RUBY_INSTALL_RAILS="false" HOME=/home/dawarich setup_ruby
source /opt/dawarich/.env
export PATH="/home/dawarich/.rbenv/shims:/home/dawarich/.rbenv/bin:$PATH"
eval "$(/home/dawarich/.rbenv/bin/rbenv init - bash)"
cd /opt/dawarich/app
chown -R dawarich:dawarich /home/dawarich/.rbenv
chown -R dawarich:dawarich /opt/dawarich
msg_info "Running Migrations"
cat <<'EOF' >/opt/dawarich/update_script.sh
#!/bin/bash
source /opt/dawarich/.env
export PATH="/home/dawarich/.rbenv/shims:/home/dawarich/.rbenv/bin:$PATH"
eval "$(/home/dawarich/.rbenv/bin/rbenv init - bash)"
cd /opt/dawarich/app
bundle config set --local deployment 'true'
bundle config set --local without 'development test'
bundle install
SECRET_KEY_BASE_DUMMY=1 bundle exec rake assets:precompile
bundle exec rails db:migrate
bundle exec rake data:migrate
EOF
chmod +x /opt/dawarich/update_script.sh
$STD sudo -u dawarich bash /opt/dawarich/update_script.sh
rm -f /opt/dawarich/update_script.sh
msg_ok "Ran Migrations"
msg_info "Restoring Data"
cp -r /opt/dawarich_storage_backup/. /opt/dawarich/app/storage/ 2>/dev/null || true
cp /opt/dawarich_master.key /opt/dawarich/app/config/master.key 2>/dev/null || true
cp /opt/dawarich_credentials.yml.enc /opt/dawarich/app/config/credentials.yml.enc 2>/dev/null || true
rm -rf /opt/dawarich_storage_backup /opt/dawarich_master.key /opt/dawarich_credentials.yml.enc
chown -R dawarich:dawarich /opt/dawarich
msg_ok "Restored Data"
msg_info "Starting Services"
systemctl start dawarich-web dawarich-worker
msg_ok "Started Services"
msg_ok "Updated Successfully!"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

View File

@ -0,0 +1,40 @@
{
"name": "Dawarich",
"slug": "dawarich",
"categories": [
9
],
"date_created": "2026-01-16",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 3000,
"documentation": "https://dawarich.app/docs",
"website": "https://dawarich.app/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/dawarich.webp",
"config_path": "/opt/dawarich/.env",
"description": "Dawarich is a self-hosted alternative to Google Timeline (Google Maps Location History). It allows you to import your location history from Google Maps Timeline and Owntracks, view it on a map, and analyze your location data with statistics and visualizations.",
"install_methods": [
{
"type": "default",
"script": "ct/dawarich.sh",
"resources": {
"cpu": 4,
"ram": 4096,
"hdd": 15,
"os": "Debian",
"version": "13"
}
}
],
"default_credentials": {
"username": "demo@dawarich.app",
"password": "password"
},
"notes": [
{
"text": "Default credentials: demo@dawarich.app / password - Change after first login!",
"type": "warning"
}
]
}

167
install/dawarich-install.sh Normal file
View File

@ -0,0 +1,167 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/Freika/dawarich
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
build-essential \
libpq-dev \
libgeos-dev \
libyaml-dev \
libffi-dev \
libssl-dev \
libjemalloc2 \
imagemagick \
libmagickwand-dev \
libvips-dev \
cmake \
redis-server \
nginx
msg_ok "Installed Dependencies"
PG_VERSION="17" PG_MODULES="postgis-3" setup_postgresql
PG_DB_NAME="dawarich_production" PG_DB_USER="dawarich" PG_DB_EXTENSIONS="postgis" setup_postgresql_db
fetch_and_deploy_gh_release "dawarich" "Freika/dawarich" "tarball" "latest" "/opt/dawarich/app"
msg_info "Setting up Directories"
mkdir -p /opt/dawarich/app/{storage,log,tmp/pids,tmp/cache,tmp/sockets}
msg_ok "Set up Directories"
msg_info "Configuring Environment"
SECRET_KEY_BASE=$(openssl rand -hex 64)
RELEASE=$(get_latest_github_release "Freika/dawarich")
cat <<EOF >/opt/dawarich/.env
RAILS_ENV=production
SECRET_KEY_BASE=${SECRET_KEY_BASE}
DATABASE_HOST=localhost
DATABASE_USERNAME=${PG_DB_USER}
DATABASE_PASSWORD=${PG_DB_PASS}
DATABASE_NAME=${PG_DB_NAME}
REDIS_URL=redis://127.0.0.1:6379/0
BACKGROUND_PROCESSING_CONCURRENCY=10
APPLICATION_HOST=localhost
APPLICATION_HOSTS=localhost
TIME_ZONE=UTC
DISABLE_TELEMETRY=true
APP_VERSION=${RELEASE}
EOF
msg_ok "Configured Environment"
NODE_VERSION="22" setup_nodejs
RUBY_VERSION=$(cat /opt/dawarich/app/.ruby-version 2>/dev/null || echo "3.4.6")
RUBY_VERSION=${RUBY_VERSION} RUBY_INSTALL_RAILS="false" setup_ruby
msg_info "Installing Dawarich"
cd /opt/dawarich/app
source /root/.profile
export PATH="/root/.rbenv/shims:/root/.rbenv/bin:$PATH"
eval "$(/root/.rbenv/bin/rbenv init - bash)"
$STD gem install bundler
$STD bundle config set --local deployment 'true'
$STD bundle config set --local without 'development test'
$STD bundle install
SECRET_KEY_BASE_DUMMY=1 $STD bundle exec rake assets:precompile
set -a && source /opt/dawarich/.env && set +a
$STD bundle exec rails db:prepare
$STD bundle exec rake data:migrate
msg_ok "Installed Dawarich"
msg_info "Creating Services"
cat <<EOF >/etc/systemd/system/dawarich-web.service
[Unit]
Description=Dawarich Web Server
After=network.target postgresql.service redis-server.service
Requires=postgresql.service redis-server.service
[Service]
Type=simple
WorkingDirectory=/opt/dawarich/app
EnvironmentFile=/opt/dawarich/.env
ExecStart=/root/.rbenv/shims/bundle exec puma -C config/puma.rb
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
cat <<EOF >/etc/systemd/system/dawarich-worker.service
[Unit]
Description=Dawarich Sidekiq Worker
After=network.target postgresql.service redis-server.service
Requires=postgresql.service redis-server.service
[Service]
Type=simple
WorkingDirectory=/opt/dawarich/app
EnvironmentFile=/opt/dawarich/.env
ExecStart=/root/.rbenv/shims/bundle exec sidekiq -C config/sidekiq.yml
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now redis-server dawarich-web dawarich-worker
msg_ok "Created Services"
msg_info "Configuring Nginx"
cat <<EOF >/etc/nginx/sites-available/dawarich.conf
upstream dawarich {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name _;
root /opt/dawarich/app/public;
client_max_body_size 100M;
location ~ ^/(assets|packs)/ {
expires max;
add_header Cache-Control "public, immutable";
try_files \$uri =404;
}
location / {
try_files \$uri @rails;
}
location @rails {
proxy_pass http://dawarich;
proxy_http_version 1.1;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_buffering off;
}
}
EOF
ln -sf /etc/nginx/sites-available/dawarich.conf /etc/nginx/sites-enabled/
rm -f /etc/nginx/sites-enabled/default
systemctl enable -q --now nginx
msg_ok "Configured Nginx"
motd_ssh
customize
cleanup_lxc