CircleCI is a CI/CD platform built by DevOps professionals to help you fine-tune your entire development process from start to finish. It helps engineering teams build, test, and deploy software while checking code changes in real time with the CircleCI dashboard UI. More control over pipelines is possible with the ability to build in the CI/CD process per project or configure workflows to decide on when and how jobs run, plus data- and image-caching options that optimize continuous delivery.
CircleCI supports many different languages and a varied amount of cloud-hosted compute types such as Docker, Linux VMs, macOS, Windows, and more for a simplified approach to infrastructure. With the CircleCI dashboard, it's possible to gather insights on build changes to continuously optimize pipelines.
To deploy, CircleCI takes artifacts from your pipeline and sends them to wherever you need them deployed, whether it's Docker, Heroku, Kubernetes, cloud platforms, and more.
After GitHub or Bitbucket is authorized and added as a project to cirlceci.com, every code change triggers CircleCI jobs. CircleCI sends an email notification of success or failure after the test is completed. CircleCI finds and runs config.yml, tests the build, runs security scans, goes through approval steps, and then deploys.
As a DevOps engineer or developer, you can:
SSH into any job to debug build issues.
Set up jobs to run in parallel to reduce time.
Configure a Redis cache with two simple keys to reuse data from previous jobs in your workflow.
Configure self-hosted runners for unique platform support.
Access Arm resources for the machine executor.
Use reusable packages of configuration to integrate with third parties.
Use a pre-built Redis Docker image in a variety of languages.
Use the API to retrieve information about jobs and workflows.
Use the CLI to access advanced tools locally.
Get flaky test detection with test insights.
A CircleCI account
A GitHub account
A Heroku account
In this demo, we will be using the Redis Rate Limiting app built using Python and Redis.
Rate limiting is a mechanism that many developers may have to deal with at some point in their life. It’s useful for a variety of purposes, such as sharing access to limited resources or limiting the number of requests made to an API endpoint and responding with a 429 status code. The complete source code of the project is hosted over GitHub. In this example, we will configure CircleCI to deploy the Rate Limiting app directly on the Heroku platform.
Choose your preferred login method. To make it easier, let us choose “GitHub” for this demonstration.
We will be using the Redis rate-limiting project for this demonstration.
As we haven’t yet created a config.yml file, let’s choose the “Fast” option to create a new config.yml based on the available template that is editable.
version: 2.1
orbs:
heroku: circleci/heroku@1.2.6
workflows:
heroku_deploy:
jobs:
- heroku/deploy-via-git
In the configuration above, we pull in the Heroku orb circleci/heroku@1.2.6, which automatically gives us access to a powerful set of Heroku jobs and commands.
One of those jobs is the heroku/deploy-via-git, which deploys your application straight from your GitHub repo to your Heroku account.
Once you make the new change, it will ask you to raise a new PR. Go ahead and merge the changes as of now.
On the sidebar menu of the settings page, click Environment Variables under Build Settings. On the environment variables page, create two variables named HEROKU_APP_NAME and HEROKU_API_KEY and enter the values for them.
With these in place, our CircleCI configuration will be able to make authenticated deployments to the Heroku platform.
As soon as you merge the pull request, the tool will trigger the build automatically.
remote: Collecting attrs>=19.2.0
remote: Downloading attrs-21.4.0-py2.py3-none-any.whl (60 kB)
remote: Collecting wrapt<2,>=1.10
remote: Downloading wrapt-1.14.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (77 kB)
remote: Collecting pyparsing!=3.0.5,>=2.0.2
remote: Downloading pyparsing-3.0.7-py3-none-any.whl (98 kB)
remote: Installing collected packages: wrapt, pyparsing, typing-extensions, sqlparse, packaging, deprecated, async-timeout, asgiref, tomli, redis, py, pluggy, iniconfig, h11, Django, click, attrs, uvloop, uvicorn, urllib3, sniffio, rfc3986, pytz, python-dotenv, pytest, django-redis, django-ipware, django-cors-headers
remote: Successfully installed Django-4.0.3 asgiref-3.5.0 async-timeout-4.0.2 attrs-21.4.0 click-8.1.0 deprecated-1.2.13 django-cors-headers-3.11.0 django-ipware-4.0.2 django-redis-5.2.0 h11-0.13.0 iniconfig-1.1.1 packaging-21.3 pluggy-1.0.0 py-1.11.0 pyparsing-3.0.7 pytest-7.1.1 python-dotenv-0.20.0 pytz-2022.1 redis-4.2.0 rfc3986-2.0.0 sniffio-1.2.0 sqlparse-0.4.2 tomli-2.0.1 typing-extensions-4.1.1 urllib3-1.26.9 uvicorn-0.17.6 uvloop-0.16.0 wrapt-1.14.0
remote: -----> $ python server/manage.py collectstatic --noinput
remote: 133 static files copied to '/tmp/build_3850bcfb/server/static_root'.
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 75.3M
remote: -----> Launching...
remote: Released v11
remote: https://*****************.herokuapp.com/ deployed to Heroku