DivByZero.com

Much ado about scripting, Linux & Eclipse: card subject to change

2019-07-04

Creating your own devfile registry

Third in this series... how to create and deploy your own custom devfile registry, so you can include your own stacks out of the box inside Che 7.

Creating your own devfile registry

Prerequisites

You need a Kubernetes or OpenShift cluster (eg., minikube or minishift), into which you have installed Che. Follow the steps in this document to deploy Che.
Steps below can then be done to deploy a custom devfile registry to your cluster, and use it with Che.

Procedure

  1. git clone https://github.com/eclipse/che-devfile-registry/
    cd che-devfile-registry
  2. Make changes in the devfiles/ folder to add new or remove existing devfile folders from the registry.
  3. Build the image.
    This example uses a personal quay repository and an arbitrary tag ubi8-2, but you can use another image registry and path as needed.
    docker build . -f Dockerfile --no-cache \
      -t quay.io/nickboldt/che-devfile-registry:ubi8-2
  4. Push it to quay (or your image registry of choice)
    docker push quay.io/nickboldt/che-devfile-registry:ubi8-2
    Verify the image and tag you pushed are published, eg.,
    Verify the Repository Visibility is public, eg.,
  5. Remove any existing che-devfile-registry deployments.
    oc delete dc che-devfile-registry; \
    oc delete svc che-devfile-registry; \
    oc delete route che-devfile-registry; \
    sleep 5s
  6. Deploy the new che-devfile-registry.
    oc new-app -f deploy/openshift/che-devfile-registry.yaml \
      -p PULL_POLICY="Always" \
      -p IMAGE="quay.io/nickboldt/che-devfile-registry" \
      -p IMAGE_TAG="ubi8-2"; \
    sleep 5s
     
  7. You can browse the registry’s devfiles/index.json file to verify your new devfile is included.
  8. Update your config map to point to the new registry.
    oc set env dc/che CHE_WORKSPACE_DEVFILE__REGISTRY__URL=http://che-devfile-registry-che.192.168.99.112.nip.io/
  9. Check your Che deployment to see if the changes are live by creating a new workspace from your devfile registry:

    2019-06-29

    Discovering containers loaded by Che 7

    Second in this series... more tips for Che 7 on Minishift.

    Discovering containers loaded by Che 7

    Prerequisites

    You need a Kubernetes or OpenShift cluster (eg., minikube or minishift), into which you have installed Che.
    Follow the steps in this document to deploy Che. Steps below can be done in parallel to collect a list of containers involved in deployment.

    Procedure

    1. Once you have started your cluster, you can watch events and see which images are pulled. Start this in a console window before deploying Che to your cluster.
      oc project che
      oc get po
      oc get events -w | tee /tmp/minishift.log.txt
    2. Watch for lines containing the following lines to see what containers are pulled.
      Successfully pulled image "..."
        and
      Container image "..." already present on machine
    3. For example, this should extract just a list of pulled containers, including any duplicate re-pulls:
      cat /tmp/minishift.log.txt | \
        egrep "Successfully pulled image|Container image" | \
        sed -e 's#.*\(Successfully pulled image\|Container image\) "\(.\+\)\".*#\2#g'
    4. You can also look at the available images in the minishift docker context:
      eval $(minishift docker-env)
      docker images
    5. Next, using chectldeploy Che to your cluster and watch the events get logged.
    6. You can also see container events at this URL:
      • https://192.168.YOUR.IP:8443/console/project/che/browse/events

    Deploying Che 7 to Minishift with chectl

    With the Che 7 just around the corner, and the realisation that I miss writing, I've decided to resurrect this blog from the dead and start a series of Che 7 tips. 

    First up, the handful of steps required to get Che 7 running on Minishift 1.34 (OKD 3.11).

    ----

    Deploying Che 7 to Minishift with chectl

    Prerequisites

    You need the latest Minishift and chectl releases.
    Fetch them like this (or similar):
    cd ~/bin
    curl -sSL  https://github.com/che-incubator/chectl/releases/download/20190628062929/chectl-linux -o chectl
    chmod +x chectl
    cd /tmp
    curl -sSL https://github.com/minishift/minishift/releases/download/v1.34.0/minishift-1.34.0-linux-amd64.tgz -o minishift.tgz
    tar xvzf minishift.tgz
    mv minishift*/minishift ~/bin/
    chmod +x ~/bin/minishift

    Procedure

    1. Start up minishift.
      minishift
    2. Log in once startup is complete. NOTE: you need cluster admin priviledges.
      oc login 192.168.MY.IP:8433 -u system -p admin
    3. To watch the events and see which images are pulled, see this document.
    4. Deploy Che to minishift:
      chectl server:start -a minishift-addon -p minishift
    5. Fix the plugin registry URL to use the latest version:
      oc set env dc/che CHE_WORKSPACE_PLUGIN__REGISTRY__URL=https://che-plugin-registry.openshift.io/v3
      You can open the console for the che deployment to verify your change has been applied:
      • https://192.168.YOUR.IP:8443/console/project/che/edit/dc/che
      You should see:
      CHE_WORKSPACE_PLUGIN__REGISTRY__URL = https://che-plugin-registry.openshift.io/v3
    6. Wait for redeployment to complete.
    7. Once running, you can see your Che instance here:
      • http://che-che.192.168.YOUR.IP.nip.io/
    8. If you then add a new workspace, you can see even more images pulled in the openshift event log.

    2017-02-24

    Streamline Nexus releases with nexus-staging-maven-plugin

    For years, I've had a many-step process for releasing Maven artifacts to the JBoss Nexus, which has made me reticent to do frequent releases due to the heavily manual process.
    1. Commit a change to the artifact's pom, replacing version x.y.z-SNAPSHOT with x.y.z
    2. Build the artifact in Jenkins (often triggered automatically via Github hooks) and deploy it to staging Nexus instance using server credentials in Jenkins
    3. Log into Nexus
    4. Browse for the Staging repos
    5. Sort the list by most recently updated
    6. Look for the "Implicitly created (auto staging)." entries
    7. For each entry, select the Content tab and drill down to see if that entry is the correct one (could be another job or person's staging bits)
    8. If the entry is correct, click the Close button and enter a description; if not, check the next one in the list until you find the correct one
    9. Click Refresh button
    10. Click the Release button
    11. Browse Nexus to verify the artifact is deployed

    But no more! 

    With the nexus-staging-maven-plugin, I can simplify that process by adding more Maven steps the job.
    1. Commit a change to the artifact's pom, replacing version x.y.z-SNAPSHOT with x.y.z
    2. Build the artifact in Jenkins (often triggered automatically via Github hooks) and deploy it to production Nexus instance using server credentials in Jenkins
    3. Browse Nexus to verify the artifact is deployed

    So, how do you enable this?

    • Ensure you have all the correct metadata configured in your pom: description, URL, license, developers, SCM, issueManagement, etc. 

    • Perform three steps in Jenkins

    That's it!

    Or, to enable this selectively for only releases (but not SNAPSHOTS):

    pom=${WORKSPACE}/path/to/pom.xml
    pomVersion=$(grep "" ${pom} | head -1 | sed -e "s#.*\(.\+\).*#\1#")
    MVN="/path/to/maven3/bin/mvn -Dmaven.repo.local=${WORKSPACE}/.repository/"
    if [[ ${pomVersion} == *"-SNAPSHOT" ]]; then 
      ${MVN} deploy
    else
      ${MVN} clean deploy -DskipRemoteStaging=true -f ${pom} \
        -DstagingDescription="[${JOB_NAME} ${BUILD_TIMESTAMP} ${BUILD_NUMBER}] :: ${pomVersion} :: deploy to local" 
      ${MVN} nexus-staging:deploy-staged -f ${pom} \
        -DstagingDescription="[${JOB_NAME} ${BUILD_TIMESTAMP} ${BUILD_NUMBER}] :: ${pomVersion} :: deploy to stage + close"
      ${MVN} nexus-staging:release -f ${pom} \
        -DstagingDescription="[${JOB_NAME} ${BUILD_TIMESTAMP} ${BUILD_NUMBER}] :: ${pomVersion} :: release"
    fi
    

    2016-11-01

    Kiva Loans - Eight Years Of Changing Lives

    As it's November and I haven't blogged in ages, and it's been three years since my last foray into writing a NaNoWriMo, I decided that it's high time I start blogging again. 

    So, to start things off gently, here's a quick recap of the loans I've given to Kiva.org, and through them have helped dozens of people to change their lives, $25 at a time.

    Checking my stats, I see I have loaned over $3000 since I started giving to Kiva in 2008. 


    Only 4 sectors have been so far omitted - honestly, I'm not sure that Personal Use and Entertainment should really be reasons for asking for a loan, but hey.


    Though one or two were not fully funded and were therefore returned, I've made over 100 loans to 33 countries - nearly half of those supported by microfinance lenders and Kiva. (I'm not sure which country was included in the first list, but not the second. Maybe that's what happens when countries change names, or are annexed?)



    Still have a long way to go to collect all the Activities achievements - nearly one third complete. Challenge accepted!


    If you'd like to play this game - a game that changes lives for the better - you can too. Click below to start lending today.


    2016-03-26

    Cast media from Windows netbook to Android tv box

    Finally figured out a simple way to cast media from my netbook to my TV box. 

    On the Android box:

    1. Install AirPlay/DLNA Receiver (LITE or PRO) from https://play.google.com/store/apps/details?id=com.waxrain.airplayer&hl=en

    2. Launch the app. Turn on DLNA DMR then set a device nickname. Apparently also works with AirPlay and AirTunes if you want to stream from an iPad/iPhone. 

    On the Windows box:

    1. Enable media sharing in Windows 10 from Control Panel\Network and Internet\Network and Sharing Center\Media streaming options (requires admin access).


    2. Install http://download.waxrain.com/AirPinPcSender/AirPinPcSetup.exe to send media from Windows to receiver.

    3. Browse for media file on Windows machine; right-click and select Cast To Device or DLNA Play to > [your android device].

    That's it!

    2016-01-18

    Jelly Bean Keyboard - Cursor Keys

    Ever wanted to add cursor movement keys to your text messaging experience? The Jelly Bean Keyboard includes this option, but it's somewhat hidden. Here's how to find and enable it.

    First, download the app from the Google Play Store: https://play.google.com/store/apps/details?id=com.jlsoft.inputmethod.latin.jbk43.free&hl=en

    Next, go into the settings applet, then find "Languages and input".


    Now look for Jelly Bean Keyboard 4.3 you installed earlier from the Play Store, and tap the gear icon next to that to enter settings for the keyboard.


    Here's the confusing / hidden setting part. Across the top, there's a "Standard Settings" bar, and under that is stuff like Auto-capitalization, Vibrate on keypress, Sound on keypress.

    To the RIGHT of "Standard Settings" is a "JBK 4.3 settings" item, which you can access by swiping from the right to the left.


    Now scroll down until you see "Key layouts". Below that are options for keyboard layouts when you're in landscape or portrait orientation. Next is an option for "Show arrows" which you can set to Never, Portrait, Landscape, or Both.


    The result? This:


    2016-01-01

    New Year's Day

    Been too long since I blogged here. Time to begin again.
    All is white on New Year's Day
    Like a dead channel, on the TV
    I want to be coding
    Be coding night and day
    The more things change
    The more they stay the same
    
    I will iterate again
    I will iterate again
    
    Under a neon bulb
    Group of devs chatter, in @s and pings
    Bugzillas logged, JIRAs are too
    The blogosphere says, says 
    Say it's true, it's true...
    And we can break through
    Though platforms too 
    Many spring from one 
    
    I... I will write some tests again
    I... I will write some tests again
    
    Oh...
    Maybe the time is right
    Oh... maybe tonight...
    
    I'll debug my tests again
    I'll debug my tests again
    
    And so we're told it's the container age
    Transform and deliver your apps a new way
    Still I want to be coding
    Be coding night and day
    The more things change
    The more they stay the same

    2014-12-11

    A Day In The Life

    Can't believe it's been a full two years since I last posted to this blog. Time flies when you're making change.


    I read the blogs today oh boy
    About more JS frameworks on their way
    And though the news was rather sad
    Well I just had to laugh
    I saw the infograph

    It was yet another approach
    To solving the same things of yesterday
    A crowd of people stood and trolled
    They'd seen this stuff before
    Nobody was really sure
    If it was like IO or Node

    I saw a tweet today oh boy
    Toronto street car service is still slow
    They've crowds of people every day
    But I still have to drive
    Cuz of where I live
    I'd love more subways here

    Woke up, fell outta bed
    A Beatles earworm in my head
    Found my way down th'hall and dialed my call
    And sitting there I noticed sound was dead

    Found my phone in seconds flat
    Bluejeans worked, so that was that
    Found my way online (had to reboot)
    And somebody spoke and I went into a dream

    I read the logs today oh boy
    Thousands of commits by hundreds of folks
    Though some issues were rather small
    We had to count them all
    Now we know how many tweaks it takes to make a new release
    And how to turn it on

    2012-12-07

    The JBoss Developers' Song

    Hey! Guess what?

    JBoss Tools 4.0 and JBoss Developer Studio 6.0 are available today. So... a quick tune in tribute to all the hard-working people who made it happen.

    Who squashes bugs users have found?
    Who keeps the unresolved count down?
    We do! We do!

    Who answers to the Will of Max?

    Who deals with all of the PEBCAKs?

    We do! We do!

    Who closed/resolved a thousand bugs?

    Who attends all of those JBUGs?

    We do! We do!

    Who fills more roles than Tom Hanks?

    Who gets the top Marketplace ranks? 1

    We do! We do!


    1 - As of 2012/12/07, JBoss Tools + JBoss Developer Studio successful Eclipse Marketplace installs for Helios, Indigo, and Juno total over 141,000. SpringIDE and Spring Tool Suite installs total over 163,000. This puts us #5 behind only Maven, Subclipse, Subversive, and Spring.