This is a full-stack e-commerce web application built with Django, React, and Redux. It provides a comprehensive set of features for both customers and administrators to buy and sell candies and snacks.
This application relies on a PostgreSQL database. For local development, it is recommended to use Docker to run the application, as direct local execution of the Django backend without a containerized database is not supported.
# Clone this repository
git clone https://github.com/pintop9/devops-course-final-project.git
# Navigate to the project directory
cd devops-course-final-project
# Run the containers and build the images in one command
docker-compose up- Backend: Django, Django REST Framework
- Frontend: React, Redux
- Database: PostgreSQL
- Containerization: Docker
- Cloud Provider: AWS
- Infrastructure as Code: Terraform
- CI/CD: Jenkins
This project can be deployed to AWS Cloud using Terraform. This will provision a Jenkins master and a Jenkins agent instance. The Jenkins master will be pre-configured using Jenkins Configuration as Code (CasC), defining plugins, credentials (placeholders), and the main pipeline job from the repository. This automates much of the initial Jenkins setup.
- AWS Account: Ensure you have an active AWS account.
- AWS CLI Configured: Configure your AWS CLI with appropriate credentials and a default region.
- Terraform: Install Terraform on your local machine.
- SSH Key: Ensure you have an SSH key named
aws_tfin the region specified inmain.tf(il-central-1). You can create one via the AWS EC2 console if you don't have one.
The jenkins.yaml configuration includes a placeholder for unclassified.location.url (e.g., http://localhost:8080). Since the Jenkins master's IP address is dynamically provisioned by Terraform, you will need to manually update this Jenkins URL after deployment via Manage Jenkins -> Configure System -> Jenkins Location. This ensures Jenkins generates correct links for notifications and other features.
-
Initialize Terraform: Navigate to the root of the project where
main.tfis located and initialize Terraform.terraform init
-
Review the Plan (Optional but Recommended): See what Terraform will provision before actually creating resources.
terraform plan
-
Apply the Configuration: Execute the Terraform configuration to provision the AWS resources.
terraform apply --auto-approve
This will output the public IP addresses of the Jenkins master and agent. Make a note of them.
After Terraform successfully provisions the instances, you need to perform a few manual steps to connect the Jenkins master and agent:
-
Retrieve Jenkins Master's Public SSH Key: SSH into the Jenkins master instance (using the
aws_tfkey and its public IP) and retrieve the public key for thejenkinsuser:sudo cat /var/lib/jenkins/.ssh/id_rsa.pub
Copy the entire output (it starts with
ssh-rsa ...). -
Add Master's Public Key to Agent:
The
aws_tfkey is for your SSH access to both instances. Thejenkinsuser's key (generated on the master) is for the Jenkins master to access the Jenkins agent.SSH into the Ubuntu agent instance (using the
aws_tfkey and its public IP). Then, as a user withsudoprivileges, execute the following commands.echo "<JENKINS_MASTER_PUBLIC_KEY>" | sudo tee -a /home/jenkins/.ssh/authorized_keys sudo chown jenkins:jenkins /home/jenkins/.ssh/authorized_keys sudo chmod 600 /home/jenkins/.ssh/authorized_keys
Replace
<JENKINS_MASTER_PUBLIC_KEY>with the actual public key you copied from the master. -
Access Jenkins UI and Configure Agent:
- Open your web browser and navigate to
http://<JENKINS_MASTER_PUBLIC_IP>:8080(replace<JENKINS_MASTER_PUBLIC_IP>with the actual IP). - Follow the Jenkins setup wizard. You will need to get the initial admin password from the master instance's logs.
- Once Jenkins is set up, go to "Manage Jenkins" -> "Nodes" -> "New Node".
- Create a new permanent agent.
- Configure the node with the following:
- Host: The public IP of your Ubuntu agent instance.
- Credentials: Add new SSH credentials.
- Scope: System
- ID: (choose a unique ID, e.g.,
jenkins-agent-ssh-key) - Description: (e.g.,
SSH key for Jenkins agent) - Username:
jenkins - From the Jenkins master, get the private key by running:
Paste the entire content of the private key into the "Private Key" field in Jenkins.
sudo cat /var/lib/jenkins/.ssh/id_rsa
- Host Key Verification Strategy: Select "Non verifying Verification Strategy" (for simplicity in a development environment, but not recommended for production).
- Launch method: Launch agent via SSH.
- Remote root directory:
/home/jenkins
- Save the configuration. Jenkins master should now connect to the agent.
- Open your web browser and navigate to
-
CasC Configuration Adjustments (if needed): While Jenkins is pre-configured with CasC, you may need to SSH into the master instance (using your
aws_tfkey) to inspect or manually adjust thejenkins.yamlor related configuration files located at/var/lib/jenkins/casc_configs/if issues arise or further customizations are required. Remember to restart the Jenkins service (sudo systemctl restart jenkins) after any manual changes for them to take effect.
IMPORTANT: The casc_configs/jenkins.yaml file, especially when containing sensitive information like Docker Hub credentials (e.g., YOUR_DOCKERHUB_USERNAME, YOUR_DOCKERHUB_PASSWORD) or plaintext admin passwords, should NEVER be committed directly to a public version control system (like Git) in plaintext.
While CasC allows you to define credentials in YAML, for production environments, it is highly recommended to:
- Use Jenkins' encrypted secrets: For passwords directly in
jenkins.yaml, utilize encrypted password hashes generated by Jenkins (as shown for theadminuser password). - Integrate with external secret management systems: For highly sensitive credentials (like Docker Hub tokens), consider using solutions like HashiCorp Vault, AWS Secrets Manager, or Kubernetes Secrets to manage and inject them securely into Jenkins at runtime.
Always ensure sensitive data is handled with appropriate security measures.
This project supports the following deployment strategies:
- Local Development (Dockerized): For local development and testing, the application can be run using Docker Compose, which sets up the Django backend, React frontend, and PostgreSQL database in isolated containers.
- AWS Cloud (CI/CD): The application can be deployed to AWS using Terraform for infrastructure provisioning and Jenkins for continuous integration and continuous delivery. This setup automates the build, test, and deployment processes.
A completely customized eCommerce / shopping cart application using Django, REACT and REDUX with the following functionality:
- Full featured shopping cart
- Product reviews and Ratings
- Top products carousel
- Product pagination
- Product search feature
- User profile with orders
- Admin product management
- Admin user management
- Admin Order details page
- Mark orders as a delivered option
- Checkout process (shipping, payment method, etc)
- PayPal / credit card integration





