Setting up and deploying a new builder instance - xogroup/image-builder GitHub Wiki
This is to be done when updating or installing new languages/technologies/frameworks.
You MUST be an admin within Circle Ci to do this.
- Current Version: 1.1.2
- Image URL: https://s3.amazonaws.com/circleci-images/xo-circle-ci_1.1.2.tar.gz
Building a new image
- Check out master from https://github.com/xogroup/image-builder
- Make sure your remote is set to upstream with circle's version
git remote set upstream [email protected]:circleci/image-builder.git
git fetch upstream
git rebase upstream/master
- Make changes to Dockerfile as needed (or included circleci-provision-scripts)
- Rebuild
export IMAGE_VERSION=VERSION_LISTED_ABOVE #eg: 1.1.2
docker build --build-arg IMAGE_TAG=ubuntu-14.04-enterprise-$IMAGE_VERSION -t xo-circle-ci:$IMAGE_VERSION .
- Tar the docker image
export IMAGE_VERSION=VERSION_LISTED_ABOVE #eg: 1.1.2
./docker-export xo-circle-ci:$IMAGE_VERSION > xo-circle-ci_$IMAGE_VERSION.tar.gz
- Verify any changes are persistent in the image
docker run -it IMAGE_ID_HERE bash
#Check versions of what you changed here
- Upload the image to S3 bucket
circleci-images
Launching new EC2 for builder (To be automated in the future)
- Find current builder
- Right Click -> Launch More Like This
- Click Launch
- Choose "circleci" key pair
Deploying a new builder
You must be root to run these commands so after ssh'ing in run
sudo -i
then run these commands:
export CIRCLE_PASSPHRASE=PASSWORD_STATE_HAS_THIS #make sure you are using the really long key not the same password that you use to login to the Circle CI master service admin
export IMAGE_VERSION=VERSION_LISTED_ABOVE #eg: 1.1.2
export SERVICES_PRIVATE_IP=PRIVATE_IP_OF_MASTER_SERVICE_BOX
curl https://s3.amazonaws.com/circleci-enterprise/init-builder-0.2.sh -o init-builder.sh
sudo SERVICES_PRIVATE_IP=$SERVICES_PRIVATE_IP CIRCLE_SECRET_PASSPHRASE=$CIRCLE_PASSPHRASE CIRCLE_CONTAINER_IMAGE_URI="s3://circleci-images/xo-circle-ci_$IMAGE_VERSION.tar.gz" bash ./init-builder.sh
Verifying the new builder is online
After the commands to start up the builder with circle have been run, it should be about 5-10 minutes for the builder instance to come online. To verify when it is online, visit the fleet state screen. You should see your instance id listed here and active.
Kill old builders
Once your new builder is online and active. Ensure that the old builder has no pending jobs. If it is empty, the proceed to kill the old builder instance through EC2's interface (terminate)