Skip to content

EthanC/Salvage

Repository files navigation

Salvage

GitHub Workflow Status Docker Pulls Docker Image Size (tag)

Salvage backs up Portainer Stacks to GitHub and reports changes via Discord.

Setup

Although not required, a Discord Webhook is recommended for notifications.

Regardless of your chosen setup method, Salvage is intended for use with a task scheduler, such as cron.

Environment Variables:

  • LOG_LEVEL: Loguru severity level to write to the console.
  • LOG_DISCORD_WEBHOOK_URL: Discord Webhook URL to receive log events.
  • LOG_DISCORD_WEBHOOK_LEVEL: Minimum Loguru severity level to forward to Discord.
  • PORTAINER_ADDRESS (Required): IP or URL for the local Portainer instance.
  • PORTAINER_PORT (Required): Port number for the local Portainer instance.
  • PORTAINER_USERNAME (Required): Username for the local Portainer instance.
  • PORTAINER_PASSWORD (Required): Password for the local Portainer instance.
  • GITHUB_ACCESS_TOKEN (Required): Personal Access Token (Classic) for GitHub.
  • GITHUB_REPOSITORY (Required): Name of the private GitHub repository to store backups.
  • DISCORD_WEBHOOK_URL: Discord Webhook URL to receive Portainer Stack notifications.

Docker (Recommended)

Modify the following docker-compose.yml example file, then run docker compose up.

services:
  salvage:
    container_name: salvage
    image: ethanchrisp/salvage:latest
    environment:
      LOG_LEVEL: INFO
      LOG_DISCORD_WEBHOOK_URL: https://discord.com/api/webhooks/YYYYYYYY/YYYYYYYY
      LOG_DISCORD_WEBHOOK_LEVEL: WARNING
      PORTAINER_ADDRESS: XXXXXXXX
      PORTAINER_PORT: 1234
      PORTAINER_USERNAME: XXXXXXXX
      PORTAINER_PASSWORD: XXXXXXXX
      GITHUB_ACCESS_TOKEN: XXXXXXXX
      GITHUB_REPOSITORY: XXXXXXXX
      DISCORD_WEBHOOK_URL: https://discord.com/api/webhooks/XXXXXXXX/XXXXXXXX

Standalone

Salvage is built for Python 3.12 or greater.

  1. Install required dependencies using Poetry: poetry install --no-root
  2. Rename .env.example to .env, then provide the environment variables.
  3. Start Salvage: python salvage.py