-
Notifications
You must be signed in to change notification settings - Fork 6
Added supported Compose spec properties #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
1f2c25f
clear config explanation
dad7e65
started outlining possible compose page outline
e67d4d6
alternative layout as a list, not a table
commit111 668a4e0
fixes for what is required
commit111 27226b6
update ports property
commit111 88cc6b5
add top level property heading
commit111 f33e5f9
add healthcheck
commit111 74685d8
adjust examples
commit111 41dd1f9
fix typo
commit111 39917f9
add more properties
commit111 10f37b9
update compose support
commit111 234db8c
update environment
commit111 77e1296
update healthcheck
commit111 836ac63
remove tip
commit111 22ff2bb
move compose support to compose page
commit111 4220181
edit description
commit111 57f642a
move service name resolution
commit111 2faa8d9
add service name resolution from compose to services page
commit111 c2796f3
Merge branch 'main' into linda-compose-support
commit111 793e617
Apply suggestions from code review
commit111 f37f4d0
Update docs/concepts/compose.md
commit111 dbda400
fix grammar
commit111 e9f884b
Merge branch 'linda-compose-support' of https://github.com/DefangLabs…
commit111 6dd6d01
improve config section
commit111 0b01183
Apply suggestions from code review
commit111 d7e6289
Apply suggestions from code review
commit111 856397b
Update docs/concepts/compose.md
commit111 dd9f070
move required properties above, and improve services tip
commit111 b66216a
improve services page according to compose tip
commit111 7e602ce
fix domain example for services
commit111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
--- | ||
title: Compose Support | ||
description: Defang supports many of the properties of the Compose specification. | ||
sidebar_position: 160 | ||
--- | ||
|
||
# Compose Support | ||
|
||
## Required Compose File | ||
Here is a basic `compose.yaml` file that contains all the required properties for deployment in Defang. | ||
|
||
```yaml | ||
services: | ||
service-example: | ||
restart: unless-stopped # specify a restart mode | ||
image: nginx:latest # specify an image (or a build, as shown below) | ||
commit111 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile | ||
ports: | ||
- "8080:80" # specify ports to expose | ||
commit111 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
``` | ||
|
||
## Compose Service Properties | ||
Here are a list of service-level properties of the [Compose specification](https://docs.docker.com/compose/compose-file/) that Defang supports when writing a `compose.yaml` file. | ||
|
||
:::tip | ||
Service-level means inside your `service`. A service-level property called `build` would look like: | ||
```yaml | ||
service: | ||
build: ... | ||
``` | ||
|
||
Note that in your Compose file, you will need a top-level property called `services` to contain all of your services. For example: | ||
```yaml | ||
services: | ||
service: | ||
build: ... | ||
another-service: | ||
build: ... | ||
``` | ||
::: | ||
|
||
### `build` | ||
(Required, unless `image` is defined) | ||
|
||
The build configuration. | ||
|
||
```yaml | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
``` | ||
|
||
### `command` | ||
(Optional) | ||
|
||
The command which will be run to start your service. If left out, the command from the docker image will be used. | ||
|
||
```yaml | ||
command: nginx -g 'daemon off;' | ||
``` | ||
|
||
### `environment` | ||
(Optional) | ||
|
||
The environment variables to set. | ||
|
||
```yaml | ||
environment: | ||
MYSQL_ROOT_PASSWORD: example | ||
``` | ||
|
||
### `image` | ||
(Required, unless `build` is defined) | ||
|
||
The image to run. | ||
|
||
```yaml | ||
image: nginx:latest | ||
``` | ||
|
||
### `ports` | ||
(Optional, but required if you want to access the service from outside the container) | ||
|
||
The ports to expose. Can be formatted as `"published:target"`. | ||
|
||
```yaml | ||
ports: | ||
- "8080:80" | ||
``` | ||
|
||
Alternatively, you can use this notation: | ||
```yaml | ||
ports: | ||
- target: 80 | ||
published: 8080 | ||
mode: ingress | ||
``` | ||
commit111 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
:::info | ||
Defang ignores `published` ports in production. As such, it is common to make `target` and `published` ports the same when using Defang. However, it can be useful to include a `published` port for local development, such as Docker. | ||
::: | ||
|
||
### `restart` | ||
(Required) | ||
commit111 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
The restart mode for a container. | ||
|
||
```yaml | ||
restart: unless-stopped | ||
``` | ||
|
||
### `version` | ||
(Deprecated) | ||
|
||
The version of the Compose file format being used. This feature is no longer supported and will be ignored by Defang. | ||
|
||
### `volumes` | ||
(Unsupported) | ||
|
||
The volume for a container. This feature is not currently supported by Defang. | ||
commit111 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
|
||
### Configuration | ||
You can define sensitive environment variables/configuration for Defang by writing out the variable name and leaving it in as a blank or `null` value in the Compose file. See our [Configuration](/docs/concepts/configuration) page for more. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.