|
4 | 4 |
|
5 | 5 | This Go application demonstrates a simple form submission using the standard net/http library. Users can input their first name into a form, and upon submission, they will be greeted personally by the application. |
6 | 6 |
|
7 | | -## Features |
| 7 | +## Prerequisites |
8 | 8 |
|
9 | | -1. Simple form to submit a user's first name. |
10 | | -2. Personalized greeting displayed in response to the form submission |
| 9 | +1. Download [Defang CLI](https://github.com/DefangLabs/defang) |
| 10 | +2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account |
| 11 | +3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/) |
11 | 12 |
|
12 | | -## Essential Setup Files |
| 13 | +## Development |
13 | 14 |
|
14 | | -1. A [Dockerfile](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/). |
15 | | -2. A [compose file](https://docs.defang.io/docs/concepts/compose) to define and run multi-container Docker applications (this is how Defang identifies services to be deployed). (compose.yaml file) |
| 15 | +To run the application locally, you can use the following command: |
16 | 16 |
|
17 | | -## Prerequisite |
| 17 | +```bash |
| 18 | +docker compose up --build |
| 19 | +``` |
18 | 20 |
|
19 | | -1. Download [Defang CLI](https://github.com/DefangLabs/defang) |
20 | | -2. If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc), make sure you have properly [authenticated your AWS account (optional)](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) |
| 21 | +## Configuration |
| 22 | + |
| 23 | +For this sample, you will not need to provide [configuration](https://docs.defang.io/docs/concepts/configuration). |
| 24 | + |
| 25 | +If you wish to provide configuration, see below for an example of setting a configuration for a value named `API_KEY`. |
| 26 | + |
| 27 | +```bash |
| 28 | +defang config set API_KEY |
| 29 | +``` |
| 30 | + |
| 31 | +## Deployment |
| 32 | + |
| 33 | +> [!NOTE] |
| 34 | +> Download [Defang CLI](https://github.com/DefangLabs/defang) |
| 35 | +
|
| 36 | +### Defang Playground |
| 37 | + |
| 38 | +Deploy your application to the Defang Playground by opening up your terminal and typing: |
| 39 | +```bash |
| 40 | +defang compose up |
| 41 | +``` |
| 42 | + |
| 43 | +### BYOC (AWS) |
21 | 44 |
|
22 | | -## A Step-by-Step Guide |
| 45 | +If you want to deploy to your own cloud account, you can use Defang BYOC: |
23 | 46 |
|
24 | | -1. Open the terminal and type `defang login` |
25 | | -2. Type `defang compose up` in the CLI |
26 | | -3. Your app should be up and running with Defang in minutes! |
| 47 | +1. [Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`. |
| 48 | +2. Run in a terminal that has access to your AWS environment variables: |
| 49 | + ```bash |
| 50 | + defang --provider=aws compose up |
| 51 | + ``` |
27 | 52 |
|
28 | 53 | --- |
29 | 54 |
|
|
0 commit comments