---
version: '3'

vars:
  CLOUDFLARE_API_TOKEN: '' # Needed when `CONFIGURE_CLOUDFLARE_DNS` is set to `true`

  CLOUDFLARE_DNS_ZONE: '' # Needed when `CONFIGURE_CLOUDFLARE_DNS` is set to `true`
  CONFIGURE_CLOUDFLARE_DNS: false # Set to `true` to configure Cloudflare DNS to point to the custom domain. Provide values for the below variables when set to `true`
  CONFIGURE_CUSTOM_DOMAIN: false # Used in conjunction with `DOMAIN` value set for each application. Set to `true` to configure custom domains
env:
  REGION: us # The region to deploy the application to

tasks:
  appsmith:
    summary: |
      Task to deploy `appsmith` to Heroku.

      Below are the environment variables that can be configured. Set the values in the `env` section.

      APPSMITH_DISABLE_TELEMETRY: Share anonymous usage data
      APPSMITH_ENCRYPTION_PASSWORD: Encryption password to encrypt all sensitive credentials in the database. You can use any random string. The more random, the better.
      APPSMITH_ENCRYPTION_SALT: Encryption salt used to encrypt all sensitive credentials in the database. You can use any random string. The more random, the better.
      APPSMITH_MONGODB_URI: Your Mongo Database URI. Since Heroku doesn't support a managed MongoDB instance, you'll have to create a Mongo DB instance on another service such as https://cloud.mongodb.com
      APPSMITH_SUPERVISOR_PASSWORD: Basic authentication password to access Supervisor UI - An web interface, which allow you to manage various process

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    env:
      APPSMITH_DISABLE_TELEMETRY: true
      APPSMITH_ENCRYPTION_PASSWORD: 'kna%si*sj19lk>0s'
      APPSMITH_ENCRYPTION_SALT: 'm,a-01s'
      APPSMITH_MONGODB_URI: mongo.example.com
      APPSMITH_SUPERVISOR_PASSWORD: "sdf'6as9I1a"
    cmds:
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"appsmith-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/appsmithorg/appsmith/tarball/master\"},\
        \"overrides\":{\"env\":{\"APPSMITH_DISABLE_TELEMETRY\": $APPSMITH_DISABLE_TELEMETRY, \"APPSMITH_ENCRYPTION_PASSWORD\":\
        \"$APPSMITH_ENCRYPTION_PASSWORD\", \"APPSMITH_ENCRYPTION_SALT\": \"$APPSMITH_ENCRYPTION_SALT\", \"APPSMITH_MONGODB_URI\":\
        \"$APPSMITH_MONGODB_URI\", \"APPSMITH_SUPERVISOR_PASSWORD\": \"$APPSMITH_SUPERVISOR_PASSWORD\"}}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  appsmith-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: appsmith
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'

          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  baserow:
    summary: |
      Task to deploy `baserow` to Heroku.

      Below are the environment variables that can be configured. Set the values in the `env` section.

      BASEROW_PUBLIC_URL: The public URL of your Heroku Baserow app. If empty, the default Heroku app URL is used, but if it differs it must be changed. (eg. https://baserow-test.com).
      BASEROW_AMOUNT_OF_WORKERS: The amount of workers per dyno.
      AWS_ACCESS_KEY_ID: The spaces API key.
      AWS_SECRET_ACCESS_KEY: The spaces API secret key.
      AWS_STORAGE_BUCKET_NAME: The name of your space.
      AWS_S3_REGION_NAME: Name of the Digital Ocean spaces region (eg. ams3) or Name of the AWS S3 region to use (eg. eu-west-1)
      AWS_S3_ENDPOINT_URL: Custom S3 URL to use when connecting to S3, including scheme.
      AWS_S3_CUSTOM_DOMAIN: Your custom domain where the files can be downloaded from.

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    env:
      AWS_ACCESS_KEY_ID: ''
      AWS_S3_CUSTOM_DOMAIN: ''
      AWS_S3_ENDPOINT_URL: ''
      AWS_S3_REGION_NAME: ''
      AWS_SECRET_ACCESS_KEY: ''
      AWS_STORAGE_BUCKET_NAME: ''
      BASEROW_AMOUNT_OF_WORKERS: '1'
      BASEROW_PUBLIC_URL: https://baserow.megabyte.space
    cmds:
      - task: bucket:create
        vars:
          AWS_ACCESS_KEY_ID: '{{.AWS_ACCESS_KEY_ID}}'
          AWS_REGION: '{{.AWS_S3_REGION_NAME}}'
          AWS_SECRET_ACCESS_KEY: '{{.AWS_SECRET_ACCESS_KEY}}'
          BUCKET_NAME: '{{.AWS_STORAGE_BUCKET_NAME}}'
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"baserow-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/bram2w/baserow/tarball/master\"},\
        \"overrides\":{\"env\":{{\"BASEROW_PUBLIC_URL\":\"$BASEROW_PUBLIC_URL\",\"BASEROW_AMOUNT_OF_WORKERS\":\
        \"$BASEROW_AMOUNT_OF_WORKERS\",\"AWS_ACCESS_KEY_ID\":\"$AWS_ACCESS_KEY_ID\",\"AWS_SECRET_ACCESS_KEY\":\
        \"$AWS_SECRET_ACCESS_KEY\",\"AWS_STORAGE_BUCKET_NAME\":\"$AWS_STORAGE_BUCKET_NAME\",\"AWS_S3_REGION_NAME\":\
        \"$AWS_S3_REGION_NAME\",\"AWS_S3_ENDPOINT_URL\":\"$AWS_S3_ENDPOINT_URL\",\"AWS_S3_CUSTOM_DOMAIN\":\"$AWS_S3_CUSTOM_DOMAIN\"}}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  baserow-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: baserow
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'
          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  chatwoot:
    summary: |
      Task to deploy `chatwoot` to Heroku.

      Below are the environment variables that can be configured. Set the values in the `env` section.
      FRONTEND_URL: Public root URL of the Chatwoot installation. This will be used in the emails.
      INSTALLATION_ENV: Installation method used for Chatwoot.
      RACK_ENV: Environment for rack middleware.
      RAILS_ENV: Environment for rails middleware.
      REDIS_OPENSSL_VERIFY_MODE: OpenSSL verification mode for Redis connections. Ref https://help.heroku.com/HC0F8CUS/redis-connection-issues

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    env:
      FRONTEND_URL: https://chatwoot.megabyte.space
      INSTALLATION_ENV: heroku
      RACK_ENV: production
      RAILS_ENV: production
      REDIS_OPENSSL_VERIFY_MODE: none
    cmds:
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"chatwoot-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/chatwoot/chatwoot/tarball/master\"},\
        \"overrides\":{\"env\":{\"FRONTEND_URL\": \"$FRONTEND_URL\", \"INSTALLATION_ENV\": \"$INSTALLATION_ENV\", \"RACK_ENV\":\
        \"$RACK_ENV\", \"RAILS_ENV\": \"$RAILS_ENV\", \"REDIS_OPENSSL_VERIFY_MODE\": \"$REDIS_OPENSSL_VERIFY_MODE\"}}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  chatwoot-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: chatwoot
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'

          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  directus:
    summary: |
      Task to deploy `directus` to Heroku.

      Below are the environment variables that can be configured. Set the values in the `env` section.

      ACCESS_TOKEN_TTL: The access token TTL.
      ADMIN_EMAIL: The initial admin email.
      ADMIN_PASSWORD: The initial admin password.
      CACHE_ENABLED: Whether the cache should be enabled or not.
      CACHE_NAMESPACE: The cache namespace.
      CACHE_STORE: The cache store to use.
      CONFIG_PATH: Application config loader path.
      DB_CLIENT: Database server type.
      EMAIL_SMTP_HOST: The email server host.
      EMAIL_SMTP_POOL: Whether to setup smtp pooling or not.
      EMAIL_SMTP_PORT: The email server port.
      EMAIL_SMTP_SECURE: Whether email connection is secure or not.
      EMAIL_TRANSPORT: The email transport.
      EXTENSIONS_PATH: The application's extension folder.
      OAUTH_PROVIDERS: OAuth providers.
      PUBLIC_URL: Application public URL.
      RATE_LIMITER_DURATION: Rate limiter duration in minutes.
      RATE_LIMITER_ENABLED: Whether the rate limiter should be enabled or not.
      RATE_LIMITER_KEY_PREFIX: The rate limiter key prefixes.
      RATE_LIMITER_POINTS: Rate limiter points.
      RATE_LIMITER_STORE: The rate limiter storage type.
      REFRESH_TOKEN_COOKIE_SAME_SITE: Same site cookie policy.
      REFRESH_TOKEN_COOKIE_SECURE: Whether cookies should be secure (http-only) or not.
      REFRESH_TOKEN_TTL: The refresh token TTL.
      STORAGE_CLOUD_BUCKET: The storage bucket name.
      STORAGE_CLOUD_DRIVER: The storage driver.
      STORAGE_CLOUD_ENDPOINT: The storage endpoint URL.
      STORAGE_CLOUD_KEY: The storage key id.
      STORAGE_CLOUD_PUBLIC_URL: The storage key id.
      STORAGE_CLOUD_REGION: The storage bucket region.
      STORAGE_CLOUD_ROOT: Storage root location.
      STORAGE_CLOUD_SECRET: The storage secret key.
      STORAGE_LOCATIONS: The storage key. Please refer to the docs for more information.

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    env:
      ACCESS_TOKEN_TTL: 15m
      ADMIN_EMAIL: admin@email.com
      ADMIN_PASSWORD: RandomPasword$
      CACHE_ENABLED: true
      CACHE_NAMESPACE: cache
      CACHE_STORE: redis
      CONFIG_PATH: /app/directus.config.js
      DB_CLIENT: pg
      EMAIL_SMTP_HOST: smtp.example.com
      EMAIL_SMTP_POOL: true
      EMAIL_SMTP_PORT: '587'
      EMAIL_SMTP_SECURE: false
      EMAIL_TRANSPORT: smtp
      EXTENSIONS_PATH: /app/extensions
      OAUTH_PROVIDERS: ''
      PUBLIC_URL: /
      RATE_LIMITER_DURATION: '1'
      RATE_LIMITER_ENABLED: true
      RATE_LIMITER_KEY_PREFIX: rate-limitter
      RATE_LIMITER_POINTS: '30'
      RATE_LIMITER_STORE: redis
      REFRESH_TOKEN_COOKIE_SAME_SITE: true
      REFRESH_TOKEN_COOKIE_SECURE: true
      REFRESH_TOKEN_TTL: 7d
      STORAGE_CLOUD_BUCKET: your-bucket
      STORAGE_CLOUD_DRIVER: s3
      STORAGE_CLOUD_ENDPOINT: https://nyc3.digitaloceanspaces.com
      STORAGE_CLOUD_KEY: your-s3-key-id
      STORAGE_CLOUD_PUBLIC_URL: https://your-bucket.nyc3.digitaloceanspaces.com
      STORAGE_CLOUD_REGION: nyc3
      STORAGE_CLOUD_ROOT: /
      STORAGE_CLOUD_SECRET: your-s3-secret-key
      STORAGE_LOCATIONS: cloud
    cmds:
      - task: bucket:create
        vars:
          AWS_ACCESS_KEY_ID: '{{.STORAGE_CLOUD_KEY}}'
          AWS_REGION: '{{.STORAGE_CLOUD_REGION}}'
          AWS_SECRET_ACCESS_KEY: '{{.STORAGE_CLOUD_SECRET}}'
          BUCKET_NAME: '{{.STORAGE_CLOUD_BUCKET}}'
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"directus-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/directus-community/heroku-template/tarball/master\"},\
        \"overrides\":{\"env\":{\"ACCESS_TOKEN_TTL\": \"$ACCESS_TOKEN_TTL\", \"ADMIN_EMAIL\": \"$ADMIN_EMAIL\", \"ADMIN_PASSWORD\":\
        \"$ADMIN_PASSWORD$\", \"CACHE_ENABLED\": $CACHE_ENABLED, \"CACHE_NAMESPACE\": \"$CACHE_NAMESPACE\", \"CACHE_STORE\":\
        \"$CACHE_STORE\", \"CONFIG_PATH\": \"$CONFIG_PATH\", \"DB_CLIENT\": \"$DB_CLIENT\", \"EMAIL_SMTP_HOST\": \"$EMAIL_SMTP_HOST\",\
        \"EMAIL_SMTP_POOL\": $EMAIL_SMTP_POOL, \"EMAIL_SMTP_PORT\": \"$EMAIL_SMTP_PORT\", \"EMAIL_SMTP_SECURE\": $EMAIL_SMTP_SECURE,\
        \"EMAIL_TRANSPORT\": \"$EMAIL_TRANSPORT\", \"EXTENSIONS_PATH\": \"$EXTENSIONS_PATH\", \"OAUTH_PROVIDERS\": \"$OAUTH_PROVIDERS\",\
        \"PUBLIC_URL\": \"$PUBLIC_URL\", \"RATE_LIMITER_DURATION\": \"$RATE_LIMITER_DURATION\", \"RATE_LIMITER_ENABLED\": $RATE_LIMITER_ENABLED,\
        \"RATE_LIMITER_KEY_PREFIX\": \"$RATE_LIMITER_KEY_PREFIX\", \"RATE_LIMITER_POINTS\": \"$RATE_LIMITER_POINTS\", \"RATE_LIMITER_STORE\":\
        \"$RATE_LIMITER_STORE\", \"REFRESH_TOKEN_COOKIE_SAME_SITE\": $REFRESH_TOKEN_COOKIE_SAME_SITE, \"REFRESH_TOKEN_COOKIE_SECURE\":\
        \"$REFRESH_TOKEN_COOKIE_SECURE\", \"REFRESH_TOKEN_TTL\": \"$REFRESH_TOKEN_TTL\", \"STORAGE_CLOUD_BUCKET\": \"$STORAGE_CLOUD_BUCKET\",\
        \"STORAGE_CLOUD_DRIVER\": \"$STORAGE_CLOUD_DRIVER\", \"STORAGE_CLOUD_ENDPOINT\": \"$STORAGE_CLOUD_ENDPOINT\", \"STORAGE_CLOUD_KEY\":\
        \"$STORAGE_CLOUD_KEY\", \"STORAGE_CLOUD_PUBLIC_URL\": \"$STORAGE_CLOUD_PUBLIC_URL\", \"STORAGE_CLOUD_REGION\": \"$STORAGE_CLOUD_REGION\",\
        \"STORAGE_CLOUD_ROOT\": \"$STORAGE_CLOUD_ROOT\", \"STORAGE_CLOUD_SECRET\": \"$STORAGE_CLOUD_SECRET\", \"STORAGE_LOCATIONS\": \"$STORAGE_LOCATIONS\"}}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  directus-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: directus
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'

          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  ghostonheroku:
    summary: |
      Task to deploy `ghost-on-heroku` to Heroku.

      Below are the environment variables that can be configured. Set the values in the `env` section.

      PUBLIC_URL: The HTTPS URL of this app: either your custom domain or default 'herokuapp.com' hostname.
      S3_ACCESS_KEY_ID: Set your AWS Access Key ID to enable S3 file storage. Leave blank to disable file uploads.
      S3_ACCESS_SECRET_KEY: AWS Access Secret Key, if using S3 file storage.
      S3_ASSET_HOST_URL: Optional custom CDN asset host url, if using S3 file storage.
      S3_BUCKET_NAME: Name of your S3 bucket on AWS, if using S3 file storage.
      S3_BUCKET_REGION: Region of your S3 bucket on AWS, if using S3 file storage.

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    env:
      PUBLIC_URL: https://ghost.megabyte.space
      S3_ACCESS_KEY_ID: S3 access key id
      S3_ACCESS_SECRET_KEY: S3 secret access key
      S3_ASSET_HOST_URL: e.g https://my.custom.domain/
      S3_BUCKET_NAME: S3 bucket
      S3_BUCKET_REGION: S3 bucket region (e.g. us-east-1)

    cmds:
      - task: bucket:create
        vars:
          AWS_ACCESS_KEY_ID: '{{.S3_ACCESS_KEY_ID}}'
          AWS_REGION: '{{.S3_BUCKET_REGION}}'
          AWS_SECRET_ACCESS_KEY: '{{.S3_ACCESS_SECRET_KEY}}'
          BUCKET_NAME: '{{.S3_BUCKET_NAME}}'
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"ghostonheroku-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/cobyism/ghost-on-heroku/tarball/master\"},\
        \"overrides\":{\"env\":{\"PUBLIC_URL\": \"$PUBLIC_URL\", \"S3_ACCESS_KEY_ID\": \"$S3_ACCESS_KEY_ID\",\
        \"S3_ACCESS_SECRET_KEY\": \"$S3_ACCESS_SECRET_KEY\", \"S3_ASSET_HOST_URL\": \"$S3_ASSET_HOST_URL\",\
        \"S3_BUCKET_NAME\": \"$S3_BUCKET_NAME\", \"S3_BUCKET_REGION\": \"$S3_BUCKET_REGION\"}}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  ghostonheroku-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: ghostonheroku
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'

          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  hasura:
    summary: |
      Task to deploy `hasura` to Heroku.

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    cmds:
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"hasura-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/hasura/graphql-engine-heroku/tarball/master\"}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  hasura-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: hasura
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'

          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  manet:
    summary: |
      Task to deploy `manet` to Heroku.

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    cmds:
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"manet-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/vbauer/manet/tarball/master\"}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  manet-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: manet
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'
          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  metabase:
    summary: |
      Task to deploy `metabase` to Heroku.

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    cmds:
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"metabase-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/metabase/metabase-deploy/tarball/master\"}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  metabase-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: metabase
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'

          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  nocodb:
    summary: |
      Task to deploy `nocodb` to Heroku.

      Below are the environment variables that can be configured. Set the values in the `env` section.

      NC_ONE_CLICK: Used for Heroku one-click deployment
      NODE_TLS_REJECT_UNAUTHORIZED: Reject unauthorized
      AWS_ACCESS_KEY_ID: For Litestream - S3 access key id
      AWS_SECRET_ACCESS_KEY: For Litestream - S3 secret access key
      AWS_BUCKET_REGION: Region where the bucket is present
      AWS_BUCKET: For Litestream - S3 bucket
      AWS_BUCKET_PATH: For Litestream - S3 bucket path (like folder within S3 bucket)

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    env:
      AWS_ACCESS_KEY_ID: S3 access key id
      AWS_BUCKET: S3 bucket
      AWS_BUCKET_PATH: S3 bucket path (like folder within S3 bucket)

      AWS_BUCKET_REGION: S3 Region
      AWS_SECRET_ACCESS_KEY: S3 secret access key
      NC_ONE_CLICK: true
      NODE_TLS_REJECT_UNAUTHORIZED: '0'
    cmds:
      - task: bucket:create
        vars:
          AWS_ACCESS_KEY_ID: '{{.AWS_ACCESS_KEY_ID}}'
          AWS_REGION: '{{.AWS_BUCKET_REGION}}'
          AWS_SECRET_ACCESS_KEY: '{{.AWS_SECRET_ACCESS_KEY}}'
          BUCKET_NAME: '{{.AWS_BUCKET}}'
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"nocodb-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/nocodb/nocodb-seed-heroku/tarball/master\"},\
        \"overrides\":{\"env\":{\"NC_ONE_CLICK\": $NC_ONE_CLICK, \"NODE_TLS_REJECT_UNAUTHORIZED\": \"$NODE_TLS_REJECT_UNAUTHORIZED\",\
        \"AWS_ACCESS_KEY_ID\": \"$AWS_ACCESS_KEY_ID\", \"AWS_SECRET_ACCESS_KEY\": \"$AWS_SECRET_ACCESS_KEY\", \"AWS_BUCKET\":\
        \"$AWS_BUCKET\", \"AWS_BUCKET_PATH\": \"$AWS_BUCKET_PATH\"}}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  nocodb-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: nocodb
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'

          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  tooljet:
    summary: |
      Task to deploy `tooljet` to Heroku.

      Below are the environment variables that can be configured. Set the values in the `env` section.

      DEPLOYMENT_PLATFORM: Platform ToolJet is deployed on
      DISABLE_MULTI_WORKSPACE: Disables Multi-Workspace feature
      DISABLE_SIGNUPS: Disable sign up in login page only applicable if Multi-Workspace feature is turned on
      LOCKBOX_MASTER_KEY: Master key for encrypting datasource credentials.
      NODE_ENV: Environment [production/development]
      NODE_OPTIONS: Node options configured to increase node memory to support app build
      SECRET_KEY_BASE: Used by ToolJet server as the input secret to the application's key generator.
      TOOLJET_HOST: Public URL of ToolJet installtion. This is usually https://<app-name-in-first-step>.herokuapp.com
      TOOLJET_SERVER_URL: URL of ToolJet server installtion. (This is same as the TOOLJET_HOST for Heroku deployments)

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    env:
      DEPLOYMENT_PLATFORM: heroku
      DISABLE_MULTI_WORKSPACE: false
      DISABLE_SIGNUPS: false
      LOCKBOX_MASTER_KEY: m@s73rk8s
      NODE_ENV: production
      NODE_OPTIONS: --max-old-space-size=4096
      SECRET_KEY_BASE: SomeC0m6l00
      TOOLJET_HOST: https://tooljet.herokuapp.com
      TOOLJET_SERVER_URL: https://tooljet.herokuapp.com

    cmds:
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"tooljet-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/tooljet/tooljet/tarball/master\"},\
        \"overrides\":{\"env\":{\"DEPLOYMENT_PLATFORM\": \"$DEPLOYMENT_PLATFORM\", \"DISABLE_MULTI_WORKSPACE\":\
        \"$DISABLE_MULTI_WORKSPACE\", \"DISABLE_SIGNUPS\": $DISABLE_SIGNUPS, \"LOCKBOX_MASTER_KEY\":\
        \"$LOCKBOX_MASTER_KEY\", \"NODE_ENV\": \"$NODE_ENV\", \"NODE_OPTIONS\": \"$NODE_OPTIONS\",\
        \"SECRET_KEY_BASE\": \"$SECRET_KEY_BASE\", \"TOOLJET_HOST\": \"$TOOLJET_HOST\", \"TOOLJET_SERVER_URL\": \"$TOOLJET_SERVER_URL\"}}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  tooljet-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: tooljet
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'
          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  urltopdf:
    summary: |
      Task to deploy `url-to-pdf-api` to Heroku.

      Below are the environment variables that can be configured. Set the values in the `env` section.

      ALLOW_HTTP: When set to "true", unsecure requests are allowed
      API_TOKENS: Comma-separated list of accepted keys in x-api-key header

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    env:
      ALLOW_HTTP: false
      API_TOKENS: ''
    cmds:
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body "{\"app\":{\"region\":\"$REGION\",\"name\":\"urltopdf-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/alvarcarto/url-to-pdf-api/tarball/master\"},\
        \"overrides\":{\"env\":{\"ALLOW_HTTP\": $ALLOW_HTTP, \"API_TOKENS\": \"$API_TOKENS\"}}}"
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  urltopdf-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: urltopdf
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'

          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'
  whoogle:
    summary: |
      Task to deploy `whoogle` to Heroku.

      Below are the environment variables that can be configured. Set the values in the `env` section.

      WHOOGLE_ALT_IG: The site to use as a replacement for instagram.com when site alternatives are enabled in the config.
      WHOOGLE_ALT_IMG: The site to use as a replacement for imgur.com when site alternatives are enabled in the config.
      WHOOGLE_ALT_MD: The site to use as a replacement for medium.com when site alternatives are enabled in the config.
      WHOOGLE_ALT_RD: The site to use as a replacement for reddit.com when site alternatives are enabled in the config.
      WHOOGLE_ALT_TL: The Google Translate alternative to use for all searches following the 'translate ___' structure.
      WHOOGLE_ALT_TW: The site to use as a replacement for twitter.com when site alternatives are enabled in the config.
      WHOOGLE_ALT_WIKI: The site to use as a replacement for wikipedia.com when site alternatives are enabled in the config.
      WHOOGLE_ALT_YT: The site to use as a replacement for youtube.com when site alternatives are enabled in the config.
      WHOOGLE_CONFIG_ALTS: [CONFIG] Use social media alternatives (set to 1 or leave blank)
      WHOOGLE_CONFIG_BLOCK: [CONFIG] Block websites from search results (comma-separated list)
      WHOOGLE_CONFIG_COUNTRY: [CONFIG] The country to use for restricting search results (use values from https://raw.githubusercontent.com/benbusby/whoogle-search/develop/app/static/settings/countries.json)
      WHOOGLE_CONFIG_DISABLE: [CONFIG] Disable ability for client to change config (set to 1 or leave blank)
      WHOOGLE_CONFIG_GET_ONLY: [CONFIG] Search using GET requests only (set to 1 or leave blank)
      WHOOGLE_CONFIG_LANGUAGE: [CONFIG] The language to use for the interface (use values from https://raw.githubusercontent.com/benbusby/whoogle-search/develop/app/static/settings/languages.json)
      WHOOGLE_CONFIG_NEAR: [CONFIG] Restrict results to only those near a particular city
      WHOOGLE_CONFIG_NEW_TAB: [CONFIG] Always open results in new tab (set to 1 or leave blank)
      WHOOGLE_CONFIG_SAFE: [CONFIG] Use safe mode for searches (set to 1 or leave blank)
      WHOOGLE_CONFIG_SEARCH_LANGUAGE: [CONFIG] The language to use for search results (use values from https://raw.githubusercontent.com/benbusby/whoogle-search/develop/app/static/settings/languages.json)
      WHOOGLE_CONFIG_STYLE: [CONFIG] Custom CSS styling (provide CSS or leave blank)
      WHOOGLE_CONFIG_THEME: [CONFIG] Set theme to 'dark', 'light', or 'system'
      WHOOGLE_CONFIG_TOR: [CONFIG] Use Tor, if available (set to 1 or leave blank)
      WHOOGLE_CONFIG_VIEW_IMAGE: [CONFIG] Enable View Image option (set to 1 or leave blank)
      WHOOGLE_MINIMAL: Remove everything except basic result cards from all search queries (set to 1 or leave blank)
      WHOOGLE_PASS: The password for basic auth. WHOOGLE_USER must also be set if used. Leave empty to disable.
      WHOOGLE_PROXY_LOC: The location of the proxy server (host or ip). Leave empty to disable.
      WHOOGLE_PROXY_PASS: The password of the proxy server. Leave empty to disable.
      WHOOGLE_PROXY_TYPE: The type of the proxy server. For example "socks5". Leave empty to disable.
      WHOOGLE_PROXY_USER: The username of the proxy server. Leave empty to disable.
      WHOOGLE_URL_PREFIX: The URL prefix to use for the whoogle instance (i.e. "/whoogle")
      WHOOGLE_USER: The username for basic auth. WHOOGLE_PASS must also be set if used. Leave empty to disable.

      The below variable can be used to pass the value of Custom Domain for the application
      DOMAIN: The custom domain to be added to the application. Set this to a valid value to add the domain (`CONFIGURE_CUSTOM_DOMAIN` should be set to `true`).
    vars:
      DOMAIN: ''
    env:
      WHOOGLE_ALT_IG: farside.link/bibliogram/u
      WHOOGLE_ALT_IMG: farside.link/rimgo
      WHOOGLE_ALT_MD: farside.link/scribe
      WHOOGLE_ALT_RD: farside.link/libreddit
      WHOOGLE_ALT_TL: farside.link/lingva
      WHOOGLE_ALT_TW: farside.link/nitter
      WHOOGLE_ALT_WIKI: farside.link/wikiless
      WHOOGLE_ALT_YT: farside.link/invidious
      WHOOGLE_CONFIG_ALTS: ''
      WHOOGLE_CONFIG_BLOCK: ''
      WHOOGLE_CONFIG_COUNTRY: countryUS
      WHOOGLE_CONFIG_DISABLE: ''
      WHOOGLE_CONFIG_GET_ONLY: ''
      WHOOGLE_CONFIG_LANGUAGE: lang_en
      WHOOGLE_CONFIG_NEAR: ''
      WHOOGLE_CONFIG_NEW_TAB: ''
      WHOOGLE_CONFIG_SAFE: ''
      WHOOGLE_CONFIG_SEARCH_LANGUAGE: lang_en
      WHOOGLE_CONFIG_STYLE: ':root { /* LIGHT THEME COLORS */ --whoogle-background: #d8dee9; --whoogle-accent: #2e3440; --whoogle-text: #3B4252; --whoogle-contrast-text: #eceff4; --whoogle-secondary-text: #70757a; --whoogle-result-bg: #fff; --whoogle-result-title: #4c566a; --whoogle-result-url: #81a1c1; --whoogle-result-visited: #a3be8c; /* DARK THEME COLORS */ --whoogle-dark-background: #222; --whoogle-dark-accent: #685e79; --whoogle-dark-text: #fff; --whoogle-dark-contrast-text: #000; --whoogle-dark-secondary-text: #bbb; --whoogle-dark-result-bg: #000; --whoogle-dark-result-title: #1967d2; --whoogle-dark-result-url: #4b11a8; --whoogle-dark-result-visited: #bbbbff; }'
      WHOOGLE_CONFIG_THEME: system
      WHOOGLE_CONFIG_TOR: ''
      WHOOGLE_CONFIG_VIEW_IMAGE: ''
      WHOOGLE_MINIMAL: ''
      WHOOGLE_PASS: ''
      WHOOGLE_PROXY_LOC: ''
      WHOOGLE_PROXY_PASS: ''
      WHOOGLE_PROXY_TYPE: ''
      WHOOGLE_PROXY_USER: ''
      WHOOGLE_URL_PREFIX: /whoogle
      WHOOGLE_USER: ''
    cmds:
      - |
        RNDM=$(shuf -i 10000-1000000 -n 1)
        heroku api POST /app-setups --body '{\"app\":{\"region\":\"$REGION\",\"name\":\"whoogle-$RNDM\"},\
        \"source_blob\":{\"url\":\"https://api.github.com/repos/benbusby/whoogle-search/tarball/master\"},\
        \"overrides\":{\"env\":{\"WHOOGLE_ALT_IG\": \"$WHOOGLE_ALT_IG\", \"WHOOGLE_ALT_IMG\":\
        \"$WHOOGLE_ALT_IMG\", \"WHOOGLE_ALT_MD\": \"$WHOOGLE_ALT_MD\", \"WHOOGLE_ALT_RD\": \"$WHOOGLE_ALT_RD\",\
        \"WHOOGLE_ALT_TL\": \"$WHOOGLE_ALT_TL\", \"WHOOGLE_ALT_TW\": \"$WHOOGLE_ALT_TW\", \"WHOOGLE_ALT_WIKI\":\
        \"$WHOOGLE_ALT_WIKI\", \"WHOOGLE_ALT_YT\": \"$WHOOGLE_ALT_YT\", \"WHOOGLE_CONFIG_ALTS\": \"$WHOOGLE_CONFIG_ALTS\",\
        \"WHOOGLE_CONFIG_BLOCK\": \"$WHOOGLE_CONFIG_BLOCK\", \"WHOOGLE_CONFIG_COUNTRY\": \"$WHOOGLE_CONFIG_COUNTRY\",\
        \"WHOOGLE_CONFIG_DISABLE\": \"$WHOOGLE_CONFIG_DISABLE\", \"WHOOGLE_CONFIG_GET_ONLY\": \"$WHOOGLE_CONFIG_GET_ONLY\",\
        \"WHOOGLE_CONFIG_LANGUAGE\": \"$WHOOGLE_CONFIG_LANGUAGE\", \"WHOOGLE_CONFIG_NEAR\": \"$WHOOGLE_CONFIG_NEAR\",\
        \"WHOOGLE_CONFIG_NEW_TAB\": \"$WHOOGLE_CONFIG_NEW_TAB\", \"WHOOGLE_CONFIG_SAFE\": \"$WHOOGLE_CONFIG_SAFE\",\
        \"WHOOGLE_CONFIG_SEARCH_LANGUAGE\": \"$WHOOGLE_CONFIG_SEARCH_LANGUAGE\", \"WHOOGLE_CONFIG_STYLE\":\
        \"$WHOOGLE_CONFIG_STYLE\", \"WHOOGLE_CONFIG_THEME\": \"$WHOOGLE_CONFIG_THEME\", \"WHOOGLE_CONFIG_TOR\":\
        \"$WHOOGLE_CONFIG_TOR\", \"WHOOGLE_CONFIG_VIEW_IMAGE\": \"$WHOOGLE_CONFIG_VIEW_IMAGE\", \"WHOOGLE_MINIMAL\":\
        \"$WHOOGLE_MINIMAL\", \"WHOOGLE_PASS\": \"$WHOOGLE_PASS\", \"WHOOGLE_PROXY_LOC\": \"$WHOOGLE_PROXY_LOC\",\
        \"WHOOGLE_PROXY_PASS\": \"$WHOOGLE_PROXY_PASS\", \"WHOOGLE_PROXY_TYPE\": \"$WHOOGLE_PROXY_TYPE\",\
        \"WHOOGLE_PROXY_USER\": \"$WHOOGLE_PROXY_USER\", \"WHOOGLE_URL_PREFIX\": \"$WHOOGLE_URL_PREFIX\", \"WHOOGLE_USER\": \"$WHOOGLE_USER\"}}}'
        {{if and (eq .CONFIGURE_CUSTOM_DOMAIN "true") (ne .DOMAIN "")}}heroku domains:add {{.DOMAIN}} -a  whoogle-$RNDM {{end}}
      - task: cloudflare:dns
        vars:
          CLOUDFLARE_API_TOKEN: '{{.CLOUDFLARE_API_TOKEN}}'
          CLOUDFLARE_DNS_ZONE: '{{.CLOUDFLARE_DNS_ZONE}}'
          CLOUDFLARE_RECORD_NAME: whoogle
          CLOUDFLARE_RECORD_VALUE: '{{.DOMAIN}}'
          CONFIGURE_CLOUDFLARE_DNS: '{{.CONFIGURE_CLOUDFLARE_DNS}}'