- Activate Python virtual env
pip install awsebcli
- If your virtual env files are stored in the application folder, add them to
.ebignore
to prevent them from being uploaded to ElasticBeanstalk. - One-time:
eb init
-> 1 -> DNYF-API-Group -> N -> Python -> Python 3.8 -> N -> N - Create EB environment and deploy existing code:
eb create dnyf-group-api-prod --single
- Deploy new code:
eb deploy dnyf-group-api-prod
- Terminate EB environment:
eb terminate
Terminating cleans up all resources associated with the environment.
pip install -r requirements-dev.txt
pre-commit install
flake8 . --count --statistics
The whole DB schema is re-created on app startup and data re-populated from the sample_data.py
file
Create a network (one-time):
docker network create dnyfcomposite
docker-compose -f docker-compose.yml up --build
docker-compose -f docker-compose.yml up -d --build db
To start the API using a local Python environment:
uvicorn src.app:app --reload
First build and start the containers in debug mode:
docker-compose -f docker-compose.debug.yml up --build
Then in VSCode:
- Navigate to Run and Debug
- Select the Python: Remote Attach configuration
- Start debugging
docker volume create mysql
docker volume create mysql_config
docker network create dnyfnet
docker build --tag dnyf-group-api .
docker run --name dnyf-group-api \
-p 8000:8000 \
--network dnyfnet \
-d dnyf-group-api
docker run --rm --name dnyf-group-db \
--network dnyfnet \
-v mysql:/var/lib/mysql \
-v mysql_config:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=dbuser \
-e MYSQL_USER=dbuser \
-e MYSQL_PASSWORD=dbuser \
-e MYSQL_DATABASE=dnyf-group-db \
-p 3306:3306 \
-d mysql:8.0