Example code for CircleCI Runners
Installing the CircleCI Runner
Create a CircleCI Personal API Token
sudo curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash
``
# Create a CircleCI namespace you can have only one namespace per Organization
```shell
circleci namespace create ***<Name for namespace>*** github ***<VCS Organization>***
circleci runner resource-class create ***namespace/<name for resource-class>*** "digital ocean runner"
NOTE: Save the Runner Token
value upon creating. This will be the only time the token will be visible. You will have to regenerate the token if you don't capture it on previous creation attempts. I suggest you assign the token value to a $RUNNER_TOKEN
environment variable locally on the machine executing and provisioning your CircleCI Runners. This will prevent exposing this sensitive data in command line executions.
circleci runner token create ***namespace/<resource-class name>*** ***"<description>"***
These are the commands for the terraform execution commands.
terraform plan \
-var "do_token=${DIGITAL_OCEAN_TOKEN}" \
-var "runner_token=${RUNNER_TOKEN}" \
-var "runner_name=dorunner" \
-var "ssh_key_file=${HOME}/.ssh/id_rsa"
terraform apply \
-var "do_token=${DIGITAL_OCEAN_TOKEN}" \
-var "runner_token=${RUNNER_TOKEN}" \
-var "runner_name=dorunner" \
-var "ssh_key_file=${HOME}/.ssh/id_rsa"
terraform apply \
-var "do_token=${DIGITAL_OCEAN_TOKEN}" \
-var "runner_token=${RUNNER_TOKEN}" \
-var "runner_name=dorunner" \
-var "ssh_key_file=${HOME}/.ssh/id_rsa" \
-auto-approve
terraform destroy \
-var "do_token=${DIGITAL_OCEAN_TOKEN}" \
-var "runner_token=${RUNNER_TOKEN}" \
-var "runner_name=dorunner" \
-var "ssh_key_file=${HOME}/.ssh/id_rsa"
terraform destroy \
-var "do_token=${DIGITAL_OCEAN_TOKEN}" \
-var "runner_token=${RUNNER_TOKEN}" \
-var "runner_name=dorunner" \
-var "ssh_key_file=${HOME}/.ssh/id_rsa" \
-auto-approve