# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: CodiMD
spec:
    description: CodiMD lets you collaborate in real-time with markdown.
    coverImage: https://raw.githubusercontent.com/hackmdio/codimd/develop/public/screenshot.png
    icon: https://i.imgur.com/GA0pa1R.png
    tags:
        - Tool
    readme: "CodiMD lets you collaborate in real-time with markdown.\nBuilt on [HackMD](https://hackmd.io) source code, CodiMD lets you host and control your team's content with speed and ease.\n\n\n\n\n\n## HackMD\n\n[HackMD](https://hackmd.io) helps developers write better documents and build active communities with open collaboration.\nHackMD is built with one promise - **You own and control all your content**:\n- You should be able to easily [download all your online content at once](https://hackmd.io/c/news/%2Fs%2Fr1cx3a3SE).\n- Your content formatting should be portable as well. (That's why we choose [markdown](https://hackmd.io/features#Typography).)\n- You should be able to control your content's presentation with HTML, [slide mode](https://hackmd.io/p/slide-example), or [book mode](https://hackmd.io/c/book-example/).\n\n## CodiMD - The Open Source HackMD\n\nCodiMD is the free software version of [HackMD](https://hackmd.io), developed and opened source by the HackMD team with reduced features (without book mode), you can use CodiMD for your community and own all your data. *(See the [origin of the name CodiMD](https://github.com/hackmdio/hackmd/issues/720).)* \n\nCodiMD is perfect for open communities, while HackMD emphasizes on permission and access controls for commercial use cases. \n\nHackMD team is committed to keep CodiMD open source. All contributions are welcome!\n\n## Documentation\nYou would find all documentation here: [CodiMD Documentation](https://hackmd.io/c/codimd-documentation)\n\n### Deployment\nIf you want to spin up an instance and start using immediately, see [Docker deployment](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-docker-deployment).\nIf you want to contribute to the project, start with [manual deployment](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-manual-deployment).\n\n### Configuration\nCodiMD is highly customizable, learn about all configuration options of networking, security, performance, resources, privilege, privacy, image storage, and authentication in [CodiMD Configuration](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration).\n\n### Upgrading and Migration\nUpgrade CodiMD from previous version? See [this guide](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-upgrade)<br>\nMigrating from Etherpad? Follow [this guide](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-migration-etherpad)\n\n### Developer\nJoin our contributor community! Start from deploying [CodiMD manually](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-manual-deployment), [connecting to your own database](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-db-connection), [learn about the project structure](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-project-structure), to [build your changes](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-webpack) with the help of webpack.\n\n## Browser Support\n\nCodiMD is a service that runs on Node.js, while users use the service through browsers. We support your users using the following browsers: \n- <img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png\" alt=\"Chrome\" width=\"24px\" height=\"24px\" /> Chrome >= 47, Chrome for Android >= 47\n- <img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png\" alt=\"Safari\" width=\"24px\" height=\"24px\" /> Safari >= 9, iOS Safari >= 8.4\n- <img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png\" alt=\"Firefox\" width=\"24px\" height=\"24px\" /> Firefox >= 44\n- <img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png\" alt=\"Edge\" width=\"24px\" height=\"24px\" /> Edge >= 12\n- <img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png\" alt=\"Opera\" width=\"24px\" height=\"24px\" /> Opera >= 34, Opera Mini not supported\n- Android Browser >= 4.4\n\nTo stay up to date with your installation it's recommended to subscribe the [release feed][github-release-feed].\n\n## License\n\n**License under AGPL.**\n\n[gitter-image]: https://img.shields.io/badge/gitter-hackmdio/codimd-blue.svg\n[gitter-url]: https://gitter.im/hackmdio/hackmd\n[travis-image]: https://travis-ci.com/hackmdio/codimd.svg?branch=master\n[travis-url]: https://travis-ci.com/hackmdio/codimd\n[github-version-badge]: https://img.shields.io/github/release/hackmdio/codimd.svg\n[github-release-page]: https://github.com/hackmdio/codimd/releases\n[github-release-feed]: https://github.com/hackmdio/codimd/releases.atom\n[poeditor-image]: https://img.shields.io/badge/POEditor-translate-blue.svg\n[poeditor-url]: https://poeditor.com/join/project/q0nuPWyztp\n[matrix-image]: https://img.shields.io/matrix/hackmdio_hackmd:gitter.im?color=blue&logo=matrix\n[matrix-url]: https://matrix.to/#/#hackmdio_hackmd:gitter.im"
    services:
        - name: PostgreSQL
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            source:
                image: postgres:16
                command:
                    - docker-entrypoint.sh
                    - -c
                    - config_file=/etc/postgresql/postgresql.conf
            ports:
                - id: database
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/data
            instructions:
                - title: Connection String
                  content: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}
                - title: PostgreSQL Connect Command
                  content: psql "postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}"
                - title: PostgreSQL username
                  content: ${POSTGRES_USERNAME}
                - title: PostgresSQL password
                  content: ${POSTGRES_PASSWORD}
                - title: PostgresSQL database
                  content: ${POSTGRES_DATABASE}
                - title: PostgreSQL host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: PostgreSQL port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                PGDATA:
                    default: /var/lib/postgresql/data/pgdata
                POSTGRES_CONNECTION_STRING:
                    default: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
                    expose: true
                POSTGRES_DATABASE:
                    default: ${POSTGRES_DB}
                    expose: true
                POSTGRES_DB:
                    default: zeabur
                POSTGRES_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                POSTGRES_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                POSTGRES_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                POSTGRES_URI:
                    default: ${POSTGRES_CONNECTION_STRING}
                    expose: true
                POSTGRES_USER:
                    default: root
                POSTGRES_USERNAME:
                    default: ${POSTGRES_USER}
                    expose: true
            configs:
                - path: /etc/postgresql/postgresql.conf
                  template: |
                    # https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample
                    listen_addresses = '*'
                    max_connections = 100
                    shared_buffers = 128MB
                    dynamic_shared_memory_type = posix
                    max_wal_size = 1GB
                    min_wal_size = 80MB
                    log_timezone = 'Etc/UTC'
                    datestyle = 'iso, mdy'
                    timezone = 'Etc/UTC'
                    lc_messages = 'en_US.utf8'
                    lc_monetary = 'en_US.utf8'
                    lc_numeric = 'en_US.utf8'
                    lc_time = 'en_US.utf8'
                    default_text_search_config = 'pg_catalog.english'
                  permission: null
                  envsubst: null
        - name: CodiMD
          icon: https://i.imgur.com/GA0pa1R.png
          template: PREBUILT
          spec:
            source:
                image: nabo.codimd.dev/hackmdio/hackmd:2.5.3
            ports:
                - id: web
                  port: 3000
                  type: HTTP
            volumes:
                - id: data
                  dir: /home/hackmd/app/public/uploads
            env:
                CMD_DB_URL:
                    default: postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
                CMD_USECDN:
                    default: "false"
