wakapi initial

This commit is contained in:
John Doe
2026-03-11 00:04:53 -04:00
parent 7dc5c09909
commit 280ffe81a7
5 changed files with 540 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
__ _
_ ______ _/ /______ _____ (_)
| | /| / / __ `/ //_/ __ `/ __ \/ /
| |/ |/ / /_/ / ,< / /_/ / /_/ / /
|__/|__/\__,_/_/|_|\__,_/ .___/_/
/_/
Coding Statistics Tracker
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env bash
COMMUNITY_SCRIPTS_URL="${COMMUNITY_SCRIPTS_URL:-https://raw.githubusercontent.com/Heretek-AI/ProxmoxVE/refs/heads/main}"
source <(curl -fsSL "${COMMUNITY_SCRIPTS_URL}"/misc/build.func)
# Author: BillyOutlast
# License: MIT | https://github.com/Heretek-AI/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/muety/wakapi | Website: https://wakapi.dev
APP="Wakapi"
var_tags="${var_tags:-productivity;analytics}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-8}"
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 [[ ! -f /etc/systemd/system/wakapi.service ]]; then
msg_error "No ${APP} Installation Found!"
exit 1
fi
if check_for_gh_release "wakapi" "muety/wakapi"; then
msg_info "Stopping Service"
systemctl stop wakapi
msg_ok "Stopped Service"
msg_info "Backing up Configuration and Data"
cp /opt/wakapi/config.yml /tmp/wakapi_config_backup.yml 2>/dev/null || true
msg_ok "Backed up Configuration"
msg_info "Updating Wakapi"
fetch_and_deploy_gh_release "wakapi" "muety/wakapi" "prebuild" "latest" "/opt/wakapi/bin" "wakapi_linux_*.tar.gz"
msg_ok "Updated Wakapi"
msg_info "Restoring Configuration"
cp /tmp/wakapi_config_backup.yml /opt/wakapi/config.yml 2>/dev/null || true
rm -f /tmp/wakapi_config_backup.yml
msg_ok "Restored Configuration"
msg_info "Starting Service"
systemctl start wakapi
msg_ok "Started Service"
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}"
+60
View File
@@ -0,0 +1,60 @@
{
"name": "Wakapi",
"slug": "wakapi",
"categories": [
0
],
"date_created": "2026-03-11",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 3000,
"documentation": "https://github.com/muety/wakapi#readme",
"website": "https://wakapi.dev",
"logo": "https://raw.githubusercontent.com/muety/wakapi/master/static/assets/images/logo-gh.svg",
"config_path": "/opt/wakapi/config.yml",
"description": "Wakapi is a minimalist, self-hosted WakaTime-compatible backend for coding statistics. Track your coding time across projects, languages, and editors with detailed statistics and visualizations. Features public leaderboards, weekly email reports, REST API, and Prometheus metrics.",
"install_methods": [
{
"type": "default",
"script": "ct/wakapi.sh",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 8,
"os": "Debian",
"version": "13"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": [
{
"text": "Access the web interface at http://<IP>:3000",
"type": "info"
},
{
"text": "Create your account on first access - no default credentials",
"type": "warning"
},
{
"text": "Configuration file: /opt/wakapi/config.yml",
"type": "info"
},
{
"text": "Database: /opt/wakapi/data/wakapi.db (SQLite)",
"type": "info"
},
{
"text": "Configure WakaTime client: Edit ~/.wakatime.cfg with api_url and api_key",
"type": "info"
},
{
"text": "API documentation available at http://<IP>:3000/swagger-ui",
"type": "info"
}
]
}
+241
View File
@@ -0,0 +1,241 @@
#!/usr/bin/env bash
# Author: BillyOutlast
# License: MIT | https://github.com/Heretek-AI/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/muety/wakapi | Website: https://wakapi.dev
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 \
ca-certificates \
curl
msg_ok "Installed Dependencies"
msg_info "Creating Directories"
mkdir -p /opt/wakapi/bin
mkdir -p /opt/wakapi/data
msg_ok "Created Directories"
msg_info "Downloading Wakapi"
fetch_and_deploy_gh_release "wakapi" "muety/wakapi" "prebuild" "latest" "/opt/wakapi/bin" "wakapi_linux_*.tar.gz"
msg_ok "Downloaded Wakapi"
msg_info "Verifying Installation"
ls -la /opt/wakapi/bin/
chmod +x /opt/wakapi/bin/wakapi
msg_ok "Verified Installation"
msg_info "Generating Configuration"
# Generate a random password salt
PASSWORD_SALT=$(cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
cat <<EOF >/opt/wakapi/config.yml
env: production
quick_start: false
skip_migrations: false
enable_pprof: false
server:
listen_ipv4: 0.0.0.0
listen_ipv6: '-'
listen_socket:
listen_socket_mode: 0666
timeout_sec: 30
tls_cert_path:
tls_key_path:
port: 3000
base_path: /
public_url: http://localhost:3000
app:
leaderboard_enabled: true
leaderboard_scope: 7_days
leaderboard_generation_time: '0 0 6 * * *,0 0 18 * * *'
leaderboard_require_auth: false
aggregation_time: '0 15 2 * * *'
report_time_weekly: '0 0 18 * * 5'
data_cleanup_time: '0 0 6 * * 0'
optimize_database_time: '0 0 8 1 * *'
inactive_days: 7
import_enabled: true
import_backoff_min: 5
import_max_rate: 24
import_batch_size: 50
heartbeat_max_age: '4320h'
data_retention_months: -1
max_inactive_months: 12
warm_caches: true
custom_languages:
vue: Vue
jsx: JSX
tsx: TSX
cjs: JavaScript
ipynb: Python
svelte: Svelte
astro: Astro
canonical_language_names:
'java': 'Java'
'ini': 'INI'
'xml': 'XML'
'jsx': 'JSX'
'tsx': 'TSX'
'php': 'PHP'
'yaml': 'YAML'
'toml': 'TOML'
'sql': 'SQL'
'css': 'CSS'
'scss': 'SCSS'
'jsp': 'JSP'
'svg': 'SVG'
'csv': 'CSV'
avatar_url_template: api/avatar/{username_hash}.svg
date_format: Mon, 02 Jan 2006
datetime_format: Mon, 02 Jan 2006 15:04
db:
host:
port:
socket:
user:
password:
name: /opt/wakapi/data/wakapi.db
dialect: sqlite3
charset: utf8mb4
max_conn: 10
ssl: false
compress: false
automigrate_fail_silently: false
security:
password_salt: ${PASSWORD_SALT}
insecure_cookies: true
cookie_max_age: 172800
allow_signup: true
oidc_allow_signup: true
disable_local_auth: false
disable_webauthn: true
signup_captcha: false
invite_codes: true
disable_frontpage: false
expose_metrics: false
enable_proxy: false
trusted_header_auth: false
trusted_header_auth_key: Remote-User
trusted_header_auth_allow_signup: false
trust_reverse_proxy_ips:
signup_max_rate: 5/1h
login_max_rate: 10/1m
password_reset_max_rate: 5/1h
oidc: []
sentry:
dsn:
enable_tracing: true
sample_rate: 0.75
sample_rate_heartbeats: 0.1
subscriptions:
enabled: false
expiry_notifications: true
stripe_api_key:
stripe_secret_key:
stripe_endpoint_secret:
standard_price_id:
mail:
enabled: false
provider: smtp
sender: Wakapi <[email protected]>
skip_verify_mx_record: false
smtp:
host:
port:
username:
password:
tls:
EOF
msg_ok "Generated Configuration"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/wakapi.service
[Unit]
Description=Wakapi - Coding Statistics
After=network.target network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/wakapi
ExecStart=/opt/wakapi/bin/wakapi -config /opt/wakapi/config.yml
Restart=on-failure
RestartSec=5
# Environment variables
Environment=WAKAPI_PASSWORD_SALT=${PASSWORD_SALT}
# Resource limits
LimitNOFILE=65535
TimeoutStartSec=60
TimeoutStopSec=30
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now wakapi
msg_ok "Created Service"
msg_info "Creating Info File"
cat <<EOF >/opt/wakapi/README.md
# Wakapi Installation
Wakapi is a minimalist, self-hosted WakaTime-compatible backend for coding statistics.
## Access
- Web Interface: http://<IP>:3000
- API Endpoint: http://<IP>:3000/api
## Configuration
Configuration file: /opt/wakapi/config.yml
Database: /opt/wakapi/data/wakapi.db
## First Time Setup
1. Access the web interface at http://<IP>:3000
2. Create your account (first user becomes admin)
3. Get your API key from Settings
## WakaTime Client Setup
Edit your ~/.wakatime.cfg file:
[settings]
api_url = http://<IP>:3000/api
api_key = <your-api-key>
## Useful Commands
- Check status: systemctl status wakapi
- Restart: systemctl restart wakapi
- View logs: journalctl -u wakapi -f
## Documentation
- GitHub: https://github.com/muety/wakapi
- Website: https://wakapi.dev
- API Docs: http://<IP>:3000/swagger-ui
EOF
msg_ok "Created Info File"
motd_ssh
customize
cleanup_lxc
+167
View File
@@ -0,0 +1,167 @@
# Wakapi ProxmoxVE Script Plan
## Overview
This plan outlines the creation of a ProxmoxVE community script for deploying **Wakapi** - a minimalist, self-hosted WakaTime-compatible backend for coding statistics.
- **Source**: https://github.com/muety/wakapi
- **Website**: https://wakapi.dev
- **License**: MIT
- **Language**: Go
- **Default Port**: 3000
## Architecture
```mermaid
flowchart TD
A[User runs ct/wakapi.sh] --> B[build.func processes request]
B --> C[Container created with Debian 13]
C --> D[install/wakapi-install.sh executed]
D --> E[Download Wakapi binary from GitHub]
E --> F[Create config.yml with SQLite]
F --> G[Create systemd service]
G --> H[Wakapi running on port 3000]
```
## Files to Create
### 1. ct/wakapi.sh
Main container creation script that:
- Defines container resources: 2 CPU, 2GB RAM, 8GB disk
- Uses Debian 13 as base OS
- Implements update_script function for version updates
- Sources build.func from the repository
**Key Configuration:**
```bash
APP="Wakapi"
var_tags="productivity;analytics"
var_cpu="2"
var_ram="2048"
var_disk="8"
var_os="debian"
var_version="13"
var_unprivileged="1"
```
### 2. install/wakapi-install.sh
Installation script that:
- Downloads the latest Wakapi binary from GitHub releases
- Creates necessary directories: /opt/wakapi
- Generates configuration file with SQLite backend
- Creates systemd service for automatic startup
- Generates a secure password salt
**Installation Steps:**
1. Install dependencies: ca-certificates
2. Download Wakapi binary using fetch_and_deploy_gh_release
3. Create /opt/wakapi directory
4. Generate config.yml with:
- SQLite database
- Random password salt
- Proper security settings
5. Create systemd service
6. Enable and start service
### 3. ct/headers/wakapi
ASCII art header for the script output.
### 4. frontend/public/json/wakapi.json
Metadata file containing:
- Application name and slug
- Categories: productivity, analytics
- Installation methods
- Default credentials info
- Documentation links
## Configuration Details
### Wakapi Configuration (config.yml)
```yaml
env: production
server:
port: 3000
listen_ipv4: 0.0.0.0
public_url: http://localhost:3000
security:
password_salt: <generated>
insecure_cookies: true
allow_signup: true
db:
dialect: sqlite3
name: /opt/wakapi/data/wakapi.db
```
### Systemd Service
```ini
[Unit]
Description=Wakapi - Coding Statistics
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/wakapi
ExecStart=/opt/wakapi/wakapi -config /opt/wakapi/config.yml
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
```
## Update Strategy
The update_script function will:
1. Check current version against GitHub releases
2. Stop the Wakapi service
3. Backup the config.yml and data directory
4. Download new binary
5. Restore configuration
6. Restart service
## Resource Requirements
| Resource | Value | Notes |
|----------|-------|-------|
| CPU | 2 cores | Sufficient for personal use |
| RAM | 2GB | Adequate for SQLite backend |
| Disk | 8GB | Stores binary, config, and database |
| OS | Debian 13 | Latest stable |
## Post-Installation
After installation, users need to:
1. Access Wakapi at http://IP:3000
2. Create an account (first user becomes admin)
3. Configure WakaTime client with:
- API URL: http://IP:3000/api
- API Key: From user settings
## Notes for Implementation
1. **Binary Selection**: Wakapi provides pre-built binaries for Linux amd64/arm64. Use the appropriate binary based on architecture.
2. **Password Salt**: Generate a random 32-character salt for password hashing.
3. **Data Persistence**: The SQLite database is stored in /opt/wakapi/data/ which persists across updates.
4. **No Default Credentials**: Wakapi requires user registration on first access - no default username/password.
5. **Categories**: Use category IDs from the project - likely productivity and analytics related.
## Implementation Checklist
- [ ] Create ct/wakapi.sh with update_script function
- [ ] Create install/wakapi-install.sh with binary download and config
- [ ] Create ct/headers/wakapi ASCII art
- [ ] Create frontend/public/json/wakapi.json metadata
- [ ] Test the scripts in a Proxmox environment