This is a django app to coordinate the logistics between the ones that need help and the ones willing to provide it.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Python3.7+ installed.
- PIP installed - the officially recommended Python packaging tool.
- Virtual environment set up - we recommend using conda or virtualenv.
and then creating to use your virtual env
pyenv virtualenv togetherapp
to create itpyenv activate togetherapp
to activate itpyenv deactivate
to activate it
- Docker
- Docker compose
First you need to clone project from 2gether repository to your local machine.
Simple
git clone https://github.com/ayuda-app/backend
command will clone project on your local machine
Create and activate virtual environment:
python manage.py -m venv {name_of_the_environment}
. {name_of_the_environment}/bin/activate
This is one of many ways to create and activate venv. Alternatively, you can use one of the suggestions listed in prerequisites
Execute
pip install -r requirements.txt
To run the server on your local machine:
- Setup docker compose:
- Then run
Then you can access http://localhost:8000
docker-compose up
Please make sure to assign yourself a ticket before working on it.
├── app
│ ├── migrations contains database schema migrations
│ ├── models contains app models
│ ├── admin.py
│ ├── apps.py
│ ├── filters.py
│ ├── test.py
│ └── views.py
│
├── ngix
├── together
│ ├── settings contains settings for different environments
│ │ ├── default.py
│ │ ├── dev.py
│ ├── asgi.py
│ ├── constants.py
│ ├── wsgi.py
│ └── urls.py
│
│
├── static
├── manage.py
├── readme.md
├── .dockerignore
├── .gitignore
├── appspec_template.yaml
├── buildspec.yml
├── docker-compose.yml
├── Dockerfile
└── requirements.txt
Deployment is done on every push to either dev/master branch. Code is deployed to dev/prod environments respectively. CodePipeline is setup to listen on changes on github repository. On every push, new docker image is built and pushed to the AWS ECR repo.
Application is deployed in AWS ECS and is started using gunicorn. All traffic is being routed through nginx container which stips the SSL and doing the serving of static content. More details on the infrastructure is written in wiki page of the 2GETHER repository.
Important files/directories for deployment are:
- nginx/
- buildspec.yml
- appspec_template.yml
- Dockerfile
For deploy on AWS, it is enough to just commit, push, merge the code to the appropriate branch, and CICD will be triggered. After couple of minutes, new version of application will be available.
This project follows PEP 8 style guide.
Dependencies used within project:
- Django Rest Framework toolkit for building Web APIs