Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

A really simple CRUD GraphQL API based on Docker and Python.

License

Notifications You must be signed in to change notification settings

joseesco24/users_crud_api_python

Repository files navigation

Users Crud Api Python

A really simple CRUD GraphQL API based on Docker and Python.

Note: In develop mode and running locally the docs are available at this url


Project Commands

Note: Before running any of these commands be sure that your CWD is users_crud_api_python directory.

Clean Python Cache Using Grep

find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf

Install Python Dependencies

poetry install

Change Poetry Venv Version To 3.11

poetry env use 3.11

Export The Dev And App Dependencies With Poetry

poetry export --without-hashes --format=requirements.txt > requirements.app.txt
poetry export --without-hashes --only dev --format=requirements.txt > requirements.dev.txt

Update The Depedencies With Poetry

Note: Before running this command you need to install the dev dependencies.

poetry update

Check The Depedencies With Poetry

Note: Before running this command you need to install the dev dependencies.

poetry show
poetry show -l

Format The Code Using Black

Note: Before running this command you need to install the dev dependencies.

black ./src --line-length=150

Lint The Code Using Flake8

Note: Before running this command you need to install the dev dependencies.

flake8 ./src --max-line-length=150

Check Static Types Using Mypy

Note: Before running this command you need to install the dev dependencies.

mypy --explicit-package-bases ./src

Run On Development Mode

ENVIRONMENT_MODE=development python src/main.py

Run On Testing Mode

ENVIRONMENT_MODE=testing python src/main.py

Run On Production Mode

ENVIRONMENT_MODE=production python src/main.py

Docker Project Commands

Note: Before running any of these commands be sure that your CWD is users_crud_api_python directory.

Docker App Building Without Cache

docker build --no-cache --tag ghcr.io/joseesco24/users_crud_api_python:latest .

Docker App Building With Cache

docker build --tag ghcr.io/joseesco24/users_crud_api_python:latest .

Docker App Deployment Without Detach

docker run --rm --name users_crud_api_python_app --publish 10048:10048 --env-file ./.env --env ENVIRONMENT_MODE=production ghcr.io/joseesco24/users_crud_api_python:latest

Docker App Deployment With Detach

docker run --detach --rm --name users_crud_api_python_app --publish 10048:10048 --env-file ./.env --env ENVIRONMENT_MODE=production ghcr.io/joseesco24/users_crud_api_python:latest

Docker Access To The Container Terminal

docker exec -it users_crud_api_python_app /bin/bash

Docker Killing Containerized App

docker kill users_crud_api_python_app

Docker Login Into Github Container Registry

docker login -u joseesco24 -p < authentication token > ghcr.io

Docker Push The Image To Github Container Registry

docker push ghcr.io/joseesco24/users_crud_api_python:latest

Docker Pull The Image From Github Container Registry

docker pull ghcr.io/joseesco24/users_crud_api_python:latest

Docker Compose Project Commands

Note: Before running any of these commands be sure that your CWD is users_crud_api_python directory.

Docker Compose Build Image Using Compose File

docker-compose -f compose.build.yaml build

Docker Compose Start Dbs Services Using Compose File

docker-compose -f compose.databases.yaml up

Docker Compose Stop Dbs Services Using Compose File

docker-compose -f compose.databases.yaml down

Docker Compose Start Project Using Compose File

docker-compose -f compose.project.yaml up

Docker Compose Stop Project Using Compose File

docker-compose -f compose.project.yaml down