# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: YOURLS
spec:
    description: The de facto standard self-hosted URL shortener
    icon: https://cdn.zeabur.com/marketplace/yourls.svg
    variables:
        - key: YOURLS_DOMAIN
          type: DOMAIN
          name: YOURLS Domain
          description: The domain name of YOURLS.
        - key: YOURLS_USER
          type: STRING
          name: YOURLS Username
          description: The username of YOURLS admin panel.
        - key: YOURLS_PASS
          type: PASSWORD
          name: YOURLS Password
          description: The password of YOURLS admin panel.
    readme: "# YOURLS\n\nYOURLS is a set of PHP scripts that will allow you to run Your Own URL Shortener,\non your server. You'll have full control over your data, detailed stats, analytics,\nplugins, and more. It's free and open-source.\n\n## How to use\n\n1. Access the admin panel at the `/admin` path of your domain, e.g., `https://your.domain/admin`.  \n2. Click the \"Setup\" button to set up the YOURLS if it is not set up yet.\n3. Log in with the username and password you provided.\n\nNote: You must restart the service after setting the domain name.\n\n## Install plugins\n\nYou can find plugins on [Awesome YOURLS](https://github.com/YOURLS/awesome).\n\nWhen you find the plugin you want to install, download the zip file and put the files to the\ncorresponding directory (`/var/www/html/user/plugins/<your-plugin-name>`) with\n[Config Editor](https://zeabur.com/docs/data-management/config-edit), and restart the service.\n\nFor example, if you want to install the [404-not-found](https://github.com/YOURLS/404-if-not-found) plugin,\nput the [plugin.php](https://github.com/YOURLS/404-if-not-found/blob/master/plugin.php) file to the\n`/var/www/html/user/plugins/404-if-not-found` directory. After restarting the service,\nyou can access the plugin in the admin panel.\n\n![Plugin Installation](https://cdn.zeabur.com/templates/yourls/plugin-installation.png)\n"
    services:
        - name: mariadb
          icon: https://cdn.zeabur.com/mariadb.svg
          template: PREBUILT
          spec:
            id: mariadb
            source:
                image: mariadb:12
            ports:
                - id: database
                  port: 3306
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/mysql
            instructions:
                - title: Command to connect to your MariaDB
                  content: mariadb --host ${PORT_FORWARDED_HOSTNAME} --port=${DATABASE_PORT_FORWARDED_PORT} --user=${MARIADB_USERNAME} --password=${MARIADB_PASSWORD} --database=${MARIADB_DATABASE}
                - title: MariaDB username
                  content: ${MARIADB_USERNAME}
                - title: MariaDB password
                  content: ${MARIADB_PASSWORD}
                - title: MariaDB database
                  content: ${MARIADB_DATABASE}
                - title: MariaDB host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: MariaDB port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                MARIADB_DATABASE:
                    default: zeabur
                    expose: true
                MARIADB_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                MARIADB_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                MARIADB_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                MARIADB_ROOT_PASSWORD:
                    default: ${PASSWORD}
                MARIADB_USERNAME:
                    default: root
                    expose: true
            configs:
                - path: /etc/mysql/conf.d/99-custom.cnf
                  template: |
                    ; see https://mariadb.com/kb/en/server-system-variables/#setting-server-system-variables for configuration
                    key_buffer_size = 16K
                  permission: null
                  envsubst: null
        - name: yourls
          icon: https://cdn.zeabur.com/marketplace/yourls.svg
          template: PREBUILT_V2
          spec:
            id: yourls
            source:
                image: yourls:1.10.2
            ports:
                - id: web
                  port: 8080
                  type: HTTP
            instructions:
                - title: Go to Admin Panel
                  content: ${ZEABUR_WEB_URL}admin
                - title: Username
                  content: ${YOURLS_USER}
                - title: Password
                  content: ${YOURLS_PASS}
            env:
                YOURLS_DB_HOST:
                    default: ${MARIADB_HOST}:${MARIADB_PORT}
                    expose: false
                YOURLS_DB_NAME:
                    default: ${MARIADB_DATABASE}
                    expose: false
                YOURLS_DB_PASS:
                    default: ${MARIADB_PASSWORD}
                    expose: false
                YOURLS_DB_USER:
                    default: ${MARIADB_USERNAME}
                    expose: false
                YOURLS_SITE:
                    default: https://${ZEABUR_WEB_DOMAIN}
                    expose: false
            healthCheck:
                type: HTTP
                port: web
                http:
                    path: /admin
          domainKey: YOURLS_DOMAIN
localization:
    ja-JP:
        description: デファクトスタンダードなセルフホスト型URL短縮ツール
        readme: |
            # YOURLS

            YOURLSは、ご自身のサーバー上で独自のURL短縮ツールを実行できるようにするPHPスクリプトのセットです。データ、詳細な統計、分析、プラグインなどを完全に制御できます。無料でオープンソースです。

            ## 使い方

            1. ドメインの `/admin` パス（例: `https://your.domain/admin`）にある管理パネルにアクセスします。
            2. 「Setup」ボタンをクリックして YOURLS を設定します（まだ設定されていない場合）。
            3. 設定したユーザー名とパスワードでログインします。

            注意: ドメイン名を設定した後は、サービスを再起動する必要があります。

            ## プラグインのインストール

            プラグインは [Awesome YOURLS](https://github.com/YOURLS/awesome) で見つけることができます。

            インストールしたいプラグインを見つけたら、zipファイルをダウンロードし、対応するディレクトリ (`/var/www/html/user/plugins/<your-plugin-name>`) に
            [Config Editor](https://zeabur.com/docs/data-management/config-edit) を使用してファイルを配置し、サービスを再起動します。

            例えば、[404-not-found](https://github.com/YOURLS/404-if-not-found) プラグインをインストールしたい場合、
            [plugin.php](https://github.com/YOURLS/404-if-not-found/blob/master/plugin.php) ファイルを `/var/www/html/user/plugins/404-if-not-found` ディレクトリに配置します。
            サービスを再起動後、管理パネルでプラグインにアクセスできます。

            ![Plugin Installation](https://cdn.zeabur.com/templates/yourls/plugin-installation.png)
    zh-CN:
        description: 事实上的标准自托管 URL 缩短器
        readme: |
            # YOURLS

            YOURLS 是一套 PHP 脚本，允许您在服务器上运行自己的 URL 缩短器。您可以完全控制您的数据、详细的统计信息、分析、插件等。它是免费且开源的。

            ## 如何使用

            1. 访问您域名的 `/admin` 路径进入管理面板，例如 `https://your.domain/admin`。
            2. 点击“Setup”按钮设置 YOURLS（如果还没有设置）。
            3. 使用您设置的用户名和密码登录。

            注意：设置域名后必须重启服务。

            ## 安装插件

            您可以在 [Awesome YOURLS](https://github.com/YOURLS/awesome) 上找到插件。

            当您找到想要安装的插件时，下载 zip 文件并将其放入相应的目录 (`/var/www/html/user/plugins/<your-plugin-name>`) 中
            [Config Editor](https://zeabur.com/docs/data-management/config-edit)，并重启服务。

            例如，如果您想要安装 [404-not-found](https://github.com/YOURLS/404-if-not-found) 插件，
            将 [plugin.php](https://github.com/YOURLS/404-if-not-found/blob/master/plugin.php) 文件放入 `/var/www/html/user/plugins/404-if-not-found` 目录中。
            重启服务后，您可以在管理面板中访问该插件。

            ![Plugin Installation](https://cdn.zeabur.com/templates/yourls/plugin-installation.png)
    zh-TW:
        description: 事實上的標準自託管 URL 縮短器
        readme: |
            # YOURLS

            YOURLS 是一套 PHP 腳本，允許您在伺服器上執行自己的 URL 縮短器。您可以完全控制您的資料、詳細的統計資訊、分析、外掛程式等。它是免費且開源的。

            ## 如何使用

            1. 前往您網域的 `/admin` 路徑進入管理面板，例如 `https://your.domain/admin`。
            2. 點選「Setup」按鈕設定 YOURLS（如果還沒有設定）。
            2. 使用您設定的使用者名稱和密碼登入。

            注意：設定網域後必須重新啟動服務。

            ## 安裝外掛程式

            您可以在 [Awesome YOURLS](https://github.com/YOURLS/awesome) 上找到外掛程式。

            當您找到想要安裝的外掛程式時，下載 zip 檔案並將其放入相應的目錄 (`/var/www/html/user/plugins/<your-plugin-name>`) 中
            使用 [Config Editor](https://zeabur.com/docs/data-management/config-edit)，並重新啟動服務。

            例如，如果您想要安裝 [404-not-found](https://github.com/YOURLS/404-if-not-found) 外掛程式，
            將 [plugin.php](https://github.com/YOURLS/404-if-not-found/blob/master/plugin.php) 檔案放入 `/var/www/html/user/plugins/404-if-not-found` 目錄中。
            重新啟動服務後，您可以在管理面板中存取該外掛程式。

            ![Plugin Installation](https://cdn.zeabur.com/templates/yourls/plugin-installation.png)
