Skip to content

Instantly share code, notes, and snippets.

View m0un10's full-sized avatar

Craig Barr m0un10

View GitHub Profile

This is a simplified version of the instructions at https://bahmni.atlassian.net/wiki/display/BAH/Bahmni+Using+Docker What the instructions don't mention is that there is an easier way to get Bahmni up and running, through Vagrant. All of the docker magic is handled behind the scenes by a docker-compose plugin, so you don't really need to know anything about docker.

Prerequisites

  • Vagrant
  • VirtualBox
  • Git

Booting Vagrant

Generally followed the steps here with some necessary adjustments to get it to work.

Install pyenv

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

Add the following to .bash_profile

How to fix breaking change in the AWS developer preview SDK for Go on the client side

A recent commit resulted in a change in naming convention for the client struct. The below is tested on Mac OS X, not sure if it needs adjustment for linux distros or not. This is not an exhaustive fix, it just fixes the APIs that I was using in my projects.

find . -type f -name "*.go" | xargs sed -i '' 's/s3\.S3/s3.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/cloudfront\.CloudFront/cloudfront.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/dynamodb\.DynamoDB/dynamodb.Client/g'
@m0un10
m0un10 / upgrade-jenkins.md
Last active July 4, 2019 22:20
Upgrading Jenkins 1.x to 2.x

This is a brute force approach that helped me to upgrade from Jenkins 1.x to 2.x without much pain.

  1. Upgrade Jenkins from the web-console. This is an option under "Manage Jenkins"
  2. If it fails to boot up, check the Jenkins log. In my case, this was at /opt/jenkins/log/jenkins.log
  3. There may be multiple iterations required to fix missing dependencies or invalid/old configurations from Jenkins 1.x. I found it useful to start Jenkins (e.g. service jenkins start) then check the log and make adjustments to fix any startup errors.
  4. Once startup is successful, there will be a "Upgrade Now" banner in the Jenkins web-console. You can click on this and follow the prompts to choose valuable Jenkins 2 plugins such as the "Pipeline Plugin". This plugin allows support of the Jenkinsfile to automate end-to-end Continuous Delivery Pipelines in Jenkins.

The following are resolutions for common startup issues after upgrading Jenkins 1.x to 2.x

  • Remove AJP
  • API-lead connectivity: A methodical way to connect applications, data, and devices through reusable and purposeful APIs; the opposite of point-to-point integration.
  • Application Network: A network of applications, data, and devices connected by reusable APIs, each built with the principles of API-led connectivity.
  • Anypoint Platform: MuleSoft's platform that provides many tools to design, build, deploy, and operate the application network.

  • System APIs: unlock data from systems
  • Process APIs: compose data into processes
  • Experience APIs: deliver an experience

The annoying time things failed on the terminal

...and how I fixed it :)

The below fixes are for things failing on Mac.

(But, in some cases, could be cross-platform issues too.)

Getting started with React Native

serverless-stack.com with SAM

...as an alternative to the Serverless Framework.

Key Differences

  • SAM templates result in Cloudformation stacks. This has a benefit of ensuring all the resoures are defined together and allows the management from a GUI.
  • SAM requires that IAM policies to be defined at the function level rather than globally as per the Serverless Framework. According to the SAM docs, this was a design decision to reduce the risk of functions being granted more permissions than they need.
  • Enabling CORS in SAM requires the specific allowed methods and headers to be provided. This is as opposed to Serverless Framework where it is just an on/off flag.
  • SAM supports parameters to be passed to the template at deploy/test-time. Serverless Framework achieves this with environment variables.

GCP cached permissions issue

GCP has an issue which surfaces when service accounts are recreated with the same name but without the old policies being removed. It is confusing because the GUI and CLI will show that permissions are there and it will even let you re-add them BUT, anytime you try to do something that requires the permissions it won't work. For example, if you try to push an image it may say that you don't have storage.buckets.get even thought everything shows that you are part of storage.admin.

Reproducing the issue

Set the values to match your environment

export ACCOUNT=<service-account>
BEARER=$(curl -u _token:$(gcloud auth print-access-token) https://gcr.io/v2/token?scope=repository:$NAME:pull | cut -d'"' -f 10)
RESPONSE=`curl -H "Authorization: Bearer $BEARER" https://gcr.io/v2/$NAME/manifests/$TAG`
DIGEST=`echo $RESPONSE | jq -r '.config.digest'`
curl -L -H "Authorization: Bearer $BEARER" https://gcr.io/v2/$NAME/blobs/$DIGEST | jq