EngineerX Backend Microservices
- Introduction to EngineerX project
- Backend Microservices
- Run Development Environment
- Run Production Environment
- EngineerX code repositories
Introduction to EngineerX Project
EngineerX is an open source web application designed for engineers and specialists. It lets them share their ideas, create tutorials, represent themselves, employ other specialists and ...
Currently, The project is at it's first steps and includes a simple but awesome Content Management System (CMS) that lets content providers to create and manage blog posts.
Key features of the project:
- It's cloud native and can easily get deployed on popular cloud providers like (AWS, Azure and ...)
- It benefits from microservices architectural best practices. It uses technologies like docker and kubernetes to provide a horizontally scalable infrastructure with high availability.
- It includes a wide range of popular development frameworks and libraries like: django, reactjs, nextjs, wagtail and ...
- It benefits from TDD best practices and uses unittest, jest, react-testing-library and cypress for different kinds of tests.
- It uses Jenkins declarative pipeline syntax to implement CI/CD pipelines. (Pipeline as code)
- Developers are able to write different kinds of tests and run them in a parallelized and non-blocking manner. In other words, testing environment is also elastic and scalable.
- It uses Terraform to provision the required cloud infrastructure so it's really easy to deploy the whole project and destroy it whenever it's not needed any more. (Infrastructure as code)
- It's built on top of wagtail. Wagtail enables django developers to have a professional headless CMS which can be customized for many types of businesses.
This repository contains the project's backend microservices. The most important microservice is a django project located here, which is created by wagtail.
Wagtail has many built-in features including Elastic Search integration. To see all of wagtail's built-in features, check this out.
Here is our blog's PostPage which inherits wagtail's Page:
class PostPage(Page):
image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
sections = StreamField(SectionsBlock())
tags = ClusterTaggableManager(through=TaggedPost, blank=True)
api_fields = [
APIField('image', serializer=ImageRenditionField('min-1500x200')),
APIField('image_16x9', serializer=ImageRenditionField('fill-1600x900-c70', source='image')),
APIField('sections'),
APIField('tags'),
APIField('owner_info'),
]
content_panels = Page.content_panels + [
ImageChooserPanel('image'),
StreamFieldPanel('sections'),
FieldPanel('tags')
]
...
The page model has a few fields:
sections
: Contains page's content. Check Wagtail's StreamField Documentation to know more about it's amazing features.api_fields
: These read-only fields are required to expose page's information through REST api.content_panels
: These panels are used by wagtail to create an appropriate django form for creating/editing the page.
git clone https://github.com/HsnVahedi/engineerx-backend
cd engineerx-backend/engineerx
docker build . -t engineerx-backend-django:latest
docker run -it -p 8000:8000 engineerx-backend-django:latest bash
python manage.py makemigrations && python manage.py migrate
mkdir media && mv -vn downloads/ media/downloads/
python manage.py initdb
python manage.py createsuperuser
python manage.py runserver 0.0.0.0:8000
Now you can see the project is running on 127.0.0.1:8000/
. Now go to 127.0.0.1:8000/admin
and login if required.
git clone https://github.com/HsnVahedi/engineerx-backend
cd engineerx-backend
docker-compose pull
docker-compose up
docker-compose exec backend python manage.py initdb
docker-compose exec backend python manage.py createsuperuser
Now you can see the project is running on 127.0.0.1:8000/
. Now go to 127.0.0.1:8000/admin
and login if required.
EngineerX project consists of several code bases:
- engineerx-aws-cli
- engineerx-aws-infrastructure
- engineerx-aws-deployment
- engineerx-backend
- engineerx-frontend
- engineerx-integration
- engineerx-backend-unittest
- engineerx-frontend-unittest
- engineerx-integration-test
- engineerx-efs-pv
- engineerx-efs-pvc
- engineerx-backend-latest-tag
- engineerx-frontend-latest-tag