Hosting the Flashcards App

Dated Mar 27, 2024; last modified on Wed, 27 Mar 2024

Current State: SaaS

The app is hosted at render.com on Render’s free tier that gives us these free web services:

  • Custom domains
  • Managed TLS certificates
  • Pull request reviews
  • Log streams
  • Rollbacks up to the two most recent previous deploys.

… with these limitations:

  • Spins down after 15min of no inbound traffic. Spinning up on the next request causes a noticeable delay for a couple seconds.
  • Monthly limits, which will suspend the app if exceeded:
    • 750 instance hours.
    • 100GB bandwidth.
    • 500 pipeline minutes.
  • Can be restarted at any time by Render.

Render’s free PostgreSQL database becomes inaccessible 90 days after creation. For our DB needs, we’re using MongoDB’s free tier , which has shared RAM, and 512MB to 5GB of storage.

Server Logs

Render suggests several options for logging .

Better Stack ’s free tier offers 1GB/month, 3-day retention and 5 data sources. It also has an Uptime product whose free tier has free email alerts, 3-minute checks, 10 monitors, and 5 status pages.

Datadog ’s pricing page starts at $0.10/GB. It also has logging integrations for network , disk usage and IO and Postgres . The pricing for the Postgres monitoring isn’t clear: this page says $70 per database host, per month, but the Postgres integration page states that the standard Postgres Agent integration is different. This Reddit thread jokes that their pricing model involves signing over your company and all its assets.

highlight.io ’s free tier has 500 sessions, 1k errors, 1m logs and 25m traces per month.

Papertrail ’s cheapest plan is $7/month.

Sumo Logic ’s free tier has daily limits of 1GB logs, 3k DPM metrics, 1.5GB of traces.

Datadog is out for being vague with pricing and rumored to be expensive. Papertrail costs money, and the flashcard app does not make money. Sumo Logic seems like the clear winner with their generous free tier, or maybe not ?

The Complete Guide to the ELK Stack summarizes the state of self-hosted open-source logging solutions. The ELK stack combines Elasticsearch ( a full-text search and analysis engine), Logstash (a log aggregator), and Kibana (a visualization layer). In 2021, Elastic made the ELK stack no longer open source, prompting AWS’s OpenSearch and OpenSearch Dashboards.

The main motivation for collecting logs today is to find out when users tend to log in, and thus reduce the cold start. From this SO post , we created a cron job at console.cron-job.org that pings https://cards.c13u.com/wiki every 14min. \(31 \times 25 = 775\) which means the app will be down on the 31st of every month.

Moving cards.c13u.com to cards.curiosities.dev

http://www.c13u.com/ issues a 302 redirect to http://www.curiosities.dev . This is fine because both are static sites that don’t need user authentication. c13u.com costs $12/year and so does curiosities.dev. c13u.com’s registration renews in May.

Should I transition in one month, or should I transition by May 2025? The site doesn’t have many users, so a month-long transition should suffice. Tentative transition plan:

  1. Host second app instance at cards.curiosities.dev.
  2. Have a banner at cards.c13u.com indicating that on May 13th, cards.c13u.com will not work.
  3. Shut down cards.c13u.com on May 13th.
  4. Let c13u.com registration expire.

Render makes step #1 easy. It’s a matter of pointing cards.curiosities.dev to flashcards-k0u4.onrender.com via CNAME record. A Canonical Name (CNAME) record maps one domain name (an alias) to another (the canonical name). In this case, in an Address (A) record lookup for cards.curiosities.dev the resolver will see flashcards-k0u4.onrender.com and restart the checking at flashcards-k0u4.onrender.com where an A record managed by Render will provide an IP address where the app is hosted. So there is no second app instance at cards.curiosities.dev; it’s mostly DNS-fu, and that’s why it’s so seamless. #142 adds a banner to the app.