Sign inSign up

ptodorov/dontpanic-server

By ptodorov

•Updated about 1 year ago

Backend server for the dontpanic rust crate. Receives and displays panic reports and log messages.

Image
Developer tools
Monitoring & observability
0

2.1K

ptodorov/dontpanic-server repository overview

⁠dontpanic-server

Backend web server for the dontpanic⁠ crate. Receives and displays panic reports and log messages. Optionally sends notifications via multiple configurable channels.

⁠Features

  • Friendly UI
  • Authentication & Authorization
  • View reported panics & errors
  • View panic backtrace and log messages
  • Mark a panic as resolved
  • Setup and manage notifications
  • Organizations and project management
  • User management

⁠Screenshots

List of panic!()s and error!()sIndividual report

⁠Running via docker compose

⁠SQLite
services:
  dontpanic:
    image: ptodorov/dontpanic-server:latest
    ports:
      - 8080:8080
    environment:
      DATABASE_URL: sqlite:///data/dontpanic.sqlite?mode=rwc
      DEFAULT_USER_EMAIL: [email protected]
      DEFAULT_USER_PASSWORD: admin123
    volumes:
      - database-data:/data

volumes:
  database-data:
⁠MariaDB/MySQL
services:

  dontpanic:
    image: ptodorov/dontpanic-server:latest
    restart: always
    container_name: dontpanic
    ports:
      - 8080:8080
    environment:
      DATABASE_URL: mysql://dontpanic:32as1e78gdfbqwe5tx@database/dontpanic
      DEFAULT_USER_EMAIL: [email protected]
      DEFAULT_USER_PASSWORD: admin123
    depends_on:
      database:
        condition: service_healthy

  database:
    image: mariadb
    restart: always
    container_name: database
    command:
      [
        "mariadbd",
        "--character-set-server=utf8mb4",
        "--collation-server=utf8mb4_unicode_ci",
      ]
    ports:
      - 3306:3306
    environment:
      MARIADB_DATABASE: dontpanic
      MARIADB_USER: dontpanic
      MARIADB_PASSWORD: 32as1e78gdfbqwe5tx
      MARIADB_RANDOM_ROOT_PASSWORD: 1
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      start_period: 10s
      interval: 10s
      timeout: 5s
      retries: 3
    volumes:
      - database-data:/var/lib/mysql

volumes:
  database-data:

⁠Environment Variables

VariableDescriptionDefault
BIND_ADDRESSThe address:port that can access dontpanic web interface. Use 0.0.0.0:8080 to allow anybody to connect.0.0.0.0:8080
BASE_URLUrl to use when generating links in notifications and emails.localhost
SCHEMEHttp scheme to use when generating links in notifications and emails. Possible values: http, httpshttp
RUST_LOGLogging level. Valid values are trace, debug, info, warn, errorinfo
COOKIE_SECRETThe secret key used to encrypt session cookies. Set this to a random string. If this is not set, a random secret will be generated on each startup. Every time this key is changed, all sessions will be dropped and all users will need to log in again.Random
DATABASE_URLMysql: mysql://username:password@host/database Sqlite: sqlite://[PATH_TO_FILE].sqlite?mode=rwcNone
EMAIL_URLOptional SMTP connection url for email notifications. Format: smtps://username:[email protected]/client.example.com:465, Documentation⁠None
EMAIL_FROMSource email address for email notifications.[email protected]⁠
DEFAULT_USER_EMAILThis account will be created at startup if it does not exist. Use this to login into your self-hosted deployment.None
DEFAULT_USER_PASSWORDPassword for the default user. Min 8 characters long. Both email and password must be provided or no account will be created.None
DEFAULT_USER_TIMEZONEIANA Timezone name for the default user and for all new registrations.UTC
DEFAULT_USER_ORGANIZATIONOrganization name to use when creating the default user.Default Organization
REGISTRATION_ENABLEDEnable/disable account creation. yes, 1, true all count as true, anything else is false. Care must be taken when setting this to yes. Anyone with access to the server can register.true
REQUIRE_EMAIL_VERIFICATIONRequire new users to verify their email address before they can login. A working EMAIL_URL configuration is required.true if EMAIL_URL is set, false otherwise.
SLACK_CLIENT_IDSlack app client id. Required for Slack notifications to work. See this⁠None
SLACK_CLIENT_SECRETSlack app client secret. Keep this secure.None
PUSHOVER_APP_TOKENPushover app token will allow users to add pushover keys to their profiles. Register an app here⁠None

⁠Development

In one console start the frontend:

cd frontend
npm i
npm run dev

In another start the project:

DATABASE_URL="sqlite://localdev.sqlite?mode=rwc" [email protected] DEFAULT_USER_PASSWORD=$DEFAULT_USER_EMAIL cargo run

http://localhost:8080⁠
User: [email protected]
Pass: [email protected]

⁠Database changes

Don't Panic uses the excellent SeaORM⁠ project. Make sure you have the cli installed: cargo install sea-orm-cli

Set your database url environment var to avoid typing it before every command: DATABASE_URL="mysql://user:[email protected]:3306/database"

To create a database migration run: sea-orm-cli migrate generate NAME_OF_MIGRATION

After populating the migration file, execute it: sea-orm-cli migrate up

And finally regenerate the entity files: sea-orm-cli generate entity -o src/entity --with-serde serialize

Note that the entity ids generate as i32 when using sqlite. The entity folder in this project was generated from a mysql database which supports unsigned integers and all ids are u32s

⁠Contributing

All commit messages must follow Conventional Commits⁠ specification.

⁠License

GNU Affero General Public License v3.0 only LICENSE.md⁠

Tag summary

Content type

Image

Digest

sha256:f5ad268b7…

Size

16.5 MB

Last updated

about 1 year ago

docker pull ptodorov/dontpanic-server