content: # fly.toml app configuration file generated 2024-04-26T14:34:31-07:00
  #
  # See https://fly.io/docs/reference/configuration/ for information about how to use this file.
  #
  
  #### Deploying Examples
  #
  #    fly apps create <app-name>
  #    fly secrets set SECRET=$secret
  #    fly secrets set REDIS_URI=$uri
  #    fly machine list
  #    fly machine start
  #    fly scale count --app <app-name> 0
  #    fly scale count 0
  #    fly logs -a <app-name>
  #
  #    fly scale count 1 --region ord
  #
  #    fly apps create <redis-app-name>
  #    fly secrets set REDIS_PASSWORD=$pass
  #    fly volumes create redis_staging
  
  app = 'ots-staging-ui'
  primary_region = 'ams'
  
  [build]
  #image = 'ghcr.io/onetimesecret/onetimesecret:v0.19.0-RC0'
  dockerfile = 'Dockerfile' # builds the current local state (incl etc/config)
  
  [[vm]]
  size = 'shared-cpu-1x'
  memory = '1GB'
  cpu_kind = 'shared'
  cpus = 1
  
  # https://fly.io/docs/reference/configuration/#swap_size_mb-option
  swap_size_mb = 512
  
  [http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']
  [http_service.http_options.response.headers]
  Onetime-Env = 'staging'
  Onetime-Region = 'ams'
  
  [[services.ports]]
  handlers = ["http"]
  port = 80
  force_https = true
  
  # [[services.ports]]
  # handlers = ["http"]
  # port = 443
  
  [services.ports.http_options.response]
  pristine = true
  
  # [services.concurrency]
  # type = "connections"
  # hard_limit = 25
  # soft_limit = 20
  
  
  [deploy]
  
  # Run a command on a temp machine deploying the app.
  #
  # Blue-Green strategy for zero downtime deployments, but
  # only works for machines with no volumes attached.
  #
  # You need to define at least 1 check in order to use blue-green deployments. Refer to https://fly.io/docs/reference/configuration/#services-tcp_checks
  #
  # Otherwise this error:
  # Deployment failed after error: app not in valid state for bluegreen deployments
  #strategy = 'bluegreen'
  
  [[http_service.checks]]
  grace_period = '5s'
  interval = '10s'
  timeout = '2s'
  protocol = 'http'
  port = 3000
  method = 'GET'
  path = '/api/v2/status'
  tls_skip_verify = true
  
  # Ask the Fly.io platform to serve our static assets. When it sees
  # this config, it'll fish out the static assets from the container
  # and serve them directly from their proxies at the url_prefix
  # specified. This is faster and eliminates having to package an
  # HTTP server into your container.
  [[statics]]
  guest_path = '/app/public/web/dist'
  url_prefix = '/dist'
  
  [env]
  SSL = 'true'
  RACK_ENV = 'production'
  EMAILER_MODE = 'smtp'
  CSP_ENABLED = 'true'
  SERVER_TYPE = 'puma'
  
  # [[services.machine_checks]]
  # image = "curlimages/curl"
  # entrypoint = ["/bin/sh", "-c"]
  # command = ["curl http://[$FLY_TEST_MACHINE_IP] | grep 'Hello, World!'"]
  # kill_signal = "SIGKILL"
  # kill_timeout = "5s"
  ##
  # RE: private networking between machines
  #
  # @see https://fly.io/docs/networking/private-networking/#
  #
  # Applications within the same organization are assigned special addresses
  # (6PN addresses) tied to the organization. Those applications can talk to
  # each other because of those 6PN addresses, but applications from other
  # organizations can't; the Fly.io platform won't forward between different
  # 6PN networks.
  #
  # This connectivity is always available to apps; you don't have to do
  # anything special to get it.
  #
  # You can connect apps running outside of Fly.io to your 6PN network
  # using WireGuard; for that matter, you can connect your dev laptop to
  # your 6PN network. To do that, you'll use flyctl, the Fly.io CLI, to
  # generate a WireGuard configuration that has a 6PN address.
  #
  # dig +noall +answer _apps.internal txt
  # dig +short aaaa ots-staging-ui.internal @fdaa::3
  # dig +short aaaa ots-staging-redis.internal @fdaa::3
  
  ##
  # RE: volumes and mounts
  # @see https://fly.io/docs/reference/volumes/
  #
  # To prevent a single server hardware failure from taking down multiple Fly Machines, it is better if each volume you create for your app is placed in a separate hardware zone (i.e. on a different server). This happens by default when using fly volumes create, but is not guaranteed when creating Fly Volumes through other methods.
  
  ##
  # RE: secrets
  # @see https://fly.io/docs/reference/secrets/#setting-secrets
  #
  # To set, or update, a secret in the app’s vault, but defer updating the Machines to later, use the --stage option. For example:
  #
  #   fly secrets set DATABASE_URL=postgres://example.com/mydb --stage
  