Skip to content

Commit

Permalink
🏗️(common) remove Postgres
Browse files Browse the repository at this point in the history
We don't need PostgreSQL.
  • Loading branch information
jonathanperret committed Apr 15, 2024
1 parent 4fc43c0 commit 63e75a6
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 98 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/oidc2fer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,11 @@ jobs:
run:
working-directory: src/backend

services:
postgres:
image: postgres:16
env:
POSTGRES_DB: oidc2fer
POSTGRES_USER: dinum
POSTGRES_PASSWORD: pass
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
DJANGO_CONFIGURATION: Test
DJANGO_SETTINGS_MODULE: oidc2fer.settings
DJANGO_SECRET_KEY: ThisIsAnExampleKeyForTestPurposeOnly
OIDC_OP_JWKS_ENDPOINT: /endpoint-for-test-purpose-only
DB_HOST: localhost
DB_NAME: oidc2fer
DB_USER: dinum
DB_PASSWORD: pass
DB_PORT: 5432

steps:
- name: Checkout repository
Expand Down
10 changes: 0 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ FROM core as development
# Switch back to the root user to install development dependencies
USER root:root

# Install psql
RUN apt-get update && \
apt-get install -y postgresql-client && \
rm -rf /var/lib/apt/lists/*

# Uninstall oidc2fer and re-install it in editable mode along with development
# dependencies
RUN pip uninstall -y oidc2fer
Expand All @@ -107,11 +102,6 @@ RUN pip install -e .[dev]
ARG DOCKER_USER
USER ${DOCKER_USER}

# Target database host (e.g. database engine following docker compose services
# name) & port
ENV DB_HOST=postgresql \
DB_PORT=5432

# Run django development server
CMD python manage.py runserver 0.0.0.0:8000

Expand Down
25 changes: 1 addition & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ RESET := \033[0m
GREEN := \033[1;32m


# -- Database

DB_HOST = postgresql
DB_PORT = 5432

# -- Docker
# Get the current user ID to use for docker run and docker exec commands
DOCKER_UID = $(shell id -u)
Expand Down Expand Up @@ -63,8 +58,7 @@ data/static:

create-env-files: ## Copy the dist env files to env files
create-env-files: \
env.d/development/common \
env.d/development/postgresql
env.d/development/common
.PHONY: create-env-files

bootstrap: ## Prepare Docker images for the project
Expand Down Expand Up @@ -144,20 +138,6 @@ test-back-parallel: ## run all back-end tests in parallel
bin/pytest -n auto $${args:-${1}}
.PHONY: test-back-parallel

makemigrations: ## run django makemigrations for the oidc2fer project.
@echo "$(BOLD)Running makemigrations$(RESET)"
@$(COMPOSE) up -d postgresql
@$(WAIT_DB)
@$(MANAGE) makemigrations
.PHONY: makemigrations

migrate: ## run django migrations for the oidc2fer project.
@echo "$(BOLD)Running migrations$(RESET)"
@$(COMPOSE) up -d postgresql
@$(WAIT_DB)
@$(MANAGE) migrate
.PHONY: migrate

superuser: ## Create an admin superuser with password "admin"
@echo "$(BOLD)Creating a Django superuser$(RESET)"
@$(MANAGE) createsuperuser --email admin@example.com --password admin
Expand All @@ -182,9 +162,6 @@ resetdb: ## flush database and create a superuser "admin"
env.d/development/common:
cp -n env.d/development/common.dist env.d/development/common

env.d/development/postgresql:
cp -n env.d/development/postgresql.dist env.d/development/postgresql

# -- Misc
clean: ## restore repository state as it was freshly cloned
git clean -idx
Expand Down
13 changes: 0 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
services:
postgresql:
image: postgres:16
env_file:
- env.d/development/postgresql
ports:
- "15432:5432"

app-dev:
build:
context: .
Expand All @@ -19,15 +12,12 @@ services:
- DJANGO_CONFIGURATION=Development
env_file:
- env.d/development/common
- env.d/development/postgresql
ports:
- "8071:8000"
volumes:
- ./src/backend:/app
- ./data/media:/data/media
- ./data/static:/data/static
depends_on:
- postgresql

app:
build:
Expand All @@ -41,11 +31,8 @@ services:
- DJANGO_CONFIGURATION=Demo
env_file:
- env.d/development/common
- env.d/development/postgresql
volumes:
- ./data/media:/data/media
depends_on:
- postgresql

nginx:
image: nginx:1.25
Expand Down
11 changes: 0 additions & 11 deletions env.d/development/postgresql.dist

This file was deleted.

23 changes: 0 additions & 23 deletions src/backend/core/tests/test_models_users.py

This file was deleted.

0 comments on commit 63e75a6

Please sign in to comment.