Skip to content

Commit

Permalink
fix(docker): correct docker composes for prod and preprod (#768)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Documentation**
- Enhanced clarity regarding Docker tags for the Nuxt pre-rendering
feature in the README.
- Updated tag descriptions specify version number usage for production
and clarify testing tags.

- **New Features**
- Introduced environment variables for the web service in preproduction
configuration for improved API access and locale settings.
- Updated port mappings to avoid conflicts and align with deployment
specifications.

- **Production Updates**
- Adjusted Docker configurations for production settings, enhancing
deployment standards and service configurations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
antoinezanardi authored Aug 20, 2024
1 parent 334cc80 commit 89175cd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ pnpm run docker:production-example:start
### 🏷️ Docker Tags

Because of the pre-rendering feature, environment variables are injected at build time. Therefore, multiple tags are created when pushing to `develop` and `main` branches.
Because of the Nuxt pre-rendering feature, environment variables are injected at build time on some pages. Therefore, multiple tags are created when pushing to `develop` and `main` branches.

### ⛵️ When pushing to `develop` branch

Expand All @@ -437,16 +437,16 @@ Because of the pre-rendering feature, environment variables are injected at buil
- `antoinezanardi/werewolves-assistant-web-next:local-prod-fr-latest` : Pre-rendered app with French language from latest release and calling the Werewolves Assistant API running locally (`"http://localhost:9191"`)
- `antoinezanardi/werewolves-assistant-web-next:local-prod-en-latest` : Pre-rendered app with English language from latest release and calling the Werewolves Assistant API running locally (`"http://localhost:9191"`)

When pushing to `main` branch, a new release is created with the version number from the `package.json` file. Then, all above tags are also created with the version number instead of `latest`.
When pushing to `main` branch, a new release is created with the version number from the `package.json` file. Then, all above tags for `prod` are also created with the version number instead of `latest`.

### 🔖 Which one to choose ?

For your tests, you must choose the `local` prefixed tags when you want to test the app with the API running locally.

- If you want to test the app with the latest features, you can use the `develop` tags.
- If you want to test the app with the latest release, you can use the `main` tags.
- If you want to test the app with the latest features, you can use the `preprod` tags.
- If you want to test the app with the latest release, you can use the `prod` tags.

Not prefixed tags like `preprod-fr` or `prod-en` are exclusively used for the production environment.
Not prefixed tags like `preprod-fr` or `prod-en` are exclusively used for the preproduction and production environments.

## <a name="tests">💯 Tests</a>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ services:
depends_on:
- api
image: antoinezanardi/werewolves-assistant-web:local-preprod-en
environment:
NUXT_PUBLIC_WEREWOLVES_ASSISTANT_API_BASE_URL: "http://localhost:9292"
NUXT_PUBLIC_DEFAULT_LOCALE: "en"
ports:
- "3000:3000"
- "3001:3000"
restart: unless-stopped

api:
Expand Down Expand Up @@ -35,7 +38,7 @@ services:
volumes:
- mongodb_data_container_preproduction_example:/data/db
ports:
- "29000:27017"
- "29001:27017"
restart: unless-stopped

volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,30 @@ services:
container_name: werewolves-assistant-web-production-example
depends_on:
- api
image: antoinezanardi/werewolves-assistant-web:local-preprod-fr
image: antoinezanardi/werewolves-assistant-web:local-prod-en:latest
environment:
NUXT_PUBLIC_WEREWOLVES_ASSISTANT_API_BASE_URL: "http://localhost:9191"
NUXT_PUBLIC_DEFAULT_LOCALE: "en"
ports:
- "3000:3000"
restart: unless-stopped

api:
image: antoinezanardi/werewolves-assistant-api:develop
image: antoinezanardi/werewolves-assistant-api:latest
container_name: werewolves-assistant-api-production-example
depends_on:
- mongodb
environment:
ENVIRONMENT: "production"
HOST: "0.0.0.0"
PORT: "9292"
PORT: "9191"
DATABASE_HOST: "mongodb-production-example"
DATABASE_PORT: "27017"
DATABASE_NAME: "werewolves-assistant"
DATABASE_USERNAME: "production"
DATABASE_PASSWORD: "a_very_good_password"
ports:
- "9292:9292"
- "9191:9191"
restart: unless-stopped

mongodb:
Expand Down

0 comments on commit 89175cd

Please sign in to comment.