# Cariflex EMS - Environment Configuration

## Development Environment

```bash
# .env.dev
DEPLOY_ENV=dev
CARIFLEX_VERSION=dev
CARIFLEX_DOMAIN=cariflex.dev.local
GRAFANA_DOMAIN=grafana.dev.local
FM_SECRET_KEY=dev-secret-key-change-me
FM_DB_PASSWORD=devpassword
REDIS_PASSWORD=devpassword
```

### Deploy to Dev
```bash
cd /home/eric/cariflex/iac
ansible-playbook playbook.yml -i environments/dev/inventory --extra-vars "deploy_env=dev"
```

## Test Environment

```bash
# .env.test
DEPLOY_ENV=test
CARIFLEX_VERSION=test
CARIFLEX_DOMAIN=cariflex.test.digitribe.fr
GRAFANA_DOMAIN=grafana.test.digitribe.fr
FM_SECRET_KEY={{ vault_fm_secret_key }}
FM_DB_PASSWORD={{ vault_fm_db_password }}
REDIS_PASSWORD={{ vault_redis_password }}
```

### Deploy to Test
```bash
cd /home/eric/cariflex/iac
ansible-playbook playbook.yml -i environments/test/inventory --extra-vars "deploy_env=test" --ask-vault-pass
```

## Production Environment

```bash
# .env.prod
DEPLOY_ENV=production
CARIFLEX_VERSION=latest
CARIFLEX_DOMAIN=cariflex.digitribe.fr
GRAFANA_DOMAIN=grafana.digitribe.fr
FM_SECRET_KEY={{ vault_fm_secret_key }}
FM_DB_PASSWORD={{ vault_fm_db_password }}
REDIS_PASSWORD={{ vault_redis_password }}
```

### Deploy to Production
```bash
cd /home/eric/cariflex/iac
ansible-playbook playbook.yml -i environments/prod/inventory --extra-vars "deploy_env=production" --ask-vault-pass
```

## Docker Compose Override Files

Each environment has its own override file:
- `docker-compose.dev.yml` - Development (debug mode, local volumes)
- `docker-compose.test.yml` - Testing (test data, isolated network)
- `docker-compose.prod.yml` - Production (optimized, SSL, backups)

## Kubernetes Deployment

For K8s deployment, see `k8s/` directory:
- `k8s/namespace.yaml` - Namespace creation
- `k8s/configmap.yaml` - Configuration
- `k8s/secrets.yaml` - Secrets (encrypted)
- `k8s/deployments/` - Application deployments
- `k8s/services/` - Service definitions
- `k8s/ingress/` - Ingress rules

### Deploy to K8s
```bash
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/configmap.yaml
kubectl apply -f k8s/secrets.yaml
kubectl apply -f k8s/deployments/
kubectl apply -f k8s/services/
kubectl apply -f k8s/ingress/
```
