DEV Community

Cover image for GitLab CI/CD Pipeline for Django/Node Application Deployment on AWS EC2
On-cloud7
On-cloud7

Posted on

1 1 1 1 1

GitLab CI/CD Pipeline for Django/Node Application Deployment on AWS EC2

what is gitlab?
GitLab is a web-based DevOps platform that provides a complete CI/CD (Continuous Integration/Continuous Deployment) pipeline along with Git repository management, issue tracking, and security features. It enables developers to collaborate, automate workflows, and deploy applications efficiently.

Key Features of GitLab:

1. Version Control: Git-based repository management, similar to GitHub and Bitbucket.
2. CI/CD Integration: Built-in Continuous Integration & Continuous Deployment (CI/CD) pipelines.
3. Issue Tracking & Project Management: Helps teams manage work using boards, milestones, and issue tracking.
4. Security & Compliance: Offers code quality checks, security scanning, and compliance features.
5. Container Registry: Built-in Docker container registry for managing images.
6. Self-Hosted or Cloud-Based: Available as GitLab.com (cloud-hosted) or GitLab Self-Managed (on-premises installation).
7. Infrastructure as Code: Supports Kubernetes, Terraform, and Infrastructure as Code (IaC).
8. Monitoring & Logging: Provides built-in monitoring via Prometheus.

Tools Required:

1. GitLab: For repository hosting and CI/CD pipeline.
2. Docker: For containerizing the Django/Node application.
3. AWS EC2: For hosting the deployed application.
4. Django or Node.js: Depending on the chosen stack for the
application development.
5. Any code editor (like Visual Studio Code, Atom, etc.)

Step 1: Setup an AWS EC2 Instance

  1. Launch an Ubuntu 22.04 EC2 instance
  2. Allow ports 22, 80, 443 in security groups
  3. SSH into

*Step 2: Open GitLab and add a new project *

  1. Open Gitlab.com & set up the account

Image description

  1. add new project
  2. Import the project

Image description

  1. Click on Repository by URL

Image description

Image description

Image description

Step3: Create .gitlab-ci.yml file
1.Create a new file

Image description

  1. Name the file .gitlab-ci.yml file

Image description

*Step4: Run the pipeline *
1.Go to main project & click on pipeline

Image description

  1. pipeline is pending

  2. Go to the setting ,click on CI/CD and go to the runner

Image description

Image description

  1. Enable the Runner

Image description

Image description

Step5:Setup Docker & Docker Compose

Image description

  1. install Docker

Image description

Image description

Image description

Image description

Image description

Image description

Step 6: Add port to the Security group

Image description

Image description

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup 🚀

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

Top comments (0)

Image of DataStax

AI Agents Made Easy with Langflow

Connect models, vector stores, memory and other AI building blocks with the click of a button to build and deploy AI-powered agents.

Get started for free