|
1 | 1 | ---
|
2 |
| -title: Deployment Guide |
3 |
| -description: Learn how to deploy the API server to a production environment. |
| 2 | +title: 'Deployment: API Server' |
| 3 | +description: A guide to building and deploying the Dart Frog API server to a production environment. |
4 | 4 | ---
|
5 | 5 |
|
6 | 6 | import { Steps, Aside } from '@astrojs/starlight/components';
|
7 | 7 |
|
8 |
| -This guide outlines the strategy for deploying the API server to a production environment. The recommended method is to use Docker, which creates a portable and consistent container for your application. |
| 8 | +This guide outlines the process for deploying the API server to a production environment. The server is built with Dart Frog and packaged as a Docker container, making it portable and easy to deploy to any hosting provider that supports Docker. |
9 | 9 |
|
10 | 10 | <Aside>
|
11 |
| -The world of cloud hosting and deployment tools evolves rapidly. Instead of providing specific commands that could become outdated, this guide focuses on the essential steps and links to the official documentation for the relevant services. This ensures you always have access to the most current and accurate instructions. |
| 11 | +To ensure you have the most reliable and up-to-date instructions, this guide focuses on the project-specific configuration you need to complete. For the deployment itself, we will refer you to the excellent official documentation from the Dart Frog team, which is the definitive resource. |
12 | 12 | </Aside>
|
13 | 13 |
|
14 |
| -<Steps> |
15 |
| -1. **Configure Production Environment Variables** |
| 14 | +### Pre-Deployment Configuration |
16 | 15 |
|
17 |
| - Your first step is to prepare the production configuration for the server. Unlike local development which uses a `.env` file, in production you will use your hosting provider's interface to set environment variables securely. |
| 16 | +Before you can deploy, you must complete two essential configuration steps. |
18 | 17 |
|
19 |
| - For a detailed explanation of each required variable, please see the [Configure Environment Variables](/docs/api-server/guides/configure-environment-variables) guide. |
20 |
| - |
21 |
| -2. **Choose a Deployment Strategy** |
| 18 | +<Steps> |
| 19 | +1. **Configure Production Environment Variables** |
22 | 20 |
|
23 |
| - The API server repository includes a `Dockerfile`, which allows for two main deployment strategies: |
| 21 | + In your production environment, you will not use a `.env` file. Instead, you must configure the environment variables directly in your chosen hosting provider's interface. This is a critical step for security and proper configuration. |
24 | 22 |
|
25 |
| - - **Deploying a Pre-built Image:** You build the Docker image on your local machine or in a CI/CD pipeline, push it to a container registry (like Docker Hub, Google Container Registry, or Amazon ECR), and then your hosting provider pulls the image from the registry. |
26 |
| - - **Deploying from Source:** You connect your Git repository directly to the hosting provider, and it uses the `Dockerfile` to build and deploy the image for you. |
| 23 | + For a detailed explanation of each required variable, please see the [**Configure Environment Variables Guide**](/docs/api-server/guides/configure-environment-variables). |
27 | 24 |
|
28 |
| -3. **Deploy to a Hosting Provider** |
| 25 | +2. **Configure CORS** |
29 | 26 |
|
30 |
| - Choose a hosting provider that supports Docker container deployments. Popular and well-documented options include: |
31 |
| - - [Google Cloud Run](https://cloud.google.com/run/docs/deploying) |
32 |
| - - [Amazon Elastic Container Service (ECS)](https://aws.amazon.com/ecs/) |
33 |
| - - [DigitalOcean App Platform](https://www.digitalocean.com/docs/app-platform/) |
34 |
| - - [Render](https://render.com/docs/docker) |
| 27 | + For the Web Dashboard to communicate with your API in production, you must correctly configure Cross-Origin Resource Sharing (CORS) by setting the `CORS_ALLOWED_ORIGIN` environment variable. |
35 | 28 |
|
36 |
| - Follow the official documentation from your chosen provider to deploy your container. During the setup process, you will be prompted to configure the environment variables from Step 1. |
| 29 | + For instructions, see the [**Configure CORS Guide**](/docs/api-server/guides/configure-cors). |
| 30 | +</Steps> |
37 | 31 |
|
38 |
| -4. **Configure CORS** |
| 32 | +### Deployment with Dart Frog |
39 | 33 |
|
40 |
| - For your web-based dashboard to communicate with the API in production, you must correctly configure Cross-Origin Resource Sharing (CORS). |
| 34 | +Once your configuration is ready, you can proceed with the deployment. The Dart Frog documentation provides comprehensive guides for various hosting providers and deployment strategies (e.g., using Docker, deploying to Google Cloud Run, etc.). |
41 | 35 |
|
42 |
| - For instructions, see the [Configure CORS](/docs/api-server/guides/configure-cors) guide. |
| 36 | +Following the official documentation is the recommended and most reliable path to a successful deployment. |
43 | 37 |
|
44 |
| -</Steps> |
| 38 | +**[Official Dart Frog Deployment Guides](https://dartfrog.vgv.dev/docs/category/deploy)** |
0 commit comments