# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Snipe It
spec:
    description: A free open source IT asset/license management system built in PHP on Laravel.
    coverImage: https://github.com/grokability/snipe-it/assets/197404/b515673b-c7c8-4d9a-80f5-9fa58829a602
    icon: https://avatars.githubusercontent.com/u/18605133?s=200&v=4
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Snipe-IT Domain
          description: The domain for accessing your Snipe-IT application.
    tags:
        - Asset Management
        - IT Management
        - Laravel
        - PHP
    readme: "# Snipe-IT\n\nA free open source IT asset/license management system built in PHP on Laravel.\n\nSnipe-IT is a robust asset management platform that helps organizations track and manage their IT assets efficiently. It provides comprehensive features for inventory management, user assignments, license tracking, and reporting.\n\n## Features\n\n- **Asset Management**: Track computers, peripherals, licenses, and accessories\n- **User Management**: Assign assets to users and departments\n- **Maintenance Tracking**: Schedule and track maintenance activities\n- **Reports & Analytics**: Generate detailed reports on asset utilization\n- **Barcode/QR Code Support**: Print and scan asset labels\n- **Custom Fields**: Extend asset information with custom attributes\n- **Multi-location Support**: Manage assets across multiple locations\n- **LDAP/AD Integration**: Connect with existing directory services\n\n## Environment Variables\n\nAfter deployment, the following environment variables will be available:\n\n- `MYSQL_HOST`: The hostname of your MySQL database\n- `MYSQL_PORT`: The port of your MySQL database  \n- `MYSQL_DATABASE`: The database name for Snipe-IT\n- `MYSQL_USERNAME`: The username for database access\n- `MYSQL_PASSWORD`: The password for database access\n- `MYSQL_CONNECTION_STRING`: Full MySQL connection string\n\n## Getting Started\n\n1. **Initial Setup**: After deployment, visit your Snipe-IT domain to complete the setup wizard\n2. **Admin Account**: Create your first administrator account during setup\n3. **Company Information**: Configure your organization details and preferences\n4. **Asset Categories**: Set up categories for different types of assets\n5. **Locations**: Add your organization's locations and departments\n6. **Start Adding Assets**: Begin tracking your IT inventory\n\n## Configuration\n\nThe application comes pre-configured with production-ready settings. Key configurations include:\n\n- **Database**: MySQL/MariaDB backend for reliable data storage\n- **File Storage**: Persistent volume for uploaded files and backups\n- **Security**: Secure random APP_KEY generation\n- **Performance**: Optimized caching and session settings\n\n## Backup & Maintenance\n\n- **Data Persistence**: All data is stored in persistent volumes\n- **File Uploads**: Asset images and documents are preserved across deployments\n- **Database Backups**: Regular backups recommended for production use\n- **Updates**: Update the image tag to deploy new versions\n\n## Documentation\n\nFor detailed documentation and usage guides, visit the [official Snipe-IT documentation](https://snipe-it.readme.io/)."
    services:
        - name: snipe-it
          icon: https://www.gravatar.com/avatar/068b3d8ec6017a272dd31a1ffc9a7222?s=120&r=g&d=404
          template: PREBUILT_V2
          spec:
            id: snipe-it
            source:
                image: snipe/snipe-it:v8.3.1
            ports:
                - id: web
                  port: 80
                  type: HTTP
            env:
                API_THROTTLE_PER_MINUTE:
                    default: "100"
                    expose: false
                APP_DEBUG:
                    default: "true"
                    expose: false
                APP_ENV:
                    default: production
                    expose: false
                APP_KEY:
                    default: base64:M4cirroEovhZGzy7E9c+RZhMItxvtZ4fPgWsfWluyPU=
                    expose: false
                APP_LOCALE:
                    default: zh-TW
                    expose: false
                APP_TIMEZONE:
                    default: Asia/Taipei
                    expose: false
                APP_URL:
                    default: https://${ZEABUR_WEB_DOMAIN}
                BACKUP_ENV:
                    default: "true"
                    expose: false
                DB_CHARSET:
                    default: utf8mb4
                    expose: false
                DB_CONNECTION:
                    default: mysql
                    expose: false
                DB_DATABASE:
                    default: zeabur
                    expose: false
                DB_DUMP_PATH:
                    default: /var/www/html/storage/app/backups
                    expose: false
                DB_HOST:
                    default: ${MYSQL_HOST}
                    expose: false
                DB_PASSWORD:
                    default: ${MYSQL_PASSWORD}
                    expose: false
                DB_PORT:
                    default: ${MYSQL_PORT}
                DB_USERNAME:
                    default: root
                    expose: false
                IMAGE_LIB:
                    default: gd
                    expose: false
                LOGIN_LOCKOUT_DURATION:
                    default: "300"
                    expose: false
                LOGIN_MAX_ATTEMPTS:
                    default: "5"
                    expose: false
                MAX_RESULTS:
                    default: "100"
                    expose: false
                PHP_MAX_EXECUTION_TIME:
                    default: "600"
                    expose: false
                PHP_MEMORY_LIMIT:
                    default: 512M
                    expose: false
                PHP_POST_MAX_SIZE:
                    default: 512M
                    expose: false
                PHP_UPLOAD_MAX_FILESIZE:
                    default: 512M
                    expose: false
                PRIVATE_FILESYSTEM_DISK:
                    default: local
                    expose: false
                PUBLIC_FILESYSTEM_DISK:
                    default: local_public
                    expose: false
            configs: []
            portForwarding:
                enabled: false
          domainKey: PUBLIC_DOMAIN
        - name: mysql
          icon: https://cdn.zeabur.com/marketplace/mysql.svg
          template: PREBUILT_V2
          spec:
            id: mysql
            source:
                image: mysql:8.0
            ports:
                - id: database
                  port: 3306
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/mysql
            instructions:
                - title: Command to connect to your MySQL
                  content: mysqlsh --sql --host=${PORT_FORWARDED_HOSTNAME} --port=${DATABASE_PORT_FORWARDED_PORT} --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} --schema=${MYSQL_DATABASE}
                - title: MySQL username
                  content: ${MYSQL_USERNAME}
                - title: MySQL password
                  content: ${MYSQL_PASSWORD}
                - title: MySQL database
                  content: ${MYSQL_DATABASE}
                - title: MySQL host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: MySQL port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                MYSQL_DATABASE:
                    default: zeabur
                    expose: true
                MYSQL_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                MYSQL_PASSWORD:
                    default: ${MYSQL_ROOT_PASSWORD}
                    expose: true
                MYSQL_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                MYSQL_ROOT_PASSWORD:
                    default: ${PASSWORD}
                    expose: false
                MYSQL_USERNAME:
                    default: root
                    expose: true
            configs:
                - path: /etc/my.cnf
                  template: |
                    [mysqld]
                    default-authentication-plugin=mysql_native_password
                    host-cache-size=0
                    skip-name-resolve
                    datadir=/var/lib/mysql
                    socket=/var/run/mysqld/mysqld.sock
                    secure-file-priv=/var/lib/mysql-files
                    user=mysql
                    max_allowed_packet=10M
                    performance_schema=off

                    pid-file=/var/run/mysqld/mysqld.pid
                    [client]
                    socket=/var/run/mysqld/mysqld.sock

                    !includedir /etc/mysql/conf.d/
                  permission: null
                  envsubst: null
            portForwarding:
                enabled: true
