Sprint-1 Review
Containerizing our API
To run the project as is and play around before you make changes, you should have docker and a preferred code editor installed.
Install docker
After cloning the repo locally, run:
docker compose up
This launches all the services required, exec into the backend container, migrate the db and create superuser
docker exec -ti -u root 82752d8c2b76 /bin/bash
python manage.py createsuperuser
python manage.py migrate
'82752d8c2b76' <-- refers to the container ID. You can get the ID by running
docker ps
If you prefer not using docker (docker images can be data consuming if you're on limited data) you can run manually with this steps
Set Up virtual environment, I'm assuming you have virtualenv installed Change to sqlite3 in settings by uncommenting and commenting the appropriate sections
virtualenv venv
source venv/bin/activate
python backend/manage.py runserver
Follow the conversation on Discord Join Discord Srrver.
In this sprint we've created three skeleton apps with starter code
models.py, views.py, serializers.py and urls.py
Models manages our database
views handles requests
serializers convert data from and to json objects
Django structures its architecture as apps. Each app to handle a specific function.
eaty <------ Main Django Project (Created by django-admin startproject eaty
)
core <------- This handles our user accounts and authentication
blog <------- blogging section/food blog
mealgenerator < -------- gets list of food from users, stores, daily generates meal from this list
./backend/eaty/urls.py <---- entrypoint for all API urls/routes
./backend/eaty/settings.py <---- main settings and config file
Admin login using superuser credentials: https://127.0.0.1:8000/admin
Get a list of users: https://127.0.0.1:8000/users/
Get a list of Posts: https://127.0.0.1:8000/posts/
Login API: https://127.0.0.1:8000/api-auth/login/?next=/users/
List of food categories: https://127.0.0.1:8000/foodcategories/
API for Food items: https://127.0.0.1:8000/foods
User Registration: https://127.0.0.1:8000/api/register/
POST generated meal: https://127.0.0.1:8000/foods/generatedmeal/
Generated Meals History: https://127.0.0.1:8000/foods/generatedmealhist/
(Use a tool like Insomnia and send the POST request with the registration data )
Make sure you're in the current sprint branch before commiting and pushing changes
(env) :/opt/eaty/eaty$ git branch
Sprint-1
* main
(env) :/opt/eaty/eaty$ git checkout Sprint-1
Switched to branch 'Sprint-1'
(env) :/opt/eaty/eaty$ git branch
* Sprint-1
main
Replaced CI/CD on Github Actions with Jenkins Install Jenkins then follow instructions to run a Tes CI for DRF
To view everything related to Sprint-1 only, checkout to Sprint-1 Branch For Sprint-1
- Create the project and the login and registration endpoints
- Create Food categories/lists endpoint
This is to challenge your self to see if you've understood the workflow
Create models for meals
then an API endpoint to get a list of Meals
Note the difference between food and Meals
Food > Ugali, Nyama, Skuma, kales
Meal > Ugali & Skuma, Ugali & Nyama
Sprint One ends in June 11th
Join our Discord Server for more communication and personalized help
https://discord.gg/CYySyHrq
To view everything related to Sprint-2 only, checkout to Sprint-2 Branch For Sprint-2
- We will add a CI using Github actions
- One pipeline will basically to do a build test for all pull requests.
- The secodn pipeline will be an action that sends a notif to our discord Server when there is activity on the project
- Add Docker and change to PostgresSQL Database
- Create a Login page using VueJs/React
Using the /foods endpoint, create a meal from that and store it as a separate model which can be retrieved as an API Endpoint
To view everything related to Sprint-3 only, checkout to Sprint-3 Branch For Sprint-3
- Food upload form that updates list of foods in the db
- Meal generate function - generates random food from /foods endpoint
- Push image to dockerhub, with automated updates - CI to auto update images to dockerhub
- Write production Dockerfile and docker compose
We are going for a real-world example of a DevOps project. There are a few free services we'll use but in some cases we'll need to use premium/paid subscriptions in order to simulate a real-world use case and gain experience. If you feel a little generous and would like to contribute in purchasing any of the services, you can make a donation here or you can reach out to the Community Lead: Moses Mbadi - [email protected]