Skip to content

Commit

Permalink
Merge branch 'main' into oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
mrharpo authored Aug 5, 2024
2 parents 7b9d757 + af8bc7e commit 4dde152
Show file tree
Hide file tree
Showing 10 changed files with 196 additions and 34 deletions.
32 changes: 32 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
changelog:
categories:
- title: Breaking Changes 🪅
labels:
- breaking 💔

- title: New Features 🎉
labels:
- enhancement ➕

- title: Bugfixes 🐛
labels:
- bug 🐛

- title: Deployment 🚀
labels:
- production 🎭
- dev 💻

- title: Maintenance 🔩
labels:
- maintenance 🔧
- CI 🦾
- CD 🏗️

- title: Documentation 📚
labels:
- documentation 📜

- title: Other Changes
labels:
- '*'
20 changes: 20 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 🪂 Deploy

on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [published, edited, prereleased]
merge_group:
workflow_dispatch:

jobs:
build:
name: 🔨 Build and deploy docker image
uses: WGBH-MLA/.github/.github/workflows/build.yml@main
with:
target: production
12 changes: 12 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 🏷 Sync labels
on:
workflow_dispatch:

permissions:
issues: write

jobs:
labels:
name: 🔄 Sync labels
uses: WGBH-MLA/.github/.github/workflows/labels.yml@main

11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 📦 Release

on:
milestone:
types: [closed]
workflow_dispatch:

jobs:
release:
name: 📝 Draft Release
uses: WGBH-MLA/.github/.github/workflows/draft_release.yml@main
12 changes: 12 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 🛍 Update dependencies
# On Wednesdays, we update our dependencies.

on:
schedule:
- cron: 0 12 * * 3
workflow_dispatch:

jobs:
update:
name: 🦿 Update dependencies
uses: WGBH-MLA/.github/.github/workflows/update.yml@main
69 changes: 56 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,67 @@
###########################
# 'base' build stage, common to all build stages
###########################
FROM python as base
FROM python:3.11-slim as base

# Set working dir to /app, where all code lives.
WORKDIR /app
RUN pip install -U pip
RUN pip install -U pip pdm

# Copy app code to container
COPY pyproject.toml pdm.lock ./
COPY pyproject.toml pdm.lock README.md ./
COPY organ organ

# add app directories
ADD organ/ organ/
ADD static/ static/
ADD templates/ templates/
# Copy migration files
# COPY alembic.ini ./
# COPY migrations migrations

# Install PDM dependency manager
RUN pip install pdm

###########################
# 'dev' build stage
###########################
FROM base as dev
# Configure pdm to instal dependencies into ./__pypyackages__/
RUN pdm config python.use_venv false
# Configure python to use pep582 with local __pypyackages__
ENV PYTHONPATH=/usr/local/lib/python3.11/site-packages/pdm/pep582
ENV PATH=$PATH:/app/__pypackages__/3.11/bin/
# Add local packages to $PATH
ENV PATH=/app/__pypackages__/3.11/bin/:$PATH

# Install dev dependencies with pdm
RUN pdm install -G dev
# Start dev server.
CMD uvicorn organ.app:app --host 0.0.0.0 --reload --log-level debug


###########################
# 'build' build stage for production
############################
FROM base as build
RUN apt update && apt install -y gcc libpq-dev git

RUN pdm config venv.with_pip True
RUN pdm install -G production

# Install pip into the virtual environment
RUN /app/.venv/bin/python -m ensurepip

###########################
# 'production' final production image
############################
FROM python:3.11-slim as production
WORKDIR /app

RUN apt update && apt install -y libpq-dev
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /app/ /app/
COPY templates templates
COPY static static

ENV organ_ENV=production
ENV PATH="/app/.venv/bin:$PATH"

RUN pdm install -v
EXPOSE 8000

# CMD gunicorn chowda:app -b 0.0.0.0:8000 -w 2 --worker-class uvicorn.workers.UvicornWorker
CMD uvicorn organ:main --host 0.0.0.0 --port 8000
CMD gunicorn organ.main:main -b 0.0.0.0:8000 -w 2 --worker-class uvicorn.workers.UvicornWorker
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Organ

Organization name resolution for Open Vault and the American Archive of Public Broadcasting
1 change: 0 additions & 1 deletion organ/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
ENVIRONMENT = environ.get('ENVIRONMENT', 'development')
DB_URL = environ.get('DB_URL', 'postgresql://postgres:postgres@localhost:5432/organ')

# postgresql://postgres:coolcool@organ-db-dev.cmrjt7rckp5r.us-east-1.rds.amazonaws.com:5432
ORGAN_SECRET = environ.get('ORGAN_SECRET', 1234567890)

# TEMPLATES_DIR = environ.get('TEMPLATES_DIR', 'templates')
Expand Down
67 changes: 47 additions & 20 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dependencies = [
]
requires-python = ">=3.9"
license = { text = "MIT" }

[project.optional-dependencies]
production = ["gunicorn>=22.0.0", "uvicorn>=0.30.5"]

0 comments on commit 4dde152

Please sign in to comment.