Resources for getting a local Subatomic development environment up and running.
Follow the below steps to get a local Subatomic environment ready for local development:
Follow the instructions to install minishift for your platform. Make sure you have at least version v1.33.0+ba29431 or greater installed.
Clone this project locally:
$ git clone https://github.com/absa-subatomic/local-hadron-collider.git
$ cd local-hadron-collider
A Subatomic minishift addon is used to configure the routing for Subatomic.
There is a preconfigured certificate chain for the *.subatomic.local
domain. The Subatomic minishift addon configures the default routing subdomain to subatomic.local
and replaces the existing default router certificate with the *.subatomic.local
wildcard certificate and certificate chain.
Install and enable the Subatomic addon and enable admin-user
addon with the following:
$ minishift profile set subatomic-local
Profile 'subatomic-local' set as active profile
$ minishift addons enable admin-user --profile subatomic-local
Add-on 'admin-user' enabled
$ minishift addons install minishift-addons/subatomic --profile subatomic-local
Addon 'subatomic' installed
$ minishift addons enable subatomic --profile subatomic-local
Add-on 'subatomic' enabled
Start a new minishift instance for local development with parameters:
Warning: If you have VirtualBox installed and you decide to use the xhyve vm driver you might get a kernel panic. Make sure that you set the vm-driver to xhyve $ minishift config set vm-driver xhyve
before starting minishift. To use virtualbox, set the vm-driver to xhyve $ minishift config set vm-driver virtualbox
.
$ minishift start \
--profile subatomic-local \
--cpus 4 --memory 6144MB --disk-size 60GB \
--routing-suffix subatomic.local
Note: Change the cpu, memory and disk size above to best suit the resources on your local machine while still maintaining the minimum requirements needed to run minishift.
Output:
-- Starting profile 'subatomic-local'
...
-- Applying addon 'subatomic':
Replacing default router certificate for *.subatomic.local....
Setting the routing subdomain to 'subatomic.local'..
The Subatomic routing configurations have been successfully completed 👍
Due to updating the `master-config.yaml` you must restart your minishift instance
Restart minishift by executing the following command *now*:
minishift openshift restart
-- Applying addon 'admin-user':..
If for any reason the Subatomic minishift addon fails, you can retry applying the addon by running:
$ minishift addons apply subatomic
For the routing subdomain change you must restart your minishift instance:
$ minishift openshift restart
Restarting OpenShift
To resolve the subatomic.local
domain you must setup your local machine to resolve to the minishift IP.
First get the minishift IP with:
$ minishift ip
192.168.64.15
This is the recommended solution to local DNS
Installing dnsmasq varies from platform to platform. Please use the platform specific installation method for your platform. As an example, install dnsmasq on macOS using Homebrew with:
$ brew install dnsmasq
...
To configure dnsmasq to resolve to your minishift IP, add the following to your /usr/local/etc/dnsmasq.conf
:
# IP of the HAProxy router: minishift ip
address=/subatomic.local/192.168.64.15
Restart dnsmasq and you should be able to curl
a non-existent route:
$ curl -I nothing.subatomic.local
HTTP/1.0 503 Service Unavailable
Pragma: no-cache
Cache-Control: private, max-age=0, no-cache, no-store
Connection: close
Content-Type: text/html
You should get a 503 Service Unavailable
response.
/etc/hosts
You could also manually add entries into your /etc/hosts
for the various routes you expose.
Subatomic needs the following components installed:
In addition, the Jenkins and S2I images beed to be built and available.
All this is accomplished by running the OpenShift Applier. The applier will add the various resources required to build and deploy the above.
The OpenShift Applier requires that Ansible > 2.5 be installed. Please follow the installation guide to install for your platform.
oc
CLI toolThe OpenShift Applier will use the current logged in context for your minishift instance. So first, login using the oc
CLI tool.
Login into the OpenShift console UI as the admin
user (admin
/ admin
) and get your token by clicking on Copy Login Command:
Now login using the oc
CLI tool:
$ eval $(minishift oc-env)
$ oc login https://192.168.64.15:8443 --token=UaUbbHWlHTul8mecJuM31mJQfmid7x5dV0fIecihW8c
...
The OpenShift Applier is a playbook implemented in the OpenShift Applier project. Therefore,
First you need to install the applier dependency via Ansible Galaxy.
$ cd local-hadron-collider
$ ansible-galaxy install --role-file requirements.yml --roles-path=roles
...
Then run the OpenShift Applier role with:
$ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES #see: https://github.com/ansible/ansible/issues/32499
$ ansible-playbook -i inventory/hosts roles/openshift-applier/playbooks/openshift-cluster-seed.yml
...
Two new projects will be created:
$ oc get builds --namespace subatomic
NAME TYPE FROM STATUS STARTED DURATION
jdk8-maven3-newrelic-subatomic-3 Docker Git@f812447 Complete 4 minutes ago 15m47s
jenkins-slave-maven-subatomic-1 Docker Git@2129cfe Complete 31 minutes ago 15m28s
jenkins-subatomic-1 Docker Git@2129cfe Complete 31 minutes ago 22m4s
$ oc get imagestreams --namespace subatomic
NAME DOCKER REPO TAGS UPDATED
jdk8-maven3-newrelic-subatomic 172.30.1.1:5000/subatomic/jdk8-maven3-newrelic-subatomic 2.0 18 minutes ago
jenkins-slave-maven-subatomic 172.30.1.1:5000/subatomic/jenkins-slave-maven-subatomic 2.0 15 minutes ago
jenkins-subatomic 172.30.1.1:5000/subatomic/jenkins-subatomic 2.0 8 minutes ago
$ oc get deploymentconfigs --namespace subatomic-infra
NAME REVISION DESIRED CURRENT TRIGGERED BY
bitbucket-server 1 1 1 config,image(bitbucket-server:5.4.6)
nexus 1 1 1 config,image(nexus:2.14.6-02)
Now wait for the various deployments and builds to complete.
⚠️ This can take a long time depending on your internet connection. Builds may fail due to network related issues. You can start new builds to complete the failed builds and deployments.
Once the Bitbucket Server deployment has completed successfully, you need to complete the setup via the web interface.
Open your Bitbucket Server instance by clicking this link: https://bitbucket.subatomic.local/
Choose the Internal
database and when prompted for a license, either get a trial license or use a Developer License
from your Atlassian technical contact.
Next, configure the administrator user as follows:
Field | Value |
---|---|
Username | subatomic |
Full name | Subatomic |
subatomic@local | |
Password | subatomic |
The Post Webhooks for Bitbucket plugin must be installed. This plugin is what allows Jenknins to be notified of pushes to branches and for pull requests.
To install this plugin follow these steps:
post for webhooks
in the search field and click searchFor now you have to manually add Bitbucket user accounts for each team member you would like to test with. To add a user account, go to Administration > Users
⚠️ The
Username
must match the domain username you enter when on-boarding a team member.
Repeat this for however many test members you are going to use.
Now that your local test environment should be up and running, you can start Gluon and Quantum Mechanic: