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 are authorized and added as a project to circleci.com, every code change triggers CircleCI jobs. CircleCI sends an email notification of success or failure after the test completes. 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 at GitHub. In this example, we will configure CircleCI to deploy the Rate Limiting app directly on the Heroku platform.
Go to https://circleci.com and log in using your GitHub account:
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.
CircleCI believes in configuration as code. As a result, the entire delivery process from build to deploy is orchestrated through a single file called
config.yml file is located in a folder called
.circleci at the top of your project. CircleCI uses the YAML syntax for config.
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.
Once you click “Set Up Project” it will ask you to select sample configs as shown in the following screenshot:
Add the following content under
.circleci/config.yml and save the file:
In the configuration above, we pull in the Heroku orb
email@example.com, which automatically gives us access to a powerful set of Heroku jobs and commands.
One of those jobs is
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.
Follow these steps to set up a Heroku account and create a new app
rate-limit-python. You will need the Heroku API key for this demo.
Before you push your project to Heroku from CircleCI, you will need to configure an authenticated handshake between CircleCI and Heroku. Configure the handshake by creating two environment variables in the settings for your CircleCI project:
HEROKU_APP_NAMEis the name of your Heroku application (in this case,
HEROKU_API_KEYis your Heroku account API key. This can be found under the Account tab of your Heroku account under Account Settings. Scroll to the API Key section and click Reveal to copy your API key.
On the sidebar menu of the settings page, click Environment Variables under Build Settings. On the environment variables page, create two variables named
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.
You should now be able to access your application.