Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*
!*.sh
!*.py
!Pipfile
!Pipfile.lock
!pyproject.toml
!uv.lock
17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# VOKO Development Environment Variables
# Copy this file to .env and modify as needed

# Database configuration
POSTGRES_NAME=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=db

# Django settings
DJANGO_SETTINGS_MODULE=vokou.settings.development

# Auto-created superuser configuration
[email protected]
DJANGO_SUPERUSER_FIRST_NAME=Admin
DJANGO_SUPERUSER_LAST_NAME=User
DJANGO_SUPERUSER_PASSWORD=admin123
25 changes: 10 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
---
name: Deployment
name: CI
on:
push:
branches:
- feature/*
- develop
- release/*
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install pipenv
run: python -m pip install --upgrade pipenv wheel
python-version: '3.12'
- name: Install uv
run: python -m pip install --upgrade uv
- name: Install dependencies
run: pipenv install --system --dev
run: uv sync --dev
- name: Run tests
working-directory: webapp
run: |
./runtests.sh
run: uv run python manage.py test --settings=vokou.settings.testing
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10.12'
python-version: '3.12'
- name: flake8 Lint
uses: py-actions/[email protected]
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
22 changes: 16 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
# Pull base image
# not using "slim" image, because UWSGI dependency fails
FROM python:3.8-bullseye as base
FROM python:3.12-bookworm as base

# Setup env
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
ENV TZ="Europe/Amsterdam"

# Install pipenv
RUN pip install pipenv
# Install system dependencies including PostgreSQL client and timezone data
RUN apt-get update && apt-get install -y \
postgresql-client \
tzdata \
&& rm -rf /var/lib/apt/lists/*

# Configure timezone
RUN ln -snf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime && echo Europe/Amsterdam > /etc/timezone

# Install uv
RUN pip install uv

# Set work directory
WORKDIR /code

# Copy dependencies & files
COPY ./Pipfile /code/
COPY ./pyproject.toml /code/

ARG CACHEBUST=1
# Recreate lock file
RUN pipenv lock
RUN uv lock
# Install dependencies
RUN pipenv install --dev
RUN uv sync --dev

# Install application into container
COPY . .
Expand Down
117 changes: 117 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
.PHONY: help setup build up down restart logs logs-web logs-db shell db-shell clean test migrate superuser runserver validate reset

# Default target
help:
@echo "VOKO Development Environment"
@echo "============================"
@echo "Available commands:"
@echo " setup - Complete setup of development environment (recommended)"
@echo " build - Build Docker images"
@echo " up - Start all services"
@echo " down - Stop all services"
@echo " restart - Restart all services"
@echo " logs - View all logs"
@echo " logs-web - View web application logs"
@echo " logs-db - View database logs"
@echo " shell - Access web container shell"
@echo " db-shell - Access database shell"
@echo " clean - Clean up containers and volumes"
@echo " test - Run tests"
@echo " migrate - Run database migrations"
@echo " superuser - Create Django superuser"
@echo " validate - Validate setup is working correctly"
@echo " reset - Reset database (WARNING: deletes all data)"

# Complete setup - simplified one-command setup
setup:
@echo "Starting VOKO development environment..."
@echo "This will build and start all services with automatic setup."
docker-compose up --build

# Build Docker images
build:
docker-compose build

# Start services
up:
docker-compose up -d

# Stop services
down:
docker-compose down

# Restart services
restart:
docker-compose restart

# View logs
logs:
docker-compose logs -f

# View web logs
logs-web:
docker-compose logs -f web

# View database logs
logs-db:
docker-compose logs -f db

# Access web container shell
shell:
docker exec -it voko_web bash

# Access database shell
db-shell:
docker exec -it voko_db psql -U postgres

# Clean up
clean:
docker-compose down -v
docker system prune -f

# Run tests
test:
docker exec voko_web uv run python manage.py test --settings=vokou.settings.testing

# Run migrations
migrate:
docker exec voko_web uv run python manage.py makemigrations --settings=vokou.settings.development
docker exec voko_web uv run python manage.py migrate --settings=vokou.settings.development

# Create superuser
superuser:
docker exec -it voko_web uv run python manage.py createsuperuser --noinput --settings=vokou.settings.development

# Run crons
crons:
docker exec voko_web uv run python manage.py runcrons --settings=vokou.settings.development

# Start development server (if not using docker-compose)
runserver:
docker exec voko_web uv run python manage.py runserver 0.0.0.0:8000 --settings=vokou.settings.development

# Reset database (WARNING: deletes all data)
reset:
@echo "WARNING: This will delete all data!"
@read -p "Are you sure? [y/N] " -n 1 -r; \
echo; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
docker-compose down -v; \
docker-compose up --build; \
else \
echo "Reset cancelled."; \
fi

# Flush sqlite database (if using sqlite)
flush:
@echo "Flushing SQLite database..."
uv run python webapp/manage.py flush --no-input --settings=vokou.settings.development

flush-docker:
@echo "Flushing SQLite database in Docker..."
docker exec voko_web uv run python manage.py flush --no-input --settings=vokou.settings.development

# start webapp
start-webapp:
@echo "Starting web application..."
uv run python webapp/manage.py runserver --settings=vokou.settings.development
39 changes: 0 additions & 39 deletions Pipfile

This file was deleted.

Loading
Loading