Fly Answers Questions

Q: Can I set up a custom hostname or domain with Fly? A: You can. In fact you can set up as many of them on an application as you like. When you create a custom hostname on Fly and validate it, you also get Let’s Encrypt certificates automatically. Yo

Dj Walker-Morgan
4 min readintermediate
--
View Original

Overview

The article 'Fly Answers Questions' addresses common inquiries about Fly, a platform for deploying applications. It provides detailed answers regarding custom hostnames, configuration file management, database latency, and deployment strategies, making it a valuable resource for developers using Fly.

What You'll Learn

1

How to set up a custom hostname or domain with Fly

2

How to regenerate the fly.toml configuration file using flyctl

3

How to minimize database latency by choosing application regions

4

How to implement SSL termination at the edge with Fly

5

How to use GitHub Actions for continuous deployment to Fly

Key Questions Answered

Can I set up a custom hostname or domain with Fly?
Yes, you can set up multiple custom hostnames or domains for your application on Fly. When you create and validate a custom hostname, you receive Let’s Encrypt certificates automatically, simplifying the process of securing your domain.
If I delete the fly.toml file, can I regenerate it easily?
Yes, if you delete the fly.toml file, you can regenerate it using the command 'flyctl config save -a <appname>'. This retrieves the last used configuration and saves it locally. You can also specify a different name for the configuration file.
Isn’t the DB connection latency insane for pages with lots of queries?
You can minimize database latency by selecting the regions where your app runs. Fly defaults to optimizing this for Heroku/Turboku apps, allowing you to specify regions that are geographically close to your database, enhancing performance.
Can I do only SSL termination?
Yes, you can configure Fly to perform only SSL termination by setting 'handlers=[tls]' in your fly.toml file. This allows TLS termination at the edge, although it currently supports only HTTP 1.1.
How can I continuously deploy my application to Fly from GitHub?
You can use GitHub Actions to deploy your application directly to Fly. The article provides a guide that walks you through the steps necessary to set this up with an example application.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Platform
Fly
Used for deploying applications with features like custom domains and scaling.
Security
Let’s Encrypt
Provides SSL certificates automatically for custom domains.
CI/CD
Github Actions
Facilitates continuous deployment from GitHub repositories to Fly.

Key Actionable Insights

1
To enhance your application's security, set up custom hostnames with Let’s Encrypt certificates on Fly. This not only secures your domains but also simplifies the management of SSL certificates.
Using custom domains is essential for branding and security, especially for production applications. Automating certificate issuance saves time and reduces the risk of certificate expiration.
2
Utilize the 'flyctl config save' command to easily regenerate your fly.toml configuration file if it gets deleted. This ensures that you can quickly restore your application settings without starting from scratch.
Configuration management is crucial in application deployment. Knowing how to quickly recover your settings can save you from downtime and configuration errors.
3
Optimize your application's performance by selecting the right regions for deployment to minimize database latency. This can significantly improve response times for applications with heavy database interactions.
Understanding the geographical distribution of your database and application can lead to better performance and user experience, especially for global applications.
4
Implement SSL termination at the edge by configuring your fly.toml file. This will enhance the security of data in transit while maintaining performance.
SSL termination is a critical aspect of securing web applications. Proper configuration can lead to improved load times and security compliance.
5
Leverage GitHub Actions for continuous deployment to streamline your development workflow. This integration allows for automated deployments every time you push changes to your repository.
Continuous deployment practices help maintain a rapid release cycle, enabling teams to deliver features and fixes to users more efficiently.

Common Pitfalls

1
Failing to configure the correct regions for your application can lead to increased database latency, affecting performance.
Many developers overlook the importance of geographical proximity between their application and database. Always ensure that your application is deployed in a region that is close to your data sources.

Related Concepts

Continuous Deployment
SSL Termination
Database Latency Optimization