Infrared is a dockerized django web app infrastructure project. Covers whole software development cycle from development to production. Deployed on AWS ECS with Github Actions running as CI/CD.
The website is accesible under this link.
- Tech stack
- Development setup
- Amazon S3 Storage
- Poetry
- Testing
- Pre-commit
- Django commands
- Deployment & Checks
- Documentation
- Backend - Django + DRF
- Database - PostgreSQL + Amazon RDS
- Dependency management - Poetry
- API Documentation - Swagger
- Containerization - Docker
- CI/CD - Github Actions
- Hosting - Amazon ECS + EC2
Build the Docker images:
docker compose build
For any actions concerning database usage like migrations, testing, creating superuser you're going to need the database. Here's how you can start it as a detached (running in background) container:
docker compose up -d database
Do not forget to run migrations:
docker compose run backend python manage.py migrate
Run the development application:
docker compose up backend
# or alternatively run all the services at once
docker compose up
Access the server locally with port 8000:
http://localhost:8000
Install pre-commit hooks:
pre-commit install
You're also going to need an .env file, so have a look at this example.
In order to work on S3 bucket, you're going to need to set this env variable:
DJANGO_SETTINGS_MODULE=api.settings.storage
# of course you'll also going to need all the AWS credentials
Otherwise use this settings module to work on a local store:
DJANGO_SETTINGS_MODULE=api.settings.local
Here are some helpful poetry commands in case you need to alter the dependencies.
poetry install # installing dependencies
poetry shell # run virtual environment shell
poetry add # add a dependency
poetry remove # remove a dependency
poetry update # update dependency list
poetry show # list isntalled dependencies
! Make sure you have DJANGO_SETTINGS_MODULE=api.settings.local
specified in your .env or container environment !
docker compose run backend pytest -s
pre-commit # runs pre-commit for staged files only
pre-commit run {hook_id} # run specified hoot
pre-commit run --all-files # run for all files
docker compose run backend python manage.py {your_command} {your_args}
Deployment as well as static code checks and running tests is fully automated using Github actions.
Push to feature/*
and main
branches triggers code checks and tests.
Push to main
branch automatically triggers deploy to AWS ECS
.
You can find interactive Swagger documentation on the main page of the app.