Skip to content

Instantly share code, notes, and snippets.

@LucaLanziani
Last active July 26, 2022 12:26
Show Gist options
  • Save LucaLanziani/b732c13c3177db8d09c214e752bb513a to your computer and use it in GitHub Desktop.
Save LucaLanziani/b732c13c3177db8d09c214e752bb513a to your computer and use it in GitHub Desktop.
Compose repo

Bump the components

RENOVATE_TOKEN=<your github token> make bump

This will open/update the PRs to bump the frontend and backend components in the repo.

version: '3.2'
services:
frontend:
# renovate: depName=nearform/frontend
image: private-registry/frontend:${FRONTEND_TAG:-v1.0.0}
container_name: frontend
labels:
traefik.http.routers.fe.rule: PathPrefix(`/frontend`)
restart: always
backend:
# renovate: depName=nearform/backend
image: private-registry/backend:${BACKEND_TAG:-v0.0.3}
container_name: backend
env_file: $ENVFILE
environment:
- API_HOST=0.0.0.0
- API_PORT=80
- PG_PORT=5432
labels:
traefik.http.routers.be.rule: PathPrefix(`/backend`)
restart: always
version: '3.2'
services:
postgres:
image: postgres:11-alpine
ports:
- 5433:5432
tmpfs: /var/lib/postgresql/data
hostname: postgres
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: local
PGDATA: /var/lib/postgresql/data/pgdata
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
frontend:
build: ../frontend
backend:
build: ../backend
depends_on:
postgres:
condition: service_healthy
environment:
- PG_HOST=postgres
- PG_DB=local
- PG_USER=postgres
- PG_PASS=postgres
- ENVIRONMENT=LOCAL
reverse-proxy:
image: traefik:v2.8
command:
- "--api.insecure=true"
- "--providers.docker=true"
ports:
- "8081:80"
- "8082:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
.PHONY: compose from-code local staging production
compose = docker-compose -f compose.yaml -f
database:
${compose} local.yaml up postgres
from-code:
${compose} local.yaml up --build
local:
${compose} local.yaml up --remove-orphans
staging:
${compose} staging.yaml up --remove-orphans -d
production:
${compose} production.yaml up -d
bump:
RENOVATE_PLATFORM=github npx renovate <this repo>
version: '3.2'
services:
backend:
environment:
- PG_PORT=5432
- PG_DB=production
- ENABLE_SSL_CONNECTION=true
- ENVIRONMENT=PRODUCTION
{
"packageRules": [
{
"matchPackagePatterns": ["^nearform/"],
"groupName": "nearform"
}
],
"regexManagers": [
{
"fileMatch": ["^compose.yaml$"],
"matchStrings": [
"depName=(?<depName>.*)\\s+image: .*?_TAG:-(?<currentValue>.*)}\\s"
],
"datasourceTemplate": "github-releases"
}
]
}
version: '3.2'
services:
backend:
environment:
- PG_PORT=5432
- PG_DB=staging
- ENABLE_SSL_CONNECTION=true
- ENVIRONMENT=STAGING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment