Skip to content

Commands Reference

Quick reference for common commands used in Noumaris development and deployment.

Backend (Python/Poetry)

Poetry (Dependency Management)

CommandDescription
poetry installInstall all dependencies from lock file
poetry shellActivate virtual environment
poetry add package-nameAdd new dependency
poetry add -D package-nameAdd dev dependency
poetry updateUpdate all dependencies
poetry showList installed packages
poetry env infoShow virtualenv information
poetry run python script.pyRun command in virtual environment

Alembic (Database Migrations)

CommandDescription
alembic upgrade headApply all pending migrations
alembic downgrade -1Rollback one migration
alembic downgrade <revision>Rollback to specific version
alembic revision --autogenerate -m "msg"Auto-generate migration from model changes
alembic revision -m "msg"Create blank migration
alembic currentShow current database version
alembic historyView migration history
alembic show <revision>Show details of specific migration
alembic stamp headMark database as current version (no changes)

Uvicorn (Backend Server)

CommandDescription
python -m uvicorn src.noumaris_backend.api.main:app --reloadRun dev server with auto-reload
python -m uvicorn src.noumaris_backend.api.main:app --reload --port 8001Run on custom port
PORT=8001 python -m uvicorn src.noumaris_backend.api.main:app --reloadRun on custom port (env var)
uvicorn src.noumaris_backend.api.main:app --workers 4Run with multiple workers

Database Seeding

CommandDescription
python seed_db.pySeed templates, tags, demo users, institution
python scripts/seed_features.pySeed feature permissions

Testing

CommandDescription
pytestRun all tests
pytest tests/test_api.pyRun specific test file
pytest tests/test_api.py::test_functionRun specific test
pytest -vVerbose output
pytest -sShow print statements
pytest --covRun with coverage report

Frontend (Node/npm)

npm (Package Management)

CommandDescription
npm installInstall all dependencies
npm install package-nameAdd new dependency
npm install -D package-nameAdd dev dependency
npm updateUpdate all dependencies
npm listList installed packages
npm auditCheck for security vulnerabilities
npm audit fixAuto-fix vulnerabilities
npm run <script>Run script from package.json

Development Servers

CommandDescription
npm run devRun development server (uses .env.development)
npm run localhostRun local dev server (uses .env.localhost)
npm run previewPreview production build
npm run dev -- --port 5174Run on custom port

Build Commands

CommandDescription
npm run buildBuild for production (default)
npm run build:devBuild for development environment
npm run build:stagingBuild for staging environment
npm run build:prodBuild for production environment
npm run build-keycloak-themeBuild Keycloak custom theme JAR

Linting & Quality

CommandDescription
npm run lintRun ESLint
npm run lint:fixAuto-fix linting issues

Docker & Docker Compose

Docker Compose (Multi-Service)

CommandDescription
docker-compose up -dStart all services in background
docker-compose downStop and remove all containers
docker-compose psList running containers
docker-compose logs -fTail logs from all services
docker-compose logs -f <service>Tail logs from specific service
docker-compose restart <service>Restart specific service
docker-compose stop <service>Stop specific service
docker-compose start <service>Start specific service
docker-compose exec <service> <command>Run command in running container
docker-compose buildRebuild all images
docker-compose pullPull latest images

Service names: postgres, keycloak

Docker (Individual Containers)

CommandDescription
docker psList running containers
docker ps -aList all containers (including stopped)
docker logs -f <container>Tail logs from container
docker exec -it <container> <command>Run command in container
docker stop <container>Stop container
docker rm <container>Remove container
docker imagesList images
docker rmi <image>Remove image
docker system pruneRemove unused containers, images, networks

PostgreSQL (via Docker)

CommandDescription
docker exec -it noumaris-postgres psql -U medical_user -d medical_dbConnect to PostgreSQL
docker exec -it noumaris-postgres pg_dump -U medical_user medical_db > backup.sqlBackup database
docker exec -i noumaris-postgres psql -U medical_user -d medical_db < backup.sqlRestore database

PostgreSQL Commands (inside psql):

  • \dt - List tables
  • \d table_name - Describe table schema
  • \l - List databases
  • \du - List users
  • \q - Quit

Git

Basic Workflow

CommandDescription
git statusShow working tree status
git add .Stage all changes
git add <file>Stage specific file
git commit -m "message"Commit staged changes
git pushPush commits to remote
git pullPull latest changes
git fetchFetch remote changes (no merge)

Branching

CommandDescription
git branchList local branches
git branch <name>Create new branch
git checkout <branch>Switch to branch
git checkout -b <branch>Create and switch to branch
git merge <branch>Merge branch into current
git branch -d <branch>Delete local branch
git push origin --delete <branch>Delete remote branch

History & Diff

CommandDescription
git logView commit history
git log --oneline -10View last 10 commits (compact)
git log --graphView history as graph
git diffShow unstaged changes
git diff --stagedShow staged changes
git diff <branch>Compare with another branch
git show <commit>Show commit details

Undoing Changes

CommandDescription
git reset HEAD <file>Unstage file
git reset --soft HEAD~1Undo last commit (keep changes staged)
git reset --mixed HEAD~1Undo last commit (keep changes unstaged)
git reset --hard HEAD~1Undo last commit (discard changes) ⚠️
git checkout -- <file>Discard changes in file
git revert <commit>Create new commit that undoes changes

Stashing

CommandDescription
git stashSave uncommitted changes
git stash listList stashed changes
git stash popApply and remove latest stash
git stash applyApply latest stash (keep in list)
git stash dropDelete latest stash
git stash clearDelete all stashes

Rebasing

CommandDescription
git rebase <branch>Rebase current branch onto another
git rebase -i HEAD~3Interactive rebase of last 3 commits
git rebase --continueContinue rebase after resolving conflicts
git rebase --abortCancel rebase

Terraform

Initialization

CommandDescription
terraform initInitialize Terraform working directory
terraform init -upgradeUpgrade provider versions

Planning & Applying

CommandDescription
terraform planPreview changes
terraform applyApply changes
terraform apply -auto-approveApply without confirmation
terraform apply -var 'key=value'Apply with variable
terraform destroyDestroy all resources

State Management

CommandDescription
terraform showShow current state
terraform state listList resources in state
terraform state show <resource>Show resource details
terraform refreshUpdate state from real infrastructure
terraform outputShow output values

Workspaces

CommandDescription
terraform workspace listList workspaces
terraform workspace new <name>Create workspace
terraform workspace select <name>Switch workspace
terraform workspace showShow current workspace

Noumaris workspaces: dev, staging, production

Validation

CommandDescription
terraform validateValidate configuration syntax
terraform fmtFormat configuration files
terraform fmt -checkCheck if formatting is needed

Google Cloud (gcloud)

Authentication & Config

CommandDescription
gcloud auth loginAuthenticate with Google account
gcloud config set project <project-id>Set active project
gcloud config listShow current configuration

Cloud Run

CommandDescription
gcloud run services listList Cloud Run services
gcloud run services describe <service> --region <region>Show service details
gcloud run services update <service> --region <region>Update service configuration
gcloud run services delete <service> --region <region>Delete service
gcloud run revisions list --service <service> --region <region>List revisions
gcloud run deploy <service> --image <image> --region <region>Deploy service

Cloud Run Logs

CommandDescription
gcloud run services logs tail <service> --region <region>Tail logs
gcloud run services logs read <service> --region <region> --limit 100Read recent logs

Cloud SQL

CommandDescription
gcloud sql instances listList Cloud SQL instances
gcloud sql instances describe <instance>Show instance details
gcloud sql databases list --instance <instance>List databases
gcloud sql backups list --instance <instance>List backups
gcloud sql backups create --instance <instance>Create backup

Secret Manager

CommandDescription
gcloud secrets listList secrets
gcloud secrets create <name> --data-file=<file>Create secret from file
gcloud secrets versions access latest --secret <name>View secret value
gcloud secrets delete <name>Delete secret

Cloud Build

CommandDescription
gcloud builds listList builds
gcloud builds submit --config cloudbuild.yamlTrigger manual build
gcloud builds log <build-id>View build logs

Local Keycloak Setup

Terraform Configuration

CommandDescription
bash scripts/setup-local-keycloak.shRun automated Keycloak setup
cd terraform/keycloak && terraform applyApply Keycloak configuration manually
cd terraform/keycloak && terraform apply -var 'login_theme=noumaris'Apply with custom theme

Documentation

VitePress

CommandDescription
cd docs && npm run docs:devRun documentation dev server
cd docs && npm run docs:buildBuild documentation
cd docs && npm run docs:previewPreview built documentation

Documentation URL: http://localhost:5174

Shortcuts & Tips

Quick Start (Local Development)

bash
# Terminal 1: Docker services
docker-compose up -d

# Terminal 2: Backend
cd backend && poetry shell
python -m uvicorn src.noumaris_backend.api.main:app --reload

# Terminal 3: Frontend
cd frontend && npm run localhost

# Terminal 4: Documentation (optional)
cd docs && npm run docs:dev

Database Reset (Local)

bash
# Stop containers
docker-compose down

# Remove volumes (⚠️ deletes data)
docker volume rm noumaris_postgres_data

# Restart
docker-compose up -d

# Wait 30 seconds, then run migrations
cd backend
alembic upgrade head
python seed_db.py

Clean Install

bash
# Backend
cd backend
rm -rf .venv poetry.lock
poetry install

# Frontend
cd frontend
rm -rf node_modules package-lock.json
npm install

Next Steps

Internal documentation for Noumaris platform