Skip to content

Instantly share code, notes, and snippets.

@devopsleigh
devopsleigh / traefik-compose-block.yml
Created May 24, 2024 05:51
Labels for Trafik to append to all compose files
security_opt:
- no-new-privileges:true
networks:
proxy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.${SERVICE_NAME}.entrypoints=http"
- "traefik.http.routers.${SERVICE_NAME}.rule=Host(`${SERVICE_NAME}.${MY_DOMAIN}`)"
- "traefik.http.routers.${SERVICE_NAME}.middlewares=default-whitelist@file"
- "traefik.http.middlewares.${SERVICE_NAME}-https-redirect.redirectscheme.scheme=https"
@devopsleigh
devopsleigh / generate-env.sh
Created May 24, 2024 05:49
Extracts all variable names from a compose.yml and creates a .env file ready for values to be inserted
#!/bin/bash
# Define the Compose file path
COMPOSE_FILE="compose.yml"
# Define the .env file to create
ENV_FILE=".env"
# Empty the .env file if it already exists
> $ENV_FILE