Skip to content

Commit

Permalink
docs(terraform): replace getAppName with configuration (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdouardDem authored Feb 14, 2023
1 parent 2f925ba commit 96892f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions apps/docs/docs/how-to/terraform/create-new-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ import { RedisContainerConfig } from './interfaces';
import { BackendContainer, MountPoint } from '@trxn/terraform-service-ecs';

export class RedisContainer extends BackendContainer<RedisContainerConfig> {
protected getAppName(): string {
return 'redis';
}

protected getPort(): number {
return 6379;
}
Expand All @@ -96,7 +92,7 @@ export class RedisContainer extends BackendContainer<RedisContainerConfig> {
}
```

This class is a subclass of `BackendContainer` and overrides the `getAppName` and `getPort` methods to return the values specific to a Redis container. It also defines a single mount point to a volume called `data`, which will be used to store persistent data for the Redis container.
This class is a subclass of `BackendContainer` and overrides the `getPort` method to return the value specific to a Redis container. It also defines a single mount point to a volume called `data`, which will be used to store persistent data for the Redis container.

### Configuration and interface

Expand All @@ -112,6 +108,7 @@ import {
export const REDIS_COMPONENT_DEFAULT_CONFIG: RedisComponentDefaultConfig = {
...SERVICE_COMPONENT_DEFAULT_CONFIG,
containerConfig: {
imageName: 'redis',
imageTag: 'alpine3.17',
environments: {
REDIS_PASSWORD: Secret(),
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/docs/how-to/terraform/ecs-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ The containers have two levels of properties. Properties, which are defined in t

The `usePrivateImage` method allows the subclass to specify whether to use a private or public image for the container. If set to `true`, the image should be found on a public repositiory, such as DockerHub. If set to `false`, the image should be available on ECR and a deployment pipeline will be triggered every time a new image is pushed to this repository (accordingly to the image tag).

The `getAppName` method returns the name of the image to use. If the container uses a private image, this is the name of a workspace’s application containing a `Dockerfile`. If the container uses a public image, this is the name of the image without the tag. For example `traefik` or `blacklabelops/volumerize`.
The configuration `imageName` is the name of the image to use. If the container uses a private image, this is the name of a workspace’s application containing a `Dockerfile`. If the container uses a public image, this is the name of the image without the tag. For example `traefik` or `blacklabelops/volumerize`.

As the image tag must be configurable between two environments, it is provided via the configuration of the container and not within the class.
The configuration `imageTag` is also available to specify the tag of the image to use.

### Persistent volumes

Expand Down

0 comments on commit 96892f9

Please sign in to comment.