REST API application in Python. DevOps educational project.
- Python 3.12+
- Docker
- Docker compose
pip install -r app/requirements.txt pyrhon app/main.py
docker build -t simple-app . docker run -p 5000:5000 simple-app
docker compose up -d
| Method | Path | Desription |
|---|---|---|
| GET | '/' | Hello world |
| GET | '/health' | Health check |
| GET | '/api/users' | List all users |
| POST | '/api/users' | Create a user |
| GET | '/api/users/' | Get user by ID |
| DELETE | 'api/users/' | Delete user by ID |
curl http://localhost:5000/health
curl http://localhost:5000/api/users
-H "Content-Type: application/json"
-d '{"Ivan"}'
curl http://localhost:5000/api/users
./scripts/server-info.sh --help ./scripts/server-info.sh ./scripts/server-info.sh http://localhost:5000/health
Run tests: pytest app/tests/ -v
Test cover:
- Root endpoint ('/')
- Heatlh check ('/health')
- User creation and validation
- User deletion
Check syntax: ansible-playbook --syntax-check -i ansible/inventory.ini ansible/playbook.yml
Dry run: ansible-playbook -i ansible/inventory.ini ansible/playbook.yml --check
Run: ansible-playbook -i ansible/inventory.ini ansible/playbook.yml
Verbose run: ansible-playbook -i ansible/inventory.ini ansible/playbook.yml -vvv
simple-app/
├── app/ # Application and tests
│ ├── main.py # REST API
│ ├── requirements.txt # Python dependencies
│ └── tests/
│ └── test_app.py # pytest tests
├── scripts/
│ └── server-info.sh # Server diagnostic script
├── ansible/ # Ansible deployment
│ ├── playbook.yml
│ ├── inventory.ini
│ └── roles/
├── .github/workflows/ # GitHub Actions CI
│ └── build.yml
├── Dockerfile # Docker image build
├── docker-compose.yml # Local deployment
├── Makefile # Project commands
└── README.md # Documentation
Port 5000 already in use: docker compose down
Docker not running: sudo systemctl start docker
Ansible permission denied: chmod +x scripts/server-info.sh