Hykins is a serverless Jenkins distro optimized for containers. Currently, Hykins supports Hyper.sh as infrastructure provider, with more to be added easily.
First, you need to setup your account on Hyper.sh:
- Create an account
- Provide your billing information and complete your account
- Generate a credential
- Install and configure
hyper
CLI on your laptop
There is a prebaked Docker image for Hykins available in Docker Hub. You can simply pull the image to your Hyper.sh account:
$ hyper pull hyperhq/hykins
What's in the image?
hyperhq/hykins
is based onjenkins:latest
, with the following items installed:
hyper
command line toolshyper-slaves-plugin
for Jenkins- Recommended plugins by Jenkins community
You can find the Dockerfile here.
To deploy Hykins in Hyper.sh:
$ hyper run --name hykins -d -P \
--size=m1 \
-e ADMIN_USERNAME=xxxxx \
-e ADMIN_PASSWORD=xxxxx \
-e ACCESS_KEY=xxxxx \
-e SECRET_KEY=xxxxx \
hyperhq/hykins
Notes:
- By default, Hykins is launched in
development
mode(the Setup Wizard will not appear). See below to see how to run Hykins in production mode- In
development
mode, the recommended container size ism1
(1GB)ADMIN_USERNAME
/ADMIN_PASSWORD
is for the Hykins admin account (default:admin
/nimda
)ACCESS_KEY
/SECRET_KEY
is the API credential of Hyper.sh
Containers in Hyper.sh come without public IP address by default. To enable Internet access, you need to request one and attach to the container:
$ FIP=`hyper fip allocate 1`
$ hyper fip attach $FIP hykins
To run Hykins in production mode, use the following command:
$ hyper run --name hykins -d -P --size=m2 -e PRODUCTION=true \
-v hykins-data:/var/jenkins_home \
-e ACCESS_KEY=xxxxx -e SECRET_KEY=xxxx hyperhq/hykins
$ FIP=`hyper fip allocate 1`
$ hyper fip attach $FIP hykins
Notes:
- The recommended container size is
m2
(2GB
memory)
In Production Mode, you need to unlock Jenkins to be able to access:
- Open the web portal in your browser
http://${FIP}:8080
- Setup Wizard
will prompt to ask for initial admin password
- run
hyper exec -it hykins cat /var/jenkins_home/secrets/initialAdminPassword
//Step 1: create "Freestyle project" helloworld
//Step 2: check "Run the build inside Hyper.sh container"
- Docker Image: jenkinsci/slave
- Container Size: S4
Other tested base images are:
- oracle/openjdk:8
- openjdk:8-jdk
- hyperhq/jenkins-slave-centos
- hyperhq/jenkins-slave-golang:1.7-centos
- hyperhq/jenkins-slave-golang:1.7-ubuntu
//Step 3: Add build step "Execute shell"
- Command:
Here is the shell script:
set +x
echo ------------------------------------------------
cat /etc/os-release
echo ------------------------------------------------
cat /proc/cpuinfo | grep -E '(processor|model name|cpu cores)'
echo ------------------------------------------------
cat /proc/meminfo | grep ^Mem
echo ------------------------------------------------
Trigger build manually in this demo.
- update jenkins from 2.19.4 to 2.138.3
- update hyper-slaves-plugin to 0.1.11 (add -workDir for slave.jar)
- add groovy/disableStrictVerification (ref https://issues.jenkins-ci.org/browse/JENKINS-41384?filter=10244)
- add groovy/CSRFProtection (ref https://wiki.jenkins.io/display/JENKINS/CSRF+Protection)
- update jenkins from 2.19.3 to 2.19.4
- update hyper-slaves-plugin to 0.1.6(retry when download slave.jar failed)
- update jenkins from 2.7.4 to 2.19.3
- update hyper-slaves-plugin to 0.1.5(rely on docker-slaves-plugin)