Giter Club home page Giter Club logo

django-jenkins-integration's Introduction

This is demonstration how to set up a CI/CD pipeline for a simple Python application using Jenkins and Docker and Django

How to Run

First, we need to set up somethings in local

  • Clone this repository
  • python -m venv venv
  • source venv/bin/activate
  • pip install -r requirements.txt
  • python manage.py makemigrations
  • python manage.py migrate
  • python manage.py createsuperuser
  • python manage.py runserver

Second, we need to set up Jenkins and Docker on AWS EC2 instance

  • Create an EC2 Ubuntu instance on AWS and install Jenkins on it
  • Connect to this machine via SSH
  • Update linux packages with sudo apt-get update
  • Install python3 and pip3 with sudo apt-get install python3-pip
  • Install docker with sudo apt-get install docker.io
  • Install Java with sudo apt install openjdk-17-jdk
  • Install Jenkins with
  • Let's start Jenkins and check status with
    • sudo systemctl start jenkins
    • sudo systemctl status jenkins
  • Open Jenkins on your browser with http://<your-public-ip>:8080
  • Get the initial admin password with sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  • Install suggested plugins
  • Create first admin user

Third, we need to set up Jenkins pipeline

  • Let's set up an agent
    • Go to Dashboard > Nodes > New Node
    • Enter a name for your agent
  • Let's create a job
  • In configuration page
    • Fill the GitHub repository URL
    • Select Git under Source Code Management
    • Fill the secret key of your GitHub repository that is generated bu webhooks in Github
    • Let's configure build triggers by choosing Branches to build
  • Configuring Docker on Jenkins
    • In Build Steps, Enter the commands to build and run
    • sudo docker build . -t // This command will build the image
    • sudo docker run -d -p 8005:8005 // This command will run the image
  • And click the Build Now button to run the job

django-jenkins-integration's People

Contributors

mustafaakgul avatar

Stargazers

Nejat Boy avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.