diff --git a/.github/workflows/smokeshow.yml b/.github/workflows/smokeshow.yml index d8e068f..7a3271a 100644 --- a/.github/workflows/smokeshow.yml +++ b/.github/workflows/smokeshow.yml @@ -28,7 +28,7 @@ jobs: - run: smokeshow upload htmlcov env: SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage} - SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 90 + SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 80 SMOKESHOW_GITHUB_CONTEXT: coverage SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62cb2cc..228dd75 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,14 +68,15 @@ jobs: run: | poetry run make testcov env: - GOOGLE_ENABLED: 1 - YANDEX_ENABLED: 1 - TELEGRAM_OAUTH_ENABLED: 1 - NOTIFY_SMTP_ENABLED: 1 - NOTIFY_TELEGRAM_ENABLED: 1 - TELEGRAM_BOT_TOKEN: 123456:BOT_SECRET - DB_URL: postgresql+asyncpg://${{ matrix.database-user }}:${{ matrix.database-password }}@${{ matrix.database-host }}:${{ matrix.database-port }}/${{ matrix.database-name }} - REDIS_URL: redis://${{ matrix.redis-user }}:${{ matrix.redis-password }}@${{ matrix.redis-host }}:${{ matrix.redis-port }} + FASTID_DB_URL: postgresql+asyncpg://${{ matrix.database-user }}:${{ matrix.database-password }}@${{ matrix.database-host }}:${{ matrix.database-port }}/${{ matrix.database-name }} + FASTID_REDIS_URL: redis://${{ matrix.redis-user }}:${{ matrix.redis-password }}@${{ matrix.redis-host }}:${{ matrix.redis-port }} + FASTID_GOOGLE_OAUTH_ENABLED: 1 + FASTID_YANDEX_OAUTH_ENABLED: 1 + FASTID_SMTP_ENABLED: 1 + FASTID_TELEGRAM_WIDGET_ENABLED: 1 + FASTID_TELEGRAM_NOTIFICATION_ENABLED: 1 + FASTID_TELEGRAM_BOT_TOKEN: 123456:BOT_SECRET + FASTID_WEBHOOK_PAGE_EXPIRES_IN_SECONDS: 0 - name: Teardown test environment run: | diff --git a/Makefile b/Makefile index 46f22ec..9f341f0 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,22 @@ .PHONY: certs certs: mkdir certs + openssl rand -hex 32 > certs/secret.key openssl genrsa -out certs/jwt-private.pem 2048 openssl rsa -in certs/jwt-private.pem -pubout -out certs/jwt-public.pem .PHONY: deps deps: - docker compose -f docker-compose.dev.yml postgres redis up -d --build --remove-orphans --wait + docker compose -f docker-compose.dev.yml up postgres redis -d --build --remove-orphans --wait .PHONY: up up: docker compose -f docker-compose.dev.yml up --build --remove-orphans --wait +.PHONY: build +build: + docker build -t fastid:latest -f docker/Dockerfile . + .PHONY: up-obs up-obs: docker compose -f docker-compose.dev.yml -f docker-compose.observability.yml up --build --remove-orphans --wait diff --git a/README.md b/README.md index 7665ffb..1e90e5c 100644 --- a/README.md +++ b/README.md @@ -54,25 +54,34 @@ ### Download the Compose file ```bash -wget https://raw.githubusercontent.com/everysoftware/fastid/refs/heads/master/docker-compose.example.yml -mv docker-compose.example.yml docker-compose.yml +wget https://raw.githubusercontent.com/everysoftware/fastid/refs/heads/master/docker-compose.yml +``` + +### Generate keys + +```bash +mkdir certs +openssl rand -base64 32 > certs/secret.key +openssl genrsa -out certs/jwt-private.pem 2048 +openssl rsa -in certs/jwt-private.pem -pubout -out certs/jwt-public.pem ``` ### Set environment variables Create a `.env` file with the following content: -```env +```text POSTGRES_PASSWORD=YOUR_POSTGRES_PASSWORD REDIS_PASSWORD=YOUR_REDIS_PASSWORD ``` -### Generate RSA keys +You can generate strong random passwords using the following command: ```bash -mkdir certs -openssl genrsa -out certs/jwt-private.pem 2048 -openssl rsa -in certs/jwt-private.pem -pubout -out certs/jwt-public.pem +cat > .env << EOF +POSTGRES_PASSWORD=$(openssl rand -base64 32 | tr -d '\n') +REDIS_PASSWORD=$(openssl rand -base64 32 | tr -d '\n') +EOF ``` ### Install and start FastID diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 0a87a9f..8cc7dd1 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -36,7 +36,6 @@ services: ports: - "8025:8025" - "1025:1025" - restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8025/readyz"] interval: 10s @@ -61,11 +60,11 @@ services: condition: service_healthy environment: - DB_URL: ${DB_URL:-postgresql+asyncpg://${POSTGRES_USER:-fastid}:${POSTGRES_PASSWORD:?database password required}@postgres:5432/${POSTGRES_DB:-fastid}} - REDIS_URL: ${REDIS_URL:-redis://:${REDIS_PASSWORD:?redis password required}@redis:6379/0} - NOTIFY_SMTP_ENABLED: ${NOTIFY_SMTP_ENABLED:-true} - NOTIFY_SMTP_HOST: ${NOTIFY_SMTP_HOST:-mailpit} - NOTIFY_SMTP_PORT: ${NOTIFY_SMTP_PORT:-1025} + FASTID_DB_URL: ${FASTID_DB_URL:-postgresql+asyncpg://${POSTGRES_USER:-fastid}:${POSTGRES_PASSWORD:?database password required}@postgres:5432/${POSTGRES_DB:-fastid}} + FASTID_REDIS_URL: ${FASTID_REDIS_URL:-redis://:${REDIS_PASSWORD:?redis password required}@redis:6379/0} + FASTID_SMTP_ENABLED: ${FASTID_SMTP_ENABLED:-true} + FASTID_SMTP_HOST: ${FASTID_SMTP_HOST:-mailpit} + FASTID_SMTP_PORT: ${FASTID_SMTP_PORT:-1025} volumes: - "./migrations:/opt/fastid/migrations" diff --git a/docker-compose.observability.yml b/docker-compose.observability.yml index e32b72f..aa1f573 100644 --- a/docker-compose.observability.yml +++ b/docker-compose.observability.yml @@ -10,6 +10,12 @@ x-logging: &default-logging expression: '^(?P