Simplify Deployment: Setting Up CTO.ai with Your DigitalOcean Account
As an official DigitalOcean partner, CTO.ai's easy and simple integration with DigitalOcean can enhance your deployment workflows, making them more efficient and reliable. CTO.ai is a CI/CD platform designed for simplicity and ease of use, ideal for teams looking to automate their development processes. This guide will walk you through setting it up with your DigitalOcean account.
By using CTO.ai's capabilities with DigitalOcean's cloud infrastructure, you can automate your software delivery process, from code commits to deployment, enhancing productivity and reducing manual errors.
Prerequisites
- An active DigitalOcean account.
- A CTO.ai account.
- A GitHub account.CTO.ai CLI installed in your local machine.
Installation
The DigitalOcean Workflow is open source on GitHub, and you can install it by cloning the repository.
git clone git@github.com:workflows-sh/do-k8s-cdktf.git
cd do-k8s-cdktf
Sign up on DigitalOcean
- Visit cloud.digitalocean.com to sign up or log in with your Google or GitHub account.
Create API and SPACES Keys
- In your DigitalOcean dashboard, create your API and SPACES keys for your workflow setup by selecting API on your DigitalOcean dashboard. For the DigitalOcean workflow, we will be creating the DigitalOcean Token from the API, the Terraform Token from Terraform workspace, the Digital Spaces Access and Secret key from the Spaces Token in DigitalOcean, and the GitHub Token from GitHub.
- DO_TOKEN
- DO_SPACES_ACCESS_KEY_ID
- DO_SPACES_SECRET_ACCESS_KEY
- TFC_TOKEN
- GITHUB_TOKEN
CTO.ai will use these API keys to authenticate, request, and create your DigitalOcean Workflow.
- In the Personal Access Tokens area, click on Generate New Token and create your DigitalOcean access token (DO_TOKEN).
- In your Spaces access keys section, create your
DO_SPACES_ACCESS_KEY_ID
. When you create yourDO_SPACES ACCESS_KEY_ID
, it will generate your spaces' access key and secret key.
Create an account on Terraform Cloud
- Create and log in to your account on Terraform Cloud.
- Select API tokens and generate an API Token for your Terraform workspace.
Create Token from GitHub
Next, create your GitHub token in your developer settings on GitHub and give it admin permissions.
Add Tokens to CTO.ai
Next, add the tokens you created from DigitalOcean and Terraform Cloud to your secrets on CTO.ai. On your CTO.ai dashboard, select Settings, click on Secrets, and add all the secrets you created with the value.
Configs
You can pass and add different environment variables, database URLs, and other credentials for your workflow in the configs section on the CTO.ai dashboard. See the ops.yml
file below to learn how to configure your DigitalOcean workflow.
Next, run and setup your infrastructure using ops build .
Creating an Ops.yml File for CTO.ai
In your GitHub repo or project directory, create an ops.yml
file, which defines the CI/CD workflow.
version: "1"
pipelines:
- name: simple-pipeline
description: Simple Docker build and push to DigitalOcean Container Registry
env:
secrets:
- GITHUB_TOKEN
- DO_TOKEN
events:
- "github:my-org/my-repo:pull_request.opened"
- "github:my-org/my-repo:pull_request.merged"
jobs:
- name: simple-build
description: Basic build and push job
steps:
- git clone https://oauth2:$GITHUB_TOKEN@github.com/my-org/my-repo
- cd my-repo
- docker build -f Dockerfile -t my-app:latest .
- docker tag my-app:latest registry.digitalocean.com/my-org/my-app:latest
- docker push registry.digitalocean.com/my-org/my-app:latest
This configuration handles the build and deployment process, including running tests and deploying to DigitalOcean via CTO.ai workflows.
Activating the Workflow
- Every new push, pull request open, or pull request merged to your repository will trigger the CTO.ai workflow.
- The defined steps in
ops.yml
will be executed, resulting in the deployment of your application to DigitalOcean.
Conclusion
Setting up CTO.ai with DigitalOcean simplifies your deployment processes, enabling a more efficient and error-free operation.
Ready to unlock the power of CTO.ai for your team? Schedule your consultation now with one of our experts today!